This commit is contained in:
Ean Milligan (Bastion) 2022-06-22 21:45:40 -04:00
parent 021f33fc38
commit 57518f75a9
4 changed files with 12 additions and 6 deletions

4
mod.ts
View File

@ -90,7 +90,9 @@ startBot({
},
guildCreate: (guild: DiscordenoGuild) => {
log(LT.LOG, `Handling joining guild ${JSON.stringify(guild)}`);
sendMessage(config.logChannel, `New guild joined: ${guild.name} (id: ${guild.id}). This guild has ${guild.memberCount} members!`).catch((e: Error) => utils.commonLoggers.messageSendError('mod.ts:95', 'Join Guild', e));
sendMessage(config.logChannel, `New guild joined: ${guild.name} (id: ${guild.id}). This guild has ${guild.memberCount} members!`).catch((e: Error) =>
utils.commonLoggers.messageSendError('mod.ts:95', 'Join Guild', e)
);
},
guildDelete: (guild: DiscordenoGuild) => {
log(LT.LOG, `Handling leaving guild ${JSON.stringify(guild)}`);

View File

@ -42,6 +42,6 @@ export const auditDB = async (message: DiscordenoMessage) => {
}],
}).catch((e: Error) => utils.commonLoggers.messageSendError('auditDB.ts:43', message, e));
} catch (e) {
utils.commonLoggers.messageSendError('auditDB.ts:45', message, e)
utils.commonLoggers.messageSendError('auditDB.ts:45', message, e);
}
};

View File

@ -34,8 +34,10 @@ export const stats = async (message: DiscordenoMessage) => {
const cachedGuilds = await cacheHandlers.size('guilds');
const cachedChannels = await cacheHandlers.size('channels');
const cachedMembers = await cacheHandlers.size('members');
m.edit(generateStats(cachedGuilds + cache.dispatchedGuildIds.size, cachedChannels + cache.dispatchedChannelIds.size, cachedMembers, rolls, total - rolls)).catch((e: Error) => utils.commonLoggers.messageSendError('stats.ts:37', message, e));
m.edit(generateStats(cachedGuilds + cache.dispatchedGuildIds.size, cachedChannels + cache.dispatchedChannelIds.size, cachedMembers, rolls, total - rolls)).catch((e: Error) =>
utils.commonLoggers.messageSendError('stats.ts:38', message, e)
);
} catch (e) {
utils.commonLoggers.messageSendError('stats.ts:39', message, e);
utils.commonLoggers.messageSendError('stats.ts:41', message, e);
}
};

View File

@ -95,8 +95,10 @@ Available Commands:
};
const genericLogger = (level: LT, message: string) => log(level, message);
const messageSendError = (location: string, message: DiscordenoMessage | string, err: Error) => genericLogger(LT.ERROR, `${location} | Failed to send message: ${JSON.stringify(message)} | Error: ${err.name} - ${err.message} `)
const messageDeleteError = (location: string, message: DiscordenoMessage | string, err: Error) => genericLogger(LT.ERROR, `${location} | Failed to delete message: ${JSON.stringify(message)} | Error: ${err.name} - ${err.message} `)
const messageSendError = (location: string, message: DiscordenoMessage | string, err: Error) =>
genericLogger(LT.ERROR, `${location} | Failed to send message: ${JSON.stringify(message)} | Error: ${err.name} - ${err.message} `);
const messageDeleteError = (location: string, message: DiscordenoMessage | string, err: Error) =>
genericLogger(LT.ERROR, `${location} | Failed to delete message: ${JSON.stringify(message)} | Error: ${err.name} - ${err.message} `);
export default {
commonLoggers: {