fix(arabot): add error handling for undefined errors

This commit is contained in:
smyalygames 2022-10-25 03:47:00 +01:00
parent f389479e9a
commit 4d819d87d2
2 changed files with 4 additions and 4 deletions

View File

@ -311,10 +311,10 @@ class VerificationJoinVCListener extends Listener {
// Add up to 10 of the latest sus notes to the embed
for (let i = notes.length > 10 ? notes.length - 10 : 0; i < notes.length; i += 1) {
// Get mod name
const modGuildMember = guild!.members.cache.get(notes[i].modId);
const modGuildMember = guild.members.cache.get(notes[i].modId);
let mod = notes[i].modId;
if (modGuildMember !== undefined) {
mod = modGuildMember!.displayName;
mod = modGuildMember.displayName;
}
// Add sus note to embed
embed.addFields({

View File

@ -74,10 +74,10 @@ class VerificationLeaveVCListener extends Listener {
// Allow more people to join VC if there are less than 10 VCs
if (!verifier) {
const user = guild.members.cache.get(userSnowflake!)!;
const user = guild.members.cache.get(userSnowflake!);
// Remove verify as vegan and give non vegan role
if (!await checkFinish(channel.id)) {
if (!await checkFinish(channel.id) && user !== undefined) {
// Get roles to give back to the user
const roles = await fetchRoles(user.id);
roles.push(IDs.roles.verifyBlock);