mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
WIP :D
This commit is contained in:
1 parent
ff4381fa01
commit
a97d858f99
21 files changed
+659
-161
No files matched your search
@@ -3,8 +3,6 @@ import { getIdentifier, getSource } from './functions';
|
||||
import { mainLogger } from './sv_logger';
|
||||
import { ContactEvents } from '../../typings/contact';
|
||||
|
||||
const contactsLogger = mainLogger.child({ module: 'contact' });
|
||||
|
||||
interface Contacts {
|
||||
id?: number;
|
||||
display: string;
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
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);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user