Simp-O-Matic

Dumb Discord bot in TS.
git clone git://git.knutsen.co/Simp-O-Matic
Log | Files | Refs | README | LICENSE

commit 546e29e04187a52f62e77b4c2b9a76e874384795
parent 90023f73806af37fa15e2347e29fe22a07ad2069
Author: Demonstrandum <moi@knutsen.co>
Date:   Wed, 11 Nov 2020 01:35:53 +0000

Initialise guild instance objects.

Diffstat:
Mlib/main.ts | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/main.ts b/lib/main.ts @@ -119,7 +119,7 @@ export class SimpOMatic { const guild_id = guild.id; // Set default configuration. GLOBAL_CONFIG.guilds[guild_id] = deep_copy(DEFAULT_GUILD_CONFIG); - + INSTANCE_VARIABLES.guilds[guild_id] = {}; // Set system-messages and main channels to some default. const default_channel = guild.channels.cache.find(channel => channel.permissionsFor(guild.me).has("SEND_MESSAGES")); @@ -189,6 +189,11 @@ export class SimpOMatic { } }); + for (const guild in GLOBAL_CONFIG.guilds) + if (GLOBAL_CONFIG.guilds.hasOwnProperty(guild)) + INSTANCE_VARIABLES.guilds[guild] = {}; + + // TODO: In web-server, check for correct secret. // Send messages on web-hooks. server(GLOBAL_CONFIG, body => {