Initial commit (fr tho)
This commit is contained in:
parent
507b5dbfba
commit
280c2e6b1c
4 changed files with 99 additions and 0 deletions
25
callbacks.go
Normal file
25
callbacks.go
Normal file
|
@ -0,0 +1,25 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/bwmarrin/discordgo"
|
||||
)
|
||||
|
||||
// This function will be called (due to AddHandler above) every time a new
|
||||
// message is created on any channel that the authenticated bot has access to.
|
||||
func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
|
||||
|
||||
// Ignore all messages created by the bot itself
|
||||
// This isn't required in this specific example but it's a good practice.
|
||||
if m.Author.ID == s.State.User.ID {
|
||||
return
|
||||
}
|
||||
// If the message is "ping" reply with "Pong!"
|
||||
if m.Content == "ping" {
|
||||
s.ChannelMessageSend(m.ChannelID, "Pong!")
|
||||
}
|
||||
|
||||
// If the message is "pong" reply with "Ping!"
|
||||
if m.Content == "pong" {
|
||||
s.ChannelMessageSend(m.ChannelID, "Ping!")
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue