Skip to content

Commit

Permalink
hotfix: guildmemberadd undefined + other musings
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffrey-zang committed Jul 26, 2024
1 parent 7aedfcc commit 374739e
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ client.on('ready', async () => {
defaultPrefix: process.env.COMMAND_PREFIX
});

verificationQueueProcessor.startProcessing(client);
// verificationQueueProcessor.startProcessing(client);
})

client.on('voiceStateUpdate', (oldMember, newMember) => {
Expand All @@ -69,12 +69,27 @@ client.on('messageCreate', (message) => {
})

client.on('guildMemberAdd', async (member) => {
const userInfo = await UserController.getUserByDiscordID(member.id)

let userInfo

try {
userInfo = await UserController.getUserByDiscordID(member.id)
} catch (e) {
console.log(e);
}

if (userInfo) {
member.setNickname(userInfo.firstName + " " + userInfo.lastName);
try {
member.setNickname(userInfo.firstName + " " + userInfo.lastName);
} catch (e) {
console.log(e);
}
} else {
console.log(`Discord user ${newMember.id} not linked`);
try {
console.log(`Discord user ${member.id} not linked`);
} catch (e) {
console.log(e);
}
}
})

Expand Down

0 comments on commit 374739e

Please sign in to comment.