From 1f651f6058b0cdf6048a0274b6c5b5c2d578b137 Mon Sep 17 00:00:00 2001 From: lyx0 <66651385+lyx0@users.noreply.github.com> Date: Sun, 31 Oct 2021 12:59:29 +0100 Subject: [PATCH] protect against smol trollings with echo commmand --- cmd/bot/bot.go | 6 +++--- pkg/commands/echo.go | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cmd/bot/bot.go b/cmd/bot/bot.go index 1b04ff3..ca8e8c9 100644 --- a/cmd/bot/bot.go +++ b/cmd/bot/bot.go @@ -21,9 +21,9 @@ func (b *Bot) Send(target, text string) { return } - // if text[0] == '.' || text[0] == '/' { - // text = ". " + text - // } + if text[0] == '.' || text[0] == '/' || text[0] == '!' { + text = ":tf: " + text + } // If a message is too long for a single twitch // message, split it into two messages. diff --git a/pkg/commands/echo.go b/pkg/commands/echo.go index 71e5904..4447c25 100644 --- a/pkg/commands/echo.go +++ b/pkg/commands/echo.go @@ -3,5 +3,11 @@ package commands import "github.com/lyx0/nourybot/cmd/bot" func Echo(channel, message string, nb *bot.Bot) { + + // if message[0] == '.' || message[0] == '/' || message[0] == '!' { + // nb.Send(channel, ":tf:") + // return + // } + nb.Send(channel, message) }