X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Ftwitch-bot%2FControls.js;h=496ff11dd9dae4f977eecb793e25e0f0f2349256;hb=1d3c8c6a96fc45d839f0e3719baca790059d189f;hp=822c201b8fde5504b97c5553dbd484fe6bc536d6;hpb=93f50820771a0333b169f76f74727239cf0cb286;p=alttp.git diff --git a/resources/js/components/twitch-bot/Controls.js b/resources/js/components/twitch-bot/Controls.js index 822c201..496ff11 100644 --- a/resources/js/components/twitch-bot/Controls.js +++ b/resources/js/components/twitch-bot/Controls.js @@ -9,8 +9,11 @@ import CommandDialog from './CommandDialog'; import Commands from './Commands'; import GuessingSettingsForm from './GuessingSettingsForm'; import ChannelSelect from '../common/ChannelSelect'; +import Icon from '../common/Icon'; import ToggleSwitch from '../common/ToggleSwitch'; +const CHAT_CATEGORIES = ['unclassified', 'hi', 'gl', 'gg', 'lol', 'pog', 'hype', 'o7']; + const Controls = () => { const [channel, setChannel] = React.useState(null); const [chatText, setChatText] = React.useState(''); @@ -32,6 +35,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 }); @@ -121,6 +136,7 @@ const Controls = () => { {t('twitchBot.channel')} { setChannel(channel); }} @@ -198,6 +214,18 @@ const Controls = () => { +

{t('twitchBot.randomChat')}

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

{t('twitchBot.chatSettings')}

@@ -228,7 +256,34 @@ const Controls = () => { -

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

+
+

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

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