mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
add commands to search for emotes
This commit is contained in:
parent
863b37f95c
commit
27bd336a8f
9 changed files with 115 additions and 38 deletions
|
@ -53,9 +53,17 @@ func handleCommand(message twitch.PrivateMessage, tc *twitch.Client) {
|
|||
common.Send(target, "xd", tc)
|
||||
return
|
||||
}
|
||||
case "bttv": // Pretty spammy command so it's limited to my own channel until elevated messages are implemented.
|
||||
case "bttv":
|
||||
if msgLen < 2 {
|
||||
common.Send(target, "Not enough arguments provided. Usage: ()bttv [emote name]", tc)
|
||||
return
|
||||
} else {
|
||||
commands.Bttv(target, cmdParams[1], tc)
|
||||
return
|
||||
}
|
||||
case "bttvemotes": // Pretty spammy command so it's limited to my own channel until elevated messages are implemented.
|
||||
if target == "nourylul" || target == "nourybot" {
|
||||
commands.Bttv(target, tc)
|
||||
commands.Bttvemotes(target, tc)
|
||||
return
|
||||
} else {
|
||||
return
|
||||
|
@ -66,19 +74,49 @@ func handleCommand(message twitch.PrivateMessage, tc *twitch.Client) {
|
|||
return
|
||||
}
|
||||
commands.Currency(target, cmdParams[1], cmdParams[2], cmdParams[4], tc)
|
||||
return
|
||||
case "echo":
|
||||
if msgLen < 2 {
|
||||
if message.User.ID != "31437432" { // Limit to myself for now.
|
||||
return
|
||||
} else if msgLen < 2 {
|
||||
common.Send(target, "Not enough arguments provided.", tc)
|
||||
return
|
||||
} else {
|
||||
commands.Echo(target, message.Message[7:len(message.Message)], tc)
|
||||
return
|
||||
}
|
||||
case "ffz": // Pretty spammy command so it's limited to my own channel until elevated messages are implemented.
|
||||
if target == "nourylul" || target == "nourybot" {
|
||||
commands.Ffz(target, tc)
|
||||
case "ffz":
|
||||
if msgLen < 2 {
|
||||
common.Send(target, "Not enough arguments provided. Usage: ()ffz [emote name]", tc)
|
||||
return
|
||||
} else {
|
||||
commands.Ffz(target, cmdParams[1], tc)
|
||||
return
|
||||
}
|
||||
case "ffzemotes": // Pretty spammy command so it's limited to my own channel until elevated messages are implemented.
|
||||
if target == "nourylul" || target == "nourybot" {
|
||||
commands.Ffzemotes(target, tc)
|
||||
return
|
||||
} else {
|
||||
return
|
||||
}
|
||||
case "ping":
|
||||
commands.Ping(target, tc)
|
||||
return
|
||||
case "preview":
|
||||
if msgLen < 2 {
|
||||
common.Send(target, "Not enough arguments provided. Usage: ()preview forsen", tc)
|
||||
return
|
||||
} else {
|
||||
commands.Preview(target, cmdParams[1], tc)
|
||||
return
|
||||
}
|
||||
case "thumbnail":
|
||||
if msgLen < 2 {
|
||||
common.Send(target, "Not enough arguments provided. Usage: ()thumbnail forsen", tc)
|
||||
return
|
||||
} else {
|
||||
commands.Preview(target, cmdParams[1], tc)
|
||||
return
|
||||
}
|
||||
case "tweet":
|
||||
|
@ -88,7 +126,5 @@ func handleCommand(message twitch.PrivateMessage, tc *twitch.Client) {
|
|||
} else {
|
||||
commands.Tweet(target, cmdParams[1], tc)
|
||||
}
|
||||
case "ping":
|
||||
commands.Ping(target, tc)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,20 +26,17 @@ func main() {
|
|||
Logger: sugar,
|
||||
}
|
||||
|
||||
// Received a PrivateMessage (normal chat message), pass it to
|
||||
// the handler who checks for further action.
|
||||
// Received a PrivateMessage (normal chat message).
|
||||
app.TwitchClient.OnPrivateMessage(func(message twitch.PrivateMessage) {
|
||||
app.handlePrivateMessage(message)
|
||||
})
|
||||
|
||||
// Received a WhisperMessage (Twitch DM), pass it to
|
||||
// the handler who checks for further action.
|
||||
// Received a WhisperMessage (Twitch DM).
|
||||
app.TwitchClient.OnWhisperMessage(func(message twitch.WhisperMessage) {
|
||||
app.handleWhisperMessage(message)
|
||||
})
|
||||
|
||||
// Successfully connected to Twitch so we log a message with the
|
||||
// mode we are currently running in..
|
||||
// Successfully connected to Twitch
|
||||
app.TwitchClient.OnConnect(func() {
|
||||
app.Logger.Infow("Successfully connected to Twitch Servers",
|
||||
"Bot username", cfg.TwitchUsername,
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
package commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/gempir/go-twitch-irc/v3"
|
||||
"github.com/lyx0/nourybot/pkg/common"
|
||||
"github.com/lyx0/nourybot/pkg/decapi"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func Bttv(target string, tc *twitch.Client) {
|
||||
sugar := zap.NewExample().Sugar()
|
||||
defer sugar.Sync()
|
||||
func Bttv(target, query string, tc *twitch.Client) {
|
||||
reply := fmt.Sprintf("https://betterttv.com/emotes/shared/search?query=%s", query)
|
||||
|
||||
resp, err := decapi.Bttv(target)
|
||||
if err != nil {
|
||||
sugar.Error(err)
|
||||
}
|
||||
|
||||
common.Send(target, resp, tc)
|
||||
common.Send(target, reply, tc)
|
||||
}
|
||||
|
|
20
pkg/commands/bttvemotes.go
Normal file
20
pkg/commands/bttvemotes.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
package commands
|
||||
|
||||
import (
|
||||
"github.com/gempir/go-twitch-irc/v3"
|
||||
"github.com/lyx0/nourybot/pkg/common"
|
||||
"github.com/lyx0/nourybot/pkg/decapi"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func Bttvemotes(target string, tc *twitch.Client) {
|
||||
sugar := zap.NewExample().Sugar()
|
||||
defer sugar.Sync()
|
||||
|
||||
resp, err := decapi.Bttvemotes(target)
|
||||
if err != nil {
|
||||
sugar.Error(err)
|
||||
}
|
||||
|
||||
common.Send(target, resp, tc)
|
||||
}
|
|
@ -1,20 +1,14 @@
|
|||
package commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/gempir/go-twitch-irc/v3"
|
||||
"github.com/lyx0/nourybot/pkg/common"
|
||||
"github.com/lyx0/nourybot/pkg/decapi"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func Ffz(target string, tc *twitch.Client) {
|
||||
sugar := zap.NewExample().Sugar()
|
||||
defer sugar.Sync()
|
||||
func Ffz(target, query string, tc *twitch.Client) {
|
||||
reply := fmt.Sprintf("https://www.frankerfacez.com/emoticons/?q=%s", query)
|
||||
|
||||
resp, err := decapi.Ffz(target)
|
||||
if err != nil {
|
||||
sugar.Error(err)
|
||||
}
|
||||
|
||||
common.Send(target, resp, tc)
|
||||
common.Send(target, reply, tc)
|
||||
}
|
||||
|
|
20
pkg/commands/ffzemotes.go
Normal file
20
pkg/commands/ffzemotes.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
package commands
|
||||
|
||||
import (
|
||||
"github.com/gempir/go-twitch-irc/v3"
|
||||
"github.com/lyx0/nourybot/pkg/common"
|
||||
"github.com/lyx0/nourybot/pkg/decapi"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func Ffzemotes(target string, tc *twitch.Client) {
|
||||
sugar := zap.NewExample().Sugar()
|
||||
defer sugar.Sync()
|
||||
|
||||
resp, err := decapi.Ffzemotes(target)
|
||||
if err != nil {
|
||||
sugar.Error(err)
|
||||
}
|
||||
|
||||
common.Send(target, resp, tc)
|
||||
}
|
16
pkg/commands/preview.go
Normal file
16
pkg/commands/preview.go
Normal file
|
@ -0,0 +1,16 @@
|
|||
package commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/gempir/go-twitch-irc/v3"
|
||||
"github.com/lyx0/nourybot/pkg/common"
|
||||
)
|
||||
|
||||
func Preview(target, channel string, tc *twitch.Client) {
|
||||
imageHeight := common.GenerateRandomNumberRange(1040, 1080)
|
||||
imageWidth := common.GenerateRandomNumberRange(1890, 1920)
|
||||
|
||||
reply := fmt.Sprintf("https://static-cdn.jtvnw.net/previews-ttv/live_user_%v-%vx%v.jpg", channel, imageWidth, imageHeight)
|
||||
common.Send(target, reply, tc)
|
||||
}
|
|
@ -8,7 +8,7 @@ import (
|
|||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func Bttv(username string) (string, error) {
|
||||
func Bttvemotes(username string) (string, error) {
|
||||
var basePath = "https://decapi.me/bttv/emotes/"
|
||||
|
||||
sugar := zap.NewExample().Sugar()
|
|
@ -8,7 +8,7 @@ import (
|
|||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func Ffz(username string) (string, error) {
|
||||
func Ffzemotes(username string) (string, error) {
|
||||
var basePath = "https://decapi.me/ffz/emotes/"
|
||||
|
||||
sugar := zap.NewExample().Sugar()
|
Loading…
Reference in a new issue