Make the bot not delete extensions that dont have an attached user

This commit is contained in:
Christopher Cookman 2023-04-26 11:27:19 -06:00
parent ec8bbe0dfd
commit 2bc68fb682
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42

View file

@ -267,6 +267,10 @@ dcClient.on('ready', () => {
let extensions = result.fetchAllExtensions.extension; let extensions = result.fetchAllExtensions.extension;
extensions.forEach((extension) => { extensions.forEach((extension) => {
lookupExtension(extension.user.extension, "ext").then((result) => { lookupExtension(extension.user.extension, "ext").then((result) => {
if(result.result.fetchVoiceMail.email == null) {
// Extension is not part of the bot, do nothing
return;
};
// Fetch Discord user using ID stored in result.result.fetchVoiceMail.email, and see if they're in the server // Fetch Discord user using ID stored in result.result.fetchVoiceMail.email, and see if they're in the server
dcClient.guilds.cache.get(config.discord.guildId).members.fetch(result.result.fetchVoiceMail.email).then((member) => { dcClient.guilds.cache.get(config.discord.guildId).members.fetch(result.result.fetchVoiceMail.email).then((member) => {
// They're in the server, do nothing // They're in the server, do nothing