grim/wasdead

Add a command to check twitch directly
draft
2019-06-08, Gary Kramlich
2d812e007daa
Parents a864eaa9eb45
Children 947250a2da50
Add a command to check twitch directly
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/discord/cmdtwitch.go Sat Jun 08 04:06:34 2019 -0500
@@ -0,0 +1,20 @@
+package discord
+
+import (
+ "bitbucket.org/rw_grim/wasdead/presence"
+)
+
+type TwitchCmd struct {
+ Target string `kong:"arg"`
+}
+
+func (c *TwitchCmd) Run(g *Globals) error {
+ uri := "https://twitch.tv/" + c.Target
+
+ presence, err := presence.GetPresence(uri)
+ if err != nil {
+ return err
+ }
+
+ return g.client.sendEmbedChannel(g.msg.ChannelID, presenceEmbed(presence))
+}
--- a/discord/commands.go Sat Jun 08 03:46:31 2019 -0500
+++ b/discord/commands.go Sat Jun 08 04:06:34 2019 -0500
@@ -22,6 +22,7 @@
SetChannel SetChannelCmd `kong:"cmd,help='set the current channel as the channel to announce new streams'"`
ShowConfig ShowConfigCmd `kong:"cmd,help='show the configuration for the current guild.'"`
Status StatusCmd `kong:"cmd,help='get the streaming status of someone'"`
+ Twitch TwitchCmd `kong:"cmd,help='check if someone is streaming on twitch'"`
Uptime UptimeCmd `kong:"cmd,help='display how long the bot has been running for'"`
}