grim/wasdead

Rename some files
draft
2019-04-08, Gary Kramlich
f8a2c08e2a39
Parents 14a3ef1fae60
Children a883b88e2e8a
Rename some files
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/discord/command_set_channel.go Mon Apr 08 22:53:09 2019 -0500
@@ -0,0 +1,19 @@
+package discord
+
+import (
+ "fmt"
+
+ "github.com/bwmarrin/discordgo"
+)
+
+type commandSetChannel struct{}
+
+func (cmd *commandSetChannel) Help() string {
+ return "sets the channel to send automatic announcements to"
+}
+
+func (cmd *commandSetChannel) Run(args []string, c *DiscordClient, m *discordgo.MessageCreate) (interface{}, error) {
+ c.db.SetChannel(m.GuildID, m.ChannelID)
+
+ return fmt.Sprintf("Set <#%s> as the announcement channel", m.ChannelID), nil
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/discord/command_status.go Mon Apr 08 22:53:09 2019 -0500
@@ -0,0 +1,51 @@
+package discord
+
+import (
+ "fmt"
+ "strings"
+
+ "github.com/bwmarrin/discordgo"
+
+ "bitbucket.org/TheToyz/nowdead/presence"
+)
+
+type commandStatus struct{}
+
+func (cmd *commandStatus) Help() string {
+ return "get the streaming status of a target"
+}
+
+func (cmd *commandStatus) Run(args []string, c *DiscordClient, m *discordgo.MessageCreate) (interface{}, error) {
+ uri := ""
+
+ if len(args) != 1 {
+ return nil, fmt.Errorf("invalid target")
+ }
+
+ target := args[0]
+
+ if strings.HasPrefix(target, "<@") {
+ mentionID := target[2 : len(target)-1]
+
+ for _, mentioned := range m.Mentions {
+ if mentioned.ID == mentionID {
+ p := c.getPresence(m.GuildID, mentioned.ID)
+
+ if p != nil && p.Game != nil && p.Game.Type == discordgo.GameTypeStreaming {
+ uri = p.Game.URL
+ } else {
+ return nil, fmt.Errorf("%s is not streaming", target)
+ }
+ }
+ }
+ } else {
+ uri = "https://twitch.tv/" + target
+ }
+
+ presence, err := presence.GetPresence(uri)
+ if err != nil {
+ return nil, err
+ }
+
+ return presenceEmbed(presence), nil
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/discord/command_uptime.go Mon Apr 08 22:53:09 2019 -0500
@@ -0,0 +1,18 @@
+package discord
+
+import (
+ "fmt"
+
+ "github.com/bwmarrin/discordgo"
+ "github.com/dustin/go-humanize"
+)
+
+type commandUptime struct{}
+
+func (cmd *commandUptime) Help() string {
+ return "the amount of time the bot has been running"
+}
+
+func (cmd *commandUptime) Run(args []string, c *DiscordClient, m *discordgo.MessageCreate) (interface{}, error) {
+ return fmt.Sprintf("Started %s", humanize.Time(c.started)), nil
+}
--- a/discord/set_channel_command.go Mon Apr 08 22:52:18 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-package discord
-
-import (
- "fmt"
-
- "github.com/bwmarrin/discordgo"
-)
-
-type commandSetChannel struct{}
-
-func (cmd *commandSetChannel) Help() string {
- return "sets the channel to send automatic announcements to"
-}
-
-func (cmd *commandSetChannel) Run(args []string, c *DiscordClient, m *discordgo.MessageCreate) (interface{}, error) {
- c.db.SetChannel(m.GuildID, m.ChannelID)
-
- return fmt.Sprintf("Set <#%s> as the announcement channel", m.ChannelID), nil
-}
--- a/discord/status_command.go Mon Apr 08 22:52:18 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-package discord
-
-import (
- "fmt"
- "strings"
-
- "github.com/bwmarrin/discordgo"
-
- "bitbucket.org/TheToyz/nowdead/presence"
-)
-
-type commandStatus struct{}
-
-func (cmd *commandStatus) Help() string {
- return "get the streaming status of a target"
-}
-
-func (cmd *commandStatus) Run(args []string, c *DiscordClient, m *discordgo.MessageCreate) (interface{}, error) {
- uri := ""
-
- if len(args) != 1 {
- return nil, fmt.Errorf("invalid target")
- }
-
- target := args[0]
-
- if strings.HasPrefix(target, "<@") {
- mentionID := target[2 : len(target)-1]
-
- for _, mentioned := range m.Mentions {
- if mentioned.ID == mentionID {
- p := c.getPresence(m.GuildID, mentioned.ID)
-
- if p != nil && p.Game != nil && p.Game.Type == discordgo.GameTypeStreaming {
- uri = p.Game.URL
- } else {
- return nil, fmt.Errorf("%s is not streaming", target)
- }
- }
- }
- } else {
- uri = "https://twitch.tv/" + target
- }
-
- presence, err := presence.GetPresence(uri)
- if err != nil {
- return nil, err
- }
-
- return presenceEmbed(presence), nil
-}
--- a/discord/uptime_command.go Mon Apr 08 22:52:18 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-package discord
-
-import (
- "fmt"
-
- "github.com/bwmarrin/discordgo"
- "github.com/dustin/go-humanize"
-)
-
-type commandUptime struct{}
-
-func (cmd *commandUptime) Help() string {
- return "the amount of time the bot has been running"
-}
-
-func (cmd *commandUptime) Run(args []string, c *DiscordClient, m *discordgo.MessageCreate) (interface{}, error) {
- return fmt.Sprintf("Started %s", humanize.Time(c.started)), nil
-}