From 4034999fac7720bf80eaea9e513ddf6c59f6f45e Mon Sep 17 00:00:00 2001 From: lyx0 Date: Fri, 15 Oct 2021 18:41:02 +0200 Subject: [PATCH] make echo return more than one word --- pkg/commands/echo.go | 7 +++++++ pkg/commands/xd.go | 1 + pkg/handlers/command.go | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 pkg/commands/echo.go create mode 100644 pkg/commands/xd.go diff --git a/pkg/commands/echo.go b/pkg/commands/echo.go new file mode 100644 index 0000000..cb615bb --- /dev/null +++ b/pkg/commands/echo.go @@ -0,0 +1,7 @@ +package commands + +import "github.com/gempir/go-twitch-irc/v2" + +func Echo(channel string, message string, client *twitch.Client) { + client.Say(channel, message) +} diff --git a/pkg/commands/xd.go b/pkg/commands/xd.go new file mode 100644 index 0000000..cdff10d --- /dev/null +++ b/pkg/commands/xd.go @@ -0,0 +1 @@ +package commands diff --git a/pkg/handlers/command.go b/pkg/handlers/command.go index 1edb09e..b59ee17 100644 --- a/pkg/handlers/command.go +++ b/pkg/handlers/command.go @@ -44,7 +44,7 @@ func HandleCommand(message twitch.PrivateMessage, twitchClient *twitch.Client, u twitchClient.Say(message.Channel, "xd") return case "echo": - twitchClient.Say(message.Channel, cmdParams[1]) + commands.Echo(message.Channel, message.Message[7:len(message.Message)], twitchClient) return case "ping": commands.Ping(message.Channel, twitchClient, uptime)