Remove old logChannelId fallback, add additional verification that the log channel is a text channel

master
Dragory 2019-12-05 21:04:45 +02:00
parent 56bc979863
commit 69352eb756
1 changed files with 5 additions and 6 deletions

View File

@ -47,17 +47,16 @@ function getMainGuilds() {
*/ */
function getLogChannel() { function getLogChannel() {
const inboxGuild = getInboxGuild(); const inboxGuild = getInboxGuild();
const logChannel = inboxGuild.channels.get(config.logChannelId);
if (! config.logChannelId) {
logChannel = inboxGuild.channels.get(inboxGuild.id);
} else if (! logChannel) {
logChannel = inboxGuild.channels.get(config.logChannelId);
}
if (! logChannel) { if (! logChannel) {
throw new BotError('Log channel not found!'); throw new BotError('Log channel not found!');
} }
if (! (logChannel instanceof Eris.TextChannel)) {
throw new BotError('Make sure log channel is set to a text channel!');
}
return logChannel; return logChannel;
} }