diff --git a/app.go b/app.go index a594854..5cd7ae8 100644 --- a/app.go +++ b/app.go @@ -339,6 +339,10 @@ func (a *App) LoginChatBot(cid string, username string, password string, streamU } func (a *App) StopAllChatBot(cid string) error { + if a.cb == nil { + return fmt.Errorf("Chat bot not initialized.") + } + err := a.cb.StopAllMessages() if err != nil { a.logError.Println("error stopping all chat bot messages:", err) @@ -349,6 +353,10 @@ func (a *App) StopAllChatBot(cid string) error { } func (a *App) StartAllChatBot(cid string) error { + if a.cb == nil { + return fmt.Errorf("Chat bot not initialized.") + } + err := a.cb.StartAllMessages() if err != nil { a.logError.Println("error starting all chat bot messages:", err) @@ -365,7 +373,7 @@ func (a *App) UpdateChatBotUrl(cid string, streamUrl string) error { defer a.cfgMu.Unlock() if a.cb == nil { - return fmt.Errorf("Chat bot not initalized.") + return fmt.Errorf("Chat bot not initialized.") } err := a.resetChatBot() diff --git a/frontend/src/components/StreamChatBot.jsx b/frontend/src/components/StreamChatBot.jsx index 321a29d..814b119 100644 --- a/frontend/src/components/StreamChatBot.jsx +++ b/frontend/src/components/StreamChatBot.jsx @@ -65,7 +65,8 @@ function StreamChatBot(props) { export default StreamChatBot; function StreamChatItem(props) { - const [active, setActive] = useState(props.isMessageActive(props.chat.id)); + // const [active, setActive] = useState(props.isMessageActive(props.chat.id)); + const [active, setActive] = useState(false); const [error, setError] = useState(''); const [filename, setFilename] = useState(props.chat.text_file); @@ -75,13 +76,13 @@ function StreamChatItem(props) { setFilename(name); }); } - setActive(props.isMessageActive(props.chat.id)); + // setActive(props.isMessageActive(props.chat.id)); }, [props]); const changeActive = (bool) => { // console.log('ChangeActive:', bool); // props.chat.active = bool; - props.activateMessage(props.chat.id, bool); + // props.activateMessage(props.chat.id, bool); setActive(bool); };