From 35f7816137407c6d848c5ba13e786c1b9a164118 Mon Sep 17 00:00:00 2001 From: Chris kerr Date: Sat, 27 Apr 2024 22:56:42 -0400 Subject: [PATCH] more robust commands sub package --- commands/{handler.go => com_handler.go} | 0 commands/{cases.go => com_map.go} | 4 ++-- commands/{hello_command.go => hello.go} | 2 +- commands/{test_command.go => test.go} | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename commands/{handler.go => com_handler.go} (100%) rename commands/{cases.go => com_map.go} (85%) rename commands/{hello_command.go => hello.go} (72%) rename commands/{test_command.go => test.go} (73%) diff --git a/commands/handler.go b/commands/com_handler.go similarity index 100% rename from commands/handler.go rename to commands/com_handler.go diff --git a/commands/cases.go b/commands/com_map.go similarity index 85% rename from commands/cases.go rename to commands/com_map.go index acf36bb..3829f1f 100644 --- a/commands/cases.go +++ b/commands/com_map.go @@ -6,7 +6,7 @@ import ( // CommandMap maps command strings to their corresponding handler functions var commandMap = map[string]func(*discordgo.Session, *discordgo.MessageCreate){ - "!hello2": helloCommand, - "!test": testCommand, + "!hello": hello, + "!test": test, // Add more commands and their corresponding handler functions here } diff --git a/commands/hello_command.go b/commands/hello.go similarity index 72% rename from commands/hello_command.go rename to commands/hello.go index c25cb3d..f5653a0 100644 --- a/commands/hello_command.go +++ b/commands/hello.go @@ -3,7 +3,7 @@ package commands import "github.com/bwmarrin/discordgo" // 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 _, _ = s.ChannelMessageSend(m.ChannelID, "Hello!") } diff --git a/commands/test_command.go b/commands/test.go similarity index 73% rename from commands/test_command.go rename to commands/test.go index 88898c0..2d489c6 100644 --- a/commands/test_command.go +++ b/commands/test.go @@ -3,7 +3,7 @@ package commands import "github.com/bwmarrin/discordgo" // 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 _, _ = s.ChannelMessageSend(m.ChannelID, "Hello! test") }