Started REPL env for custom interactive shell

ONLY active when bot is running
- Arguments [--watch] displays how many usses of each trigger and how
many uses over the lifetime ofthe bot
Commands
- title [get/set] <newTitle>
- category [get/set] <newCategory> - MUST be a legit Twitch.tv one
- yet to come [cmd add|del|edit] [trigger] [response] (NOTE if you want
Emotes you will have to type the 'name' in for twitch chat to recognise
it)
This commit is contained in:
bryce
2025-07-15 01:08:12 +12:00
parent b82d5dd0d4
commit c704380ee3
7 changed files with 267 additions and 6 deletions

View File

@@ -97,7 +97,13 @@ func HandleMessage(client *twitch.Client, apiClient interface{}, message twitch.
// check perms
for _, cmd := range commands.GetAllCommands() {
if messageMatchesCommand(msg, botName, cmd) {
// track usage: use first alias as key
triggerKey := strings.ToLower(cmd.Triggers[0])
commands.IncrementUsage(triggerKey)
if userHasPermission(user, cmd.Permission) {
reply := ReplacePlaceholders(cmd.Replay, user.DisplayName, channel, botUsername)
client.Say(channel, cmd.Reply)
} else {
client.Say(channel, fmt.Sprintf("@%s You don't have permission to use this command.", user.DisplayName))