From: Daniel Karbach Date: Sun, 9 Aug 2026 10:42:46 +0000 (+0200) Subject: improved twitch bot controls X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=7245e8340756ee040fec6727f91c6a3ab14dfcc6;p=alttp.git improved twitch bot controls --- diff --git a/app/Http/Controllers/ChannelController.php b/app/Http/Controllers/ChannelController.php index d7bc398..859c018 100644 --- a/app/Http/Controllers/ChannelController.php +++ b/app/Http/Controllers/ChannelController.php @@ -114,7 +114,7 @@ class ChannelController extends Controller { 'adlib' => 'integer|min:0|max:100', 'language' => 'string|in:de,en,es,fr', 'min_age' => 'integer|min:1', - 'respond' => 'string|in:50,no,yes', + 'respond' => 'string|in:25,50,75,no,yes', 'source' => 'string|in:any,cat,catchan,chan', 'wait_msgs_min' => 'integer|min:1', 'wait_msgs_max' => 'integer|min:1', diff --git a/app/TwitchBot/TwitchChatBot.php b/app/TwitchBot/TwitchChatBot.php index 5443394..389beae 100644 --- a/app/TwitchBot/TwitchChatBot.php +++ b/app/TwitchBot/TwitchChatBot.php @@ -421,8 +421,11 @@ class TwitchChatBot extends TwitchBot { if ($setting == 'yes') { return true; } - if ($setting == '50') { - return random_int(0, 1); + if ($setting == 'no') { + return true; + } + if (is_numeric($setting)) { + return random_int(0, 100) <= intval($setting); } return false; } diff --git a/resources/js/components/twitch-bot/ChatSettingsForm.jsx b/resources/js/components/twitch-bot/ChatSettingsForm.jsx index 5810a3f..c18b935 100644 --- a/resources/js/components/twitch-bot/ChatSettingsForm.jsx +++ b/resources/js/components/twitch-bot/ChatSettingsForm.jsx @@ -115,7 +115,7 @@ const ChatSettingsForm = ({ onChange={handleChange} value={values.respond || 'yes'} > - {['yes', '50', 'no'].map(value => + {['yes', '75', '50', '25', 'no'].map(value => @@ -171,8 +171,11 @@ const ChatSettingsForm = ({ onChange={handleChange} type="number" value={Object.prototype.hasOwnProperty.call(values, 'adlib') - ? values.adlib : 50} + ? values.adlib : 5} /> + + {t('twitchBot.chatAdlibExplanation')} +
diff --git a/resources/js/i18n/de.js b/resources/js/i18n/de.js index 0a6c638..95ce1da 100644 --- a/resources/js/i18n/de.js +++ b/resources/js/i18n/de.js @@ -1020,6 +1020,7 @@ export default { channel: 'Channel', chat: 'Chat', chatAdlibChance: 'ad lib Chance', + chatAdlibExplanation: 'Generiert Nachrichten via Markov Chains basierend auf allen Quellen (wie a_n_i_v oder sg_viewer).', chatCategories: { adlib: 'ad lib', eyes: 'Augen', @@ -1135,7 +1136,9 @@ export default { randomChat: 'Random Chat', respond: 'Antworten', respondOptions: { + 25: '25%', 50: '50:50', + 75: '75%', no: 'Nein', yes: 'Ja', }, diff --git a/resources/js/i18n/en.js b/resources/js/i18n/en.js index c371c3b..5e0de85 100644 --- a/resources/js/i18n/en.js +++ b/resources/js/i18n/en.js @@ -1021,6 +1021,7 @@ export default { channel: 'Channel', chat: 'Chat', chatAdlibChance: 'ad lib chance', + chatAdlibExplanation: 'Generates messages via Markov chains based on all Sources (like a_n_i_v or sg_viewer).', chatCategories: { adlib: 'ad lib', eyes: 'Eyes', @@ -1136,7 +1137,9 @@ export default { randomChat: 'Random Chat', respond: 'Respond', respondOptions: { + 25: '25%', 50: '50:50', + 75: '75%', no: 'No', yes: 'Yes', },