commit 47a819eee9af0b83c6cb744429cb04f3a8c0fd60
parent 1d04c82d6ee4009bb9872a3cbbcd8358c2dff155
Author: Demonstrandum <moi@knutsen.co>
Date: Sun, 17 May 2020 22:47:28 +0100
Clean up Danny's stinky doo-doo.
Diffstat:
4 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/lib/commands/whitelistchannels.ts b/lib/commands/whitelistchannels.ts
@@ -2,5 +2,11 @@
// .whitelistchannels without any arguments turns off the function
export default async (home_scope: HomeScope) => {
const { message, CONFIG } = home_scope;
- CONFIG.whitelistchannels = [...message.mentions.channels.keys()];
-}-
\ No newline at end of file
+
+ if (!CONFIG.whitelistchannels)
+ CONFIG.whitelistchannels = [];
+
+ CONFIG.whitelistchannels.push.apply(
+ CONFIG.whitelistchannels,
+ [...message.mentions.channels.keys()]);
+}
diff --git a/lib/default.ts b/lib/default.ts
@@ -5,6 +5,7 @@
const DEFAULT_GUILD_CONFIG : Types.Config = {
main_channel: null,
system_channel: null,
+ whitelistchannels: [],
pp_sizes: {
'541761315887120399': 16,
'265958795254038535': 36
diff --git a/lib/extensions.ts b/lib/extensions.ts
@@ -28,6 +28,7 @@ declare global {
type Config = {
main_channel: string,
system_channel: string,
+ whitelistchannels: string[],
pp_sizes: { [key: string]: number }
cron_jobs: any[],
cron_interval: number;
diff --git a/lib/main.ts b/lib/main.ts
@@ -240,7 +240,9 @@ export class SimpOMatic {
if (message.content.startsWith('..')) return;
- if(CONFIG.whitelistchannels.length > 0 && CONFIG.whitelistchannels.includes(message.channel.id))
+ if (CONFIG.whitelistchannels
+ && CONFIG.whitelistchannels.length > 0
+ && CONFIG.whitelistchannels.includes(message.channel.id))
return;
const last_command = this._COMMAND_HISTORY.last();