more robust commands sub package

This commit is contained in:
Chris kerr 2024-04-27 22:56:42 -04:00
parent ca17df83d1
commit 35f7816137
4 changed files with 4 additions and 4 deletions

View File

@ -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
} }

View File

@ -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!")
} }

View File

@ -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")
} }