File bot/bot.go changed (mode: 100644) (index 15e0118..57ebd73) |
... |
... |
import ( |
14 |
14 |
log "github.com/sirupsen/logrus" |
log "github.com/sirupsen/logrus" |
15 |
15 |
) |
) |
16 |
16 |
|
|
17 |
|
const ( |
|
18 |
|
//Help string lists all discord chat commands for this bot |
|
19 |
|
discordHelp string = "***LIST OF BOT COMMANDS***\n" + |
|
20 |
|
"Fields in [] are optional\n" + |
|
21 |
|
"Fields in <> are mandatory\n\n" + |
|
22 |
|
"```" + |
|
23 |
|
"!help [bot] (Lists all bot commands)\n" + |
|
24 |
|
"!uptime [bot](Prints current bot uptime)\n" + |
|
25 |
|
"!sub <id> (Subscribe to anime and get notified when a new episode is released)\n" + |
|
26 |
|
"!unsub <id> (Unsubscribe from anime)\n" + |
|
27 |
|
"!mysubs (List all the anime you are subscribed to)\n" + |
|
28 |
|
"!w <location> (Prints current weather)\n" + |
|
29 |
|
"!info [bot] (Prints bot information)" + |
|
30 |
|
"```\n" + |
|
31 |
|
"Full anime list at http://axolotl-422.rhcloud.com/ \n" + |
|
32 |
|
"For issues and suggestions go to https://github.com/gagizagi/Axolotl-GO" |
|
33 |
|
|
|
34 |
|
helpList string = "to be done" |
|
35 |
|
) |
|
36 |
|
|
|
37 |
17 |
var ( |
var ( |
38 |
18 |
BotID string |
BotID string |
39 |
19 |
cmdCount uint64 |
cmdCount uint64 |
|
... |
... |
func messageHandler(s *discordgo.Session, m *discordgo.MessageCreate) { |
84 |
64 |
|
|
85 |
65 |
// Message Handling |
// Message Handling |
86 |
66 |
// Change slice if Prefix > 1 |
// Change slice if Prefix > 1 |
87 |
|
if m.Content[:len(config.BotPrefix)] == config.BotPrefix { |
|
|
67 |
|
Prefix := config.BotPrefix |
|
68 |
|
if m.Content[:len(Prefix)] == Prefix { |
88 |
69 |
//channel, _ := s.Channel(m.ChannelID) |
//channel, _ := s.Channel(m.ChannelID) |
89 |
70 |
//serverID := channel.GuildID |
//serverID := channel.GuildID |
90 |
71 |
cmdCount++ |
cmdCount++ |
91 |
|
method := strings.Split(m.Content, " ")[0][len(config.BotPrefix):] |
|
|
72 |
|
method := strings.Split(m.Content, " ")[0][len(Prefix):] |
92 |
73 |
|
|
93 |
74 |
if method == "help" { |
if method == "help" { |
94 |
|
s.ChannelMessageSend(m.ChannelID, helpList) |
|
|
75 |
|
s.ChannelMessageSend(m.ChannelID, fmt.Sprintf("**mummybot commands**\n```%sloveumate (try it)\n%squote (random quote)\n%sstatus (bot status)```", Prefix, Prefix, Prefix)) |
95 |
76 |
} |
} |
96 |
77 |
|
|
97 |
78 |
if method == "loveumate" { |
if method == "loveumate" { |