mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
29 lines
807 B
TypeScript
29 lines
807 B
TypeScript
import events from '../utils/events';
|
|
import { mainLogger } from './sv_logger';
|
|
import { getSource } from './functions';
|
|
import { pool } from './db';
|
|
|
|
const emailLogger = mainLogger.child({ module: 'contact' });
|
|
|
|
async function fetchInbox(email: string): Promise<any> {
|
|
const query = `
|
|
SELECT * FROM npwd_emails WHERE id = ?
|
|
`;
|
|
const result = await pool.query(query, [email]);
|
|
return result[0];
|
|
}
|
|
|
|
onNet(events.EMAIL_FETCH_INBOX, async () => {
|
|
const _source = getSource();
|
|
try {
|
|
const email = '[email protected]';
|
|
const inbox = await fetchInbox(email);
|
|
emitNet(events.EMAIL_FETCH_INBOX_SUCCESS, inbox);
|
|
} catch (e) {
|
|
emailLogger.error(`Failed to fetch email inbox, ${e.message}`, {
|
|
source: _source,
|
|
});
|
|
emitNet(events.EMAIL_FETCH_INBOX_ERROR, e);
|
|
}
|
|
});
|