mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
Create email and Reply functionality
This commit is contained in:
1 parent
15a8db1293
commit
b83a890f48
18 files changed
+229
-179
No files matched your search
@@ -121,15 +121,15 @@ export async function generateEmail(identifier: string): Promise<string> {
|
||||
const email = result[0]?.phone_email;
|
||||
|
||||
if (!email) {
|
||||
const emailUser = await getDefaultProfileNames(identifier);
|
||||
const userProfileNames = await getDefaultProfileNames(identifier);
|
||||
|
||||
if (!emailUser) {
|
||||
if (!userProfileNames) {
|
||||
throw new Error('Must provide a fullName or phoneNumber option to create an email');
|
||||
}
|
||||
|
||||
const emailProvider = config.email.provider || 'project-error.dev';
|
||||
|
||||
const newEmail = `${emailUser}@${emailProvider}`;
|
||||
const newEmail = `${userProfileNames[0]}@${emailProvider}`.trim().toLowerCase();
|
||||
const query = 'UPDATE users SET phone_email = ? WHERE identifier = ?';
|
||||
await pool.query(query, [newEmail, identifier]);
|
||||
mainLogger.debug(`Inserting email into Database: ${newEmail}`);
|
||||
|
||||
Reference in new issue
Block a user