diff --git a/frontend/src/locale/en/translation.json b/frontend/src/locale/en/translation.json
index 088b7cb..6b27f9f 100644
--- a/frontend/src/locale/en/translation.json
+++ b/frontend/src/locale/en/translation.json
@@ -95,10 +95,7 @@
"bot-info-header": "Bot account info",
"bot-settings-copy": "A bot can interact with chat messages and provide extra events for the platform (chat events, some notifications) but requires access to a Twitch account. You can use your own or make a new one (if enabled on your main account, you can re-use the same email for your second account!)",
"bot-chat-header": "Chat logging",
- "bot-chat-keys": "Enable chat logging",
- "bot-chat-history": "How many messages to keep in history",
- "bot-chat-history-suffix": "messages",
- "bot-chat-history-desc": "Chat logging allows for pages and modules to read messages from chat. It's recommended to keep chat logging enabled with a reasonable history size (eg. 6)"
+ "bot-chat-history": "How many messages to keep in history (0 to disable)"
},
"botcommands": {
"title": "Bot commands",
diff --git a/frontend/src/store/api/types.ts b/frontend/src/store/api/types.ts
index a1fca23..2e3bd41 100644
--- a/frontend/src/store/api/types.ts
+++ b/frontend/src/store/api/types.ts
@@ -21,7 +21,6 @@ interface TwitchBotConfig {
username: string;
oauth: string;
channel: string;
- chat_keys: boolean;
chat_history: number;
}
diff --git a/frontend/src/ui/pages/TwitchSettings.tsx b/frontend/src/ui/pages/TwitchSettings.tsx
index fddaa2a..af49ce9 100644
--- a/frontend/src/ui/pages/TwitchSettings.tsx
+++ b/frontend/src/ui/pages/TwitchSettings.tsx
@@ -157,65 +157,25 @@ function TwitchBotSettings() {
{t('pages.twitch-settings.bot-chat-header')}
- {t('pages.twitch-settings.bot-chat-history-desc')}
-
-
-
- dispatch(
- apiReducer.actions.twitchBotConfigChanged({
- ...botConfig,
- chat_keys: !!ev,
- }),
- )
- }
- id="bot-chat-keys"
- >
- {active && }
-
-
-
-
-
-
+
-
-
- dispatch(
- apiReducer.actions.twitchBotConfigChanged({
- ...botConfig,
- chat_history: ev.target.value,
- }),
- )
- }
- />
- {t('pages.twitch-settings.bot-chat-history-suffix')}
-
+
+ dispatch(
+ apiReducer.actions.twitchBotConfigChanged({
+ ...botConfig,
+ chat_history: ev.target.value,
+ }),
+ )
+ }
+ />
diff --git a/modules/twitch/bot.go b/modules/twitch/bot.go
index 2d06649..e4943ff 100644
--- a/modules/twitch/bot.go
+++ b/modules/twitch/bot.go
@@ -108,15 +108,13 @@ func NewBot(api *Client, config BotConfig) *Bot {
}
bot.mu.Unlock()
- if bot.config.EnableChatKeys {
- bot.api.db.PutJSON(ChatEventKey, message)
- if bot.config.ChatHistory > 0 {
- if len(bot.chatHistory) >= bot.config.ChatHistory {
- bot.chatHistory = bot.chatHistory[len(bot.chatHistory)-bot.config.ChatHistory+1:]
- }
- bot.chatHistory = append(bot.chatHistory, message)
- bot.api.db.PutJSON(ChatHistoryKey, bot.chatHistory)
+ bot.api.db.PutJSON(ChatEventKey, message)
+ if bot.config.ChatHistory > 0 {
+ if len(bot.chatHistory) >= bot.config.ChatHistory {
+ bot.chatHistory = bot.chatHistory[len(bot.chatHistory)-bot.config.ChatHistory+1:]
}
+ bot.chatHistory = append(bot.chatHistory, message)
+ bot.api.db.PutJSON(ChatHistoryKey, bot.chatHistory)
}
if bot.Timers != nil {
@@ -156,11 +154,15 @@ func NewBot(api *Client, config BotConfig) *Bot {
}
// Load custom commands
- api.db.GetJSON(CustomCommandsKey, &bot.customCommands)
- err = bot.updateTemplates()
+ err = api.db.GetJSON(CustomCommandsKey, &bot.customCommands)
if err != nil {
bot.logger.WithError(err).Error("failed to load custom commands")
}
+
+ err = bot.updateTemplates()
+ if err != nil {
+ bot.logger.WithError(err).Error("failed to parse custom commands")
+ }
go api.db.Subscribe(context.Background(), bot.updateCommands, CustomCommandsKey)
go api.db.Subscribe(context.Background(), bot.handleWriteMessageRPC, WriteMessageRPC)
diff --git a/modules/twitch/data.go b/modules/twitch/data.go
index 0f228d1..a194f41 100644
--- a/modules/twitch/data.go
+++ b/modules/twitch/data.go
@@ -12,11 +12,10 @@ type Config struct {
const BotConfigKey = "twitch/bot-config"
type BotConfig struct {
- Username string `json:"username"`
- Token string `json:"oauth"`
- Channel string `json:"channel"`
- EnableChatKeys bool `json:"chat_keys"`
- ChatHistory int `json:"chat_history"`
+ Username string `json:"username"`
+ Token string `json:"oauth"`
+ Channel string `json:"channel"`
+ ChatHistory int `json:"chat_history"`
}
const ChatEventKey = "twitch/ev/chat-message"