new message
This commit is contained in:
parent
22d05c4807
commit
50513cf3cd
19
main.go
19
main.go
@ -60,6 +60,8 @@ func main() {
|
||||
// Register messageCreate as a callback for the messageCreate events
|
||||
dg.AddHandler(messageCreate)
|
||||
|
||||
dg.AddHandler(message2Create)
|
||||
|
||||
// Open a websocket connection to Discord and begin listening
|
||||
err = dg.Open()
|
||||
if err != nil {
|
||||
@ -173,8 +175,6 @@ func sendNotifications(session *discordgo.Session, channelID string, html string
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// This function will be called whenever a new message is created
|
||||
func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
|
||||
// Ignore messages created by the bot itself
|
||||
@ -183,7 +183,20 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
|
||||
}
|
||||
|
||||
// If the message content is "!hello", respond with "Hello!"
|
||||
if m.Content == "!hello" {
|
||||
if m.Content == "!hello1" {
|
||||
_, _ = s.ChannelMessageSend(m.ChannelID, "Hello!")
|
||||
}
|
||||
}
|
||||
|
||||
// This function will be called whenever a new message is created
|
||||
func message2Create(s *discordgo.Session, m *discordgo.MessageCreate) {
|
||||
// Ignore messages created by the bot itself
|
||||
if m.Author.ID == s.State.User.ID {
|
||||
return
|
||||
}
|
||||
|
||||
// If the message content is "!hello", respond with "Hello!"
|
||||
if m.Content == "!hello" {
|
||||
_, _ = s.ChannelMessageSend(m.ChannelID, "You are SUCH a NERD")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user