X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Ftwitch-bot%2FControls.js;h=f64ee62712a658da228c4ebacbc895d55931bf35;hb=1b9629ce7f600b4aa9c9d51a281e514031871828;hp=84742d8aed9bf6fedeaf5b4860d66fcd661392cc;hpb=c66d9d3c5eda563842c683827da1abf445b65483;p=alttp.git diff --git a/resources/js/components/twitch-bot/Controls.js b/resources/js/components/twitch-bot/Controls.js index 84742d8..f64ee62 100644 --- a/resources/js/components/twitch-bot/Controls.js +++ b/resources/js/components/twitch-bot/Controls.js @@ -8,10 +8,33 @@ import ChatSettingsForm from './ChatSettingsForm'; import CommandDialog from './CommandDialog'; import Commands from './Commands'; import GuessingSettingsForm from './GuessingSettingsForm'; +import ChatBotLog from '../chat-bot-logs/ChatBotLog'; import ChannelSelect from '../common/ChannelSelect'; import Icon from '../common/Icon'; import ToggleSwitch from '../common/ToggleSwitch'; +const CHAT_CATEGORIES = [ + 'unclassified', + 'hi', + 'gl', + 'gg', + 'eyes', + 'love', + 'lol', + 'yes', + 'no', + 'rage', + 'sad', + 'sweat', + 'wtf', + 'pog', + 'hype', + 'kappa', + 'o7', + 'question', + 'thx', +]; + const Controls = () => { const [channel, setChannel] = React.useState(null); const [chatText, setChatText] = React.useState(''); @@ -33,6 +56,18 @@ const Controls = () => { } }, [channel, chatText, t]); + const randomChat = React.useCallback(async (category) => { + try { + await axios.post(`/api/channels/${channel.id}/chat`, { + bot_nick: 'horstiebot', + category, + }); + toastr.success(t('twitchBot.chatSuccess')); + } catch (e) { + toastr.error(t('twitchBot.chatError')); + } + }, [channel, chatText, t]); + const join = React.useCallback(async (bot_nick) => { try { const rsp = await axios.post(`/api/channels/${channel.id}/join`, { bot_nick }); @@ -200,9 +235,26 @@ const Controls = () => { +

{t('twitchBot.randomChat')}

+
+ {CHAT_CATEGORIES.map(category => + + )} +
-

{t('twitchBot.chatSettings')}

+
+

{t('twitchBot.chatSettings')}

+
+ +
+
@@ -232,19 +284,31 @@ const Controls = () => {

{t('twitchBot.guessingGame.settings')}

- +
+ {channel.access_key ? + + : null} + +