comcord/commands/main.go

92 lines
1.6 KiB
Go
Raw Normal View History

2023-07-08 20:51:26 +00:00
package commands
var commandMap map[string]Command
type Command struct {
Run func()
2023-07-08 20:51:26 +00:00
Description string
}
func Setup() {
commandMap = make(map[string]Command)
commandMap["q"] = Command{
Run: QuitCommand,
Description: "quit comcord",
}
commandMap["h"] = Command{
Run: HelpCommand,
Description: "command help",
}
2023-07-09 20:00:49 +00:00
commandMap["c"] = Command{
Run: ClearCommand,
Description: "clear",
}
2023-07-11 03:46:47 +00:00
commandMap["e"] = Command{
Run: EmoteCommand,
Description: "emote",
}
2023-07-11 04:35:15 +00:00
commandMap["L"] = Command{
Run: ListGuildsCommand,
Description: "list guilds",
}
commandMap["l"] = Command{
Run: ListChannelsCommand,
Description: "list channels",
}
commandMap["G"] = Command{
Run: SwitchGuildsCommand,
Description: "goto guild",
}
commandMap["g"] = Command{
Run: SwitchChannelsCommand,
Description: "goto channel",
}
commandMap["w"] = Command{
Run: ListUsersCommand,
Description: "who is in channel",
}
2023-07-16 20:58:14 +00:00
commandMap["r"] = Command{
Run: HistoryCommand,
Description: "channel history",
}
commandMap["R"] = Command{
Run: ExtendedHistoryCommand,
Description: "extended history",
}
commandMap["p"] = Command{
Run: PeekCommand,
Description: "peek at channel",
}
commandMap["P"] = Command{
Run: CrossPeekCommand,
Description: "cross-guild peek",
}
2023-07-26 22:51:25 +00:00
commandMap["+"] = Command{
Run: TimeCommand,
Description: "current time",
}
2023-07-08 20:51:26 +00:00
}
func GetCommand(key string) (Command, bool) {
command, has := commandMap[key]
return command, has
}
func GetAllCommands() map[string]Command {
return commandMap
}