Bot avatar:

* For now, only one avatar possible,
* uses mod_random_vcard_peertubelivechat,
* mod_random_vcard_peertubelivechat has a new option with the avatar
  list (instead of a hardcoded avatar number)
* Peertube lists available avatars files, and pass it to mod_random_vcard_peertubelivechat
This commit is contained in:
John Livingston
2023-09-25 11:20:46 +02:00
parent 15ec31426e
commit e2c85af001
6 changed files with 52 additions and 9 deletions

View File

@ -427,21 +427,27 @@ class ProsodyConfigContent {
}
}
useAnonymousRandomVCards (avatarPath: string): void {
useAnonymousRandomVCards (avatarPath: string, avatarFiles: string[]): void {
if (this.anon) {
this.anon.add('modules_enabled', 'random_vcard_peertubelivechat')
this.anon.set('peertubelivechat_random_vcard_avatars_path', avatarPath)
this.anon.set('peertubelivechat_random_vcard_avatars_files', avatarFiles)
}
}
/**
* Enable the bots virtualhost.
*/
useBotsVirtualHost (): void {
useBotsVirtualHost (botAvatarPath: string, botAvatarFiles: string[]): void {
this.bot = new ProsodyConfigVirtualHost('bot.' + this.prosodyDomain)
this.bot.set('modules_enabled', ['ping'])
this.bot.set('authentication', 'peertubelivechat_bot')
// For now, just using random_vcard_peertubelivechat to set bot avatar
this.bot.add('modules_enabled', 'random_vcard_peertubelivechat')
this.bot.set('peertubelivechat_random_vcard_avatars_path', botAvatarPath)
this.bot.set('peertubelivechat_random_vcard_avatars_files', botAvatarFiles)
// Adding the moderation bot as admin to the muc component.
this.muc.add('admins', BotConfiguration.singleton().moderationBotJID())

View File

@ -9,6 +9,9 @@ interface ProsodyFilePaths {
certsDirIsCustom: boolean
modules: string
avatars: string
avatarsFiles: string[]
botAvatars: string
botAvatarsFiles: string[]
exec?: string
execArgs: string[]
execCtl?: string