mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
add fill command
This commit is contained in:
parent
f6e7a6a065
commit
13252d3b0d
2 changed files with 33 additions and 0 deletions
25
pkg/commands/fill.go
Normal file
25
pkg/commands/fill.go
Normal file
|
@ -0,0 +1,25 @@
|
|||
package commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/gempir/go-twitch-irc/v2"
|
||||
)
|
||||
|
||||
func Fill(channel string, emote string, client *twitch.Client) {
|
||||
if emote[0] == '.' || emote[0] == '/' {
|
||||
client.Say(channel, ":tf:")
|
||||
return
|
||||
}
|
||||
|
||||
// Get the length of the emote
|
||||
emoteLength := (len(emote) + 1)
|
||||
|
||||
// Check how often the emote fits into a single message
|
||||
repeatCount := (499 / emoteLength)
|
||||
|
||||
reply := strings.Repeat(fmt.Sprintf(emote+" "), repeatCount)
|
||||
client.Say(channel, reply)
|
||||
|
||||
}
|
|
@ -100,5 +100,13 @@ func HandleCommand(message twitch.PrivateMessage, twitchClient *twitch.Client, u
|
|||
return
|
||||
}
|
||||
|
||||
case "fill":
|
||||
if msgLen == 1 {
|
||||
twitchClient.Say(message.Channel, "Usage: ()fill [emote]")
|
||||
return
|
||||
} else {
|
||||
commands.Fill(message.Channel, message.Message[7:len(message.Message)], twitchClient)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue