MovieNight/common/chatcommands.go
Zorchenhimer fb2c25dc99 Add the /addemotes command
This command launches a goroutine that does the actual downloading of
the emotes so the client doesn't hang until the process is finished.

subscribers.json needs to be manually downloaded and added next to the
main executable for now.  Eventually, it will download and cache this
file (for 24 hours, at a minimum).

Issue #10 should not be considered finished yet.  This needs to be
tested a bit more with multiple channels.  Ideally, some that exist and
some that don't to verify that it fails gracefully (ie, adds the emotes
it was able to download).
2019-03-28 16:50:24 -04:00

80 lines
1.8 KiB
Go

package common
import "strings"
const CommandNameSeparator = ","
type ChatCommandNames []string
func (c ChatCommandNames) String() string {
return strings.Join(c, CommandNameSeparator)
}
// Names for commands
var (
// User Commands
CNMe ChatCommandNames = []string{"me"}
CNHelp ChatCommandNames = []string{"help"}
CNCount ChatCommandNames = []string{"count"}
CNColor ChatCommandNames = []string{"color", "colour"}
CNWhoAmI ChatCommandNames = []string{"w", "whoami"}
CNAuth ChatCommandNames = []string{"auth"}
CNUsers ChatCommandNames = []string{"users"}
CNNick ChatCommandNames = []string{"nick", "name"}
// Mod Commands
CNSv ChatCommandNames = []string{"sv"}
CNPlaying ChatCommandNames = []string{"playing"}
CNUnmod ChatCommandNames = []string{"unmod"}
CNKick ChatCommandNames = []string{"kick"}
CNBan ChatCommandNames = []string{"ban"}
CNUnban ChatCommandNames = []string{"unban"}
CNPurge ChatCommandNames = []string{"purge"}
// Admin Commands
CNMod ChatCommandNames = []string{"mod"}
CNReloadPlayer ChatCommandNames = []string{"reloadplayer"}
CNReloadEmotes ChatCommandNames = []string{"reloademotes"}
CNModpass ChatCommandNames = []string{"modpass"}
CNIP ChatCommandNames = []string{"iplist"}
CNAddEmotes ChatCommandNames = []string{"addemotes"}
)
var ChatCommands = []ChatCommandNames{
// User
CNMe,
CNHelp,
CNCount,
CNColor,
CNWhoAmI,
CNAuth,
CNUsers,
CNNick,
// Mod
CNSv,
CNPlaying,
CNUnmod,
CNKick,
CNBan,
CNUnban,
CNPurge,
// Admin
CNMod,
CNReloadPlayer,
CNReloadEmotes,
CNModpass,
CNIP,
CNAddEmotes,
}
func GetFullChatCommand(c string) string {
for _, names := range ChatCommands {
for _, n := range names {
if c == n {
return names.String()
}
}
}
return ""
}