more robust commands sub package
This commit is contained in:
parent
ca17df83d1
commit
35f7816137
@ -6,7 +6,7 @@ import (
|
|||||||
|
|
||||||
// CommandMap maps command strings to their corresponding handler functions
|
// CommandMap maps command strings to their corresponding handler functions
|
||||||
var commandMap = map[string]func(*discordgo.Session, *discordgo.MessageCreate){
|
var commandMap = map[string]func(*discordgo.Session, *discordgo.MessageCreate){
|
||||||
"!hello2": helloCommand,
|
"!hello": hello,
|
||||||
"!test": testCommand,
|
"!test": test,
|
||||||
// Add more commands and their corresponding handler functions here
|
// Add more commands and their corresponding handler functions here
|
||||||
}
|
}
|
@ -3,7 +3,7 @@ package commands
|
|||||||
import "github.com/bwmarrin/discordgo"
|
import "github.com/bwmarrin/discordgo"
|
||||||
|
|
||||||
// HelloCommand handles the !hello command
|
// HelloCommand handles the !hello command
|
||||||
func helloCommand(s *discordgo.Session, m *discordgo.MessageCreate) {
|
func hello(s *discordgo.Session, m *discordgo.MessageCreate) {
|
||||||
// Respond to the !hello command
|
// Respond to the !hello command
|
||||||
_, _ = s.ChannelMessageSend(m.ChannelID, "Hello!")
|
_, _ = s.ChannelMessageSend(m.ChannelID, "Hello!")
|
||||||
}
|
}
|
@ -3,7 +3,7 @@ package commands
|
|||||||
import "github.com/bwmarrin/discordgo"
|
import "github.com/bwmarrin/discordgo"
|
||||||
|
|
||||||
// HelloCommand handles the !hello command
|
// HelloCommand handles the !hello command
|
||||||
func testCommand(s *discordgo.Session, m *discordgo.MessageCreate) {
|
func test(s *discordgo.Session, m *discordgo.MessageCreate) {
|
||||||
// Respond to the !hello command
|
// Respond to the !hello command
|
||||||
_, _ = s.ChannelMessageSend(m.ChannelID, "Hello! test")
|
_, _ = s.ChannelMessageSend(m.ChannelID, "Hello! test")
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user