From a92873a61370c6620186b2164cd6f047ed17b953 Mon Sep 17 00:00:00 2001 From: Hri7566 Date: Thu, 13 Jun 2024 21:44:40 -0400 Subject: [PATCH] Change MPP bot config file location, fix channels in said config, and add a check to make sure we only chat in the desired channel --- config/bots.yml | 13 ------------- config/mpp_bots.yml | 8 ++++++++ src/mpp/bot/Bot.ts | 8 ++++++++ src/mpp/bot/index.ts | 2 +- 4 files changed, 17 insertions(+), 14 deletions(-) delete mode 100644 config/bots.yml create mode 100644 config/mpp_bots.yml diff --git a/config/bots.yml b/config/bots.yml deleted file mode 100644 index 36be29f..0000000 --- a/config/bots.yml +++ /dev/null @@ -1,13 +0,0 @@ -# - uri: wss://mppclone.com:8443 -# channel: -# id: "βœ§π““π“”π“₯ π“‘π“Έπ“Έπ“Άβœ§" -# allowColorChanging: true -# - uri: wss://mppclone.com:8443 -# channel: -# id: "test/fishing" -# allowColorChanging: true - -- uri: wss://mppclone.com:8443 - channel: - id: "keller room" - allowColorChanging: true diff --git a/config/mpp_bots.yml b/config/mpp_bots.yml new file mode 100644 index 0000000..44583fc --- /dev/null +++ b/config/mpp_bots.yml @@ -0,0 +1,8 @@ +- uri: wss://mppclone.com:8443 + channel: + id: "βœ§π““π“”π“₯ π“‘π“Έπ“Έπ“Άβœ§" + allowColorChanging: true +- uri: wss://mppclone.com:8443 + channel: + id: "test/fishing" + allowColorChanging: true diff --git a/src/mpp/bot/Bot.ts b/src/mpp/bot/Bot.ts index 60844df..1bfd771 100644 --- a/src/mpp/bot/Bot.ts +++ b/src/mpp/bot/Bot.ts @@ -51,11 +51,19 @@ export class MPPNetBot { this.logger.info( `Received channel update for channel ID "${msg.ch._id}"` ); + + if (msg._id !== this.config.channel.id) { + this.client.setChannel(this.config.channel.id); + } }); this.client.on("a", async msg => { let prefixes: string[]; + if (this.client.channel._id !== this.config.channel.id) { + return; + } + try { prefixes = await this.trpc.prefixes.query(); } catch (err) { diff --git a/src/mpp/bot/index.ts b/src/mpp/bot/index.ts index df1f592..249f346 100644 --- a/src/mpp/bot/index.ts +++ b/src/mpp/bot/index.ts @@ -6,7 +6,7 @@ const logger = new Logger("big brain"); const bots: MPPNetBot[] = []; -const defaults = loadConfig("config/bots.yml", [ +const defaults = loadConfig("config/mpp_bots.yml", [ { uri: "wss://mppclone.com:8443", channel: {