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('');
}
}, [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 });
</Button>
</div>
</Form.Group>
+ <h3 className="mt-3">{t('twitchBot.randomChat')}</h3>
+ <div className="button-bar">
+ {CHAT_CATEGORIES.map(category =>
+ <Button
+ key={category}
+ onClick={() => { randomChat(category); }}
+ variant="outline-secondary"
+ >
+ {t(`twitchBot.chatCategories.${category}`)}
+ </Button>
+ )}
+ </div>
</Col>
<Col className="mt-5" md={6}>
<h3>{t('twitchBot.chatSettings')}</h3>