Configure bot name + refactoring.

This commit is contained in:
John Livingston
2023-09-19 18:56:39 +02:00
parent 9e7d9c6069
commit 4fe972dc10
7 changed files with 78 additions and 38 deletions

View File

@ -27,6 +27,7 @@ async function vivifyConfigurationChannel (
const data = new FormData(form)
const channelConfigurationOptions: ChannelConfigurationOptions = {
bot: data.get('bot') === '1',
botNickname: data.get('bot_nickname')?.toString() ?? '',
bannedJIDs: (data.get('banned_jids')?.toString() ?? '').split(/\r?\n|\r|\n/g),
forbiddenWords: (data.get('forbidden_words')?.toString() ?? '').split(/\r?\n|\r|\n/g)
}

View File

@ -47,6 +47,7 @@ async function renderConfigurationChannel (
bannedJIDs: await peertubeHelpers.translate(LOC_LIVECHAT_CONFIGURATION_CHANNEL_BANNED_JIDS_LABEL),
save: await peertubeHelpers.translate(LOC_SAVE),
cancel: await peertubeHelpers.translate(LOC_CANCEL),
botNickname: await peertubeHelpers.translate(LOC_LIVECHAT_CONFIGURATION_CHANNEL_BOT_NICKNAME),
channelConfiguration
}
@ -69,6 +70,14 @@ async function renderConfigurationChannel (
</fieldset>
<fieldset livechat-configuration-channel-options-bot-enabled>
<legend>{{botOptions}}</legend>
<label>
{{botNickname}}
<input
type="text"
name="bot_nickname"
value="{{channelConfiguration.configuration.botNickname}}"
/>
</label>
<label>
{{forbiddenWords}}
<textarea name="forbidden_words">