mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
add commands
This commit is contained in:
parent
d5d0f7ba46
commit
11f084978d
|
@ -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")
|
||||
|
||||
|
|
13
internal/commands/duckduckgo.go
Normal file
13
internal/commands/duckduckgo.go
Normal 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
9
internal/commands/ffz.go
Normal 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
|
||||
}
|
13
internal/commands/godocs.go
Normal file
13
internal/commands/godocs.go
Normal 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
|
||||
}
|
13
internal/commands/google.go
Normal file
13
internal/commands/google.go
Normal 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
13
internal/commands/osrs.go
Normal 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
|
||||
}
|
14
internal/commands/preview.go
Normal file
14
internal/commands/preview.go
Normal 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
|
||||
}
|
9
internal/commands/seventv.go
Normal file
9
internal/commands/seventv.go
Normal 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
|
||||
}
|
13
internal/commands/youtube.go
Normal file
13
internal/commands/youtube.go
Normal 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
|
||||
}
|
Loading…
Reference in a new issue