mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
Fix first time join again :D
This commit is contained in:
1 parent
c7fc4ab660
commit
8fd711270d
2 files changed
+8
-2
No files matched your search
@@ -137,6 +137,7 @@ export async function generatePhoneNumber(identifier: string): Promise<string> {
|
|||||||
|
|
||||||
export async function generateEmail(
|
export async function generateEmail(
|
||||||
identifier: string,
|
identifier: string,
|
||||||
|
phoneNumber: string,
|
||||||
cb?: (email: string) => void,
|
cb?: (email: string) => void,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const getQuery = `SELECT phone_email FROM users WHERE identifier = ?`;
|
const getQuery = `SELECT phone_email FROM users WHERE identifier = ?`;
|
||||||
@@ -145,7 +146,12 @@ export async function generateEmail(
|
|||||||
const email = result[0]?.phone_email;
|
const email = result[0]?.phone_email;
|
||||||
|
|
||||||
if (!email) {
|
if (!email) {
|
||||||
const userProfileNames = await getDefaultProfileNames(identifier);
|
let userProfileNames = [phoneNumber] as string[];
|
||||||
|
try {
|
||||||
|
userProfileNames = await getDefaultProfileNames(identifier);
|
||||||
|
} catch (e) {
|
||||||
|
mainLogger.debug(`Could not find player information, defaulting to phone number as email`);
|
||||||
|
}
|
||||||
|
|
||||||
if (!userProfileNames) {
|
if (!userProfileNames) {
|
||||||
throw new Error('Must provide a fullName or phoneNumber option to create an email');
|
throw new Error('Must provide a fullName or phoneNumber option to create an email');
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ export async function handlePlayerAdd(pSource: number) {
|
|||||||
playerLogger.error(`Failed to load player information (${pSource})`);
|
playerLogger.error(`Failed to load player information (${pSource})`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const email = await generateEmail(playerIdentifer, (email) => {
|
const email = await generateEmail(playerIdentifer, phone_number, (email) => {
|
||||||
const subject = 'New Phone Who Dis';
|
const subject = 'New Phone Who Dis';
|
||||||
const sender = `no-reply@${config.email.provider || 'project-error.dev'}`;
|
const sender = `no-reply@${config.email.provider || 'project-error.dev'}`;
|
||||||
const body = '--translate-APPS_EMAIL_WELCOME';
|
const body = '--translate-APPS_EMAIL_WELCOME';
|
||||||
|
|||||||
Reference in new issue
Block a user