From 9e7d9c6069a3ff762de95c4b45dbf8de6ba3b336 Mon Sep 17 00:00:00 2001 From: John Livingston Date: Tue, 19 Sep 2023 18:02:57 +0200 Subject: [PATCH] Bot must be admin on the MUC component. --- server/lib/configuration/bot.ts | 7 +++++++ server/lib/prosody/config/content.ts | 3 +++ 2 files changed, 10 insertions(+) diff --git a/server/lib/configuration/bot.ts b/server/lib/configuration/bot.ts index b6d85dcb..c98d670a 100644 --- a/server/lib/configuration/bot.ts +++ b/server/lib/configuration/bot.ts @@ -217,6 +217,13 @@ class BotConfiguration { } } + /** + * Returns the moderation bot JID + */ + public moderationBotJID (): string { + return 'moderator@' + this.botsDomain + } + /** * frees the singleton */ diff --git a/server/lib/prosody/config/content.ts b/server/lib/prosody/config/content.ts index e63af328..c99598d0 100644 --- a/server/lib/prosody/config/content.ts +++ b/server/lib/prosody/config/content.ts @@ -439,6 +439,9 @@ class ProsodyConfigContent { this.bot.set('modules_enabled', ['ping']) this.bot.set('authentication', 'peertubelivechat_bot') + // Adding the moderation bot as admin to the muc component. + this.muc.add('admins', BotConfiguration.singleton().moderationBotJID()) + const configurationPaths = BotConfiguration.singleton().configurationPaths() if (configurationPaths.moderation?.globalDir) { this.bot.set('livechat_bot_conf_folder', configurationPaths.moderation.globalDir)