add commands

This commit is contained in:
lyx0 2023-10-10 14:28:43 +02:00
parent d5d0f7ba46
commit 11f084978d
9 changed files with 130 additions and 0 deletions

View file

@ -97,6 +97,39 @@ func (app *application) handleCommand(message twitch.PrivateMessage) {
case "gofile":
go app.NewDownload("gofile", target, cmdParams[1], message)
case "osrs":
reply = commands.OSRS(message.Message[7:len(message.Message)])
case "preview":
reply = commands.Preview(cmdParams[1])
case "thumbnail":
reply = commands.Preview(cmdParams[1])
case "ffz":
reply = commands.Ffz(cmdParams[1])
case "ddg":
reply = commands.DuckDuckGo(message.Message[6:len(message.Message)])
case "youtube":
reply = commands.Youtube(message.Message[10:len(message.Message)])
case "godocs":
reply = commands.Godocs(message.Message[9:len(message.Message)])
case "google":
reply = commands.Google(message.Message[9:len(message.Message)])
case "duckduckgo":
reply = commands.DuckDuckGo(message.Message[13:len(message.Message)])
case "seventv":
reply = commands.SevenTV(cmdParams[1])
case "7tv":
reply = commands.SevenTV(cmdParams[1])
case "mail":
app.SendEmail("Test command used!", "This is an email test")

View file

@ -0,0 +1,13 @@
package commands
import (
"fmt"
"net/url"
)
func DuckDuckGo(query string) string {
query = url.QueryEscape(query)
reply := fmt.Sprintf("https://duckduckgo.com/?va=n&hps=1&q=%s", query)
return reply
}

9
internal/commands/ffz.go Normal file
View file

@ -0,0 +1,9 @@
package commands
import "fmt"
func Ffz(query string) string {
reply := fmt.Sprintf("https://www.frankerfacez.com/emoticons/?q=%s&sort=count-desc&days=0", query)
return reply
}

View file

@ -0,0 +1,13 @@
package commands
import (
"fmt"
"net/url"
)
func Godocs(query string) string {
query = url.QueryEscape(query)
reply := fmt.Sprintf("https://godocs.io/?q=%s", query)
return reply
}

View file

@ -0,0 +1,13 @@
package commands
import (
"fmt"
"net/url"
)
func Google(query string) string {
query = url.QueryEscape(query)
reply := fmt.Sprintf("https://www.google.com/search?q=%s", query)
return reply
}

13
internal/commands/osrs.go Normal file
View file

@ -0,0 +1,13 @@
package commands
import (
"fmt"
"net/url"
)
func OSRS(query string) string {
query = url.QueryEscape(query)
reply := fmt.Sprintf("https://oldschool.runescape.wiki/?search=%s", query)
return reply
}

View file

@ -0,0 +1,14 @@
package commands
import (
"fmt"
"github.com/lyx0/nourybot/internal/common"
)
func Preview(channel string) string {
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)
return reply
}

View file

@ -0,0 +1,9 @@
package commands
import "fmt"
func SevenTV(query string) string {
reply := fmt.Sprintf("https://7tv.app/emotes?page=1&query=%s", query)
return reply
}

View file

@ -0,0 +1,13 @@
package commands
import (
"fmt"
"net/url"
)
func Youtube(query string) string {
query = url.QueryEscape(query)
reply := fmt.Sprintf("https://www.youtube.com/results?search_query=%s", query)
return reply
}