initialize git
This commit is contained in:
commit
d17d31b293
6 changed files with 253 additions and 0 deletions
40
commands/commands.go
Normal file
40
commands/commands.go
Normal file
|
@ -0,0 +1,40 @@
|
|||
package commands
|
||||
|
||||
import "github.com/bwmarrin/discordgo"
|
||||
|
||||
type Command struct {
|
||||
Name string
|
||||
Handler func(s *discordgo.Session, m *discordgo.MessageCreate)
|
||||
Aliases []string
|
||||
}
|
||||
|
||||
var Commands = []Command{
|
||||
{
|
||||
Name: "ping",
|
||||
Handler: PingPong("ping"),
|
||||
},
|
||||
{
|
||||
Name: "pong",
|
||||
Handler: PingPong("pong"),
|
||||
},
|
||||
{
|
||||
Name: "start",
|
||||
Handler: MainGame,
|
||||
},
|
||||
}
|
||||
|
||||
func MainGame(s *discordgo.Session, m *discordgo.MessageCreate) {
|
||||
|
||||
}
|
||||
|
||||
func PingPong(which string) func(s *discordgo.Session, m *discordgo.MessageCreate) {
|
||||
if which == "ping" {
|
||||
return func(s *discordgo.Session, m *discordgo.MessageCreate) {
|
||||
_, _ = s.ChannelMessageSend(m.ChannelID, "pong")
|
||||
}
|
||||
} else {
|
||||
return func(s *discordgo.Session, m *discordgo.MessageCreate) {
|
||||
_, _ = s.ChannelMessageSend(m.ChannelID, "ping")
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue