3
0
mirror of https://github.com/ergochat/ergo.git synced 2025-01-03 08:32:43 +01:00

move Commands initialization to an init()

This commit is contained in:
Shivaram Lingamneni 2018-01-22 13:50:58 -05:00
parent 62fc2c0cc3
commit 728863a17c

View File

@ -53,256 +53,260 @@ func (cmd *Command) Run(server *Server, client *Client, msg ircmsg.IrcMessage) b
} }
// Commands holds all commands executable by a client connected to us. // Commands holds all commands executable by a client connected to us.
var Commands = map[string]Command{ var Commands map[string]Command
"ACC": {
handler: accHandler, func init() {
minParams: 3, Commands = map[string]Command{
}, "ACC": {
"AMBIANCE": { handler: accHandler,
handler: sceneHandler, minParams: 3,
minParams: 2, },
}, "AMBIANCE": {
"AUTHENTICATE": { handler: sceneHandler,
handler: authenticateHandler, minParams: 2,
usablePreReg: true, },
minParams: 1, "AUTHENTICATE": {
}, handler: authenticateHandler,
"AWAY": { usablePreReg: true,
handler: awayHandler, minParams: 1,
minParams: 0, },
}, "AWAY": {
"CAP": { handler: awayHandler,
handler: capHandler, minParams: 0,
usablePreReg: true, },
minParams: 1, "CAP": {
}, handler: capHandler,
"CHANSERV": { usablePreReg: true,
handler: csHandler, minParams: 1,
minParams: 1, },
}, "CHANSERV": {
"CS": { handler: csHandler,
handler: csHandler, minParams: 1,
minParams: 1, },
}, "CS": {
"DEBUG": { handler: csHandler,
handler: debugHandler, minParams: 1,
minParams: 1, },
}, "DEBUG": {
"DLINE": { handler: debugHandler,
handler: dlineHandler, minParams: 1,
minParams: 1, },
oper: true, "DLINE": {
}, handler: dlineHandler,
"HELP": { minParams: 1,
handler: helpHandler, oper: true,
minParams: 0, },
}, "HELP": {
"HELPOP": { handler: helpHandler,
handler: helpHandler, minParams: 0,
minParams: 0, },
}, "HELPOP": {
"INFO": { handler: helpHandler,
handler: infoHandler, minParams: 0,
}, },
"INVITE": { "INFO": {
handler: inviteHandler, handler: infoHandler,
minParams: 2, },
}, "INVITE": {
"ISON": { handler: inviteHandler,
handler: isonHandler, minParams: 2,
minParams: 1, },
}, "ISON": {
"JOIN": { handler: isonHandler,
handler: joinHandler, minParams: 1,
minParams: 1, },
}, "JOIN": {
"KICK": { handler: joinHandler,
handler: kickHandler, minParams: 1,
minParams: 2, },
}, "KICK": {
"KILL": { handler: kickHandler,
handler: killHandler, minParams: 2,
minParams: 1, },
oper: true, "KILL": {
capabs: []string{"oper:local_kill"}, //TODO(dan): when we have S2S, this will be checked in the command handler itself handler: killHandler,
}, minParams: 1,
"KLINE": { oper: true,
handler: klineHandler, capabs: []string{"oper:local_kill"}, //TODO(dan): when we have S2S, this will be checked in the command handler itself
minParams: 1, },
oper: true, "KLINE": {
}, handler: klineHandler,
"LANGUAGE": { minParams: 1,
handler: languageHandler, oper: true,
usablePreReg: true, },
minParams: 1, "LANGUAGE": {
}, handler: languageHandler,
"LIST": { usablePreReg: true,
handler: listHandler, minParams: 1,
minParams: 0, },
}, "LIST": {
"LUSERS": { handler: listHandler,
handler: lusersHandler, minParams: 0,
minParams: 0, },
}, "LUSERS": {
"MODE": { handler: lusersHandler,
handler: modeHandler, minParams: 0,
minParams: 1, },
}, "MODE": {
"MONITOR": { handler: modeHandler,
handler: monitorHandler, minParams: 1,
minParams: 1, },
}, "MONITOR": {
"MOTD": { handler: monitorHandler,
handler: motdHandler, minParams: 1,
minParams: 0, },
}, "MOTD": {
"NAMES": { handler: motdHandler,
handler: namesHandler, minParams: 0,
minParams: 0, },
}, "NAMES": {
"NICK": { handler: namesHandler,
handler: nickHandler, minParams: 0,
usablePreReg: true, },
minParams: 1, "NICK": {
}, handler: nickHandler,
"NICKSERV": { usablePreReg: true,
handler: nsHandler, minParams: 1,
minParams: 1, },
}, "NICKSERV": {
"NOTICE": { handler: nsHandler,
handler: noticeHandler, minParams: 1,
minParams: 2, },
}, "NOTICE": {
"NPC": { handler: noticeHandler,
handler: npcHandler, minParams: 2,
minParams: 3, },
}, "NPC": {
"NPCA": { handler: npcHandler,
handler: npcaHandler, minParams: 3,
minParams: 3, },
}, "NPCA": {
"NS": { handler: npcaHandler,
handler: nsHandler, minParams: 3,
minParams: 1, },
}, "NS": {
"OPER": { handler: nsHandler,
handler: operHandler, minParams: 1,
minParams: 2, },
}, "OPER": {
"PART": { handler: operHandler,
handler: partHandler, minParams: 2,
minParams: 1, },
}, "PART": {
"PASS": { handler: partHandler,
handler: passHandler, minParams: 1,
usablePreReg: true, },
minParams: 1, "PASS": {
}, handler: passHandler,
"PING": { usablePreReg: true,
handler: pingHandler, minParams: 1,
usablePreReg: true, },
minParams: 1, "PING": {
leaveClientActive: true, handler: pingHandler,
}, usablePreReg: true,
"PONG": { minParams: 1,
handler: pongHandler, leaveClientActive: true,
usablePreReg: true, },
minParams: 1, "PONG": {
leaveClientActive: true, handler: pongHandler,
}, usablePreReg: true,
"PRIVMSG": { minParams: 1,
handler: privmsgHandler, leaveClientActive: true,
minParams: 2, },
}, "PRIVMSG": {
"PROXY": { handler: privmsgHandler,
handler: proxyHandler, minParams: 2,
usablePreReg: true, },
minParams: 5, "PROXY": {
}, handler: proxyHandler,
"RENAME": { usablePreReg: true,
handler: renameHandler, minParams: 5,
minParams: 2, },
}, "RENAME": {
"RESUME": { handler: renameHandler,
handler: resumeHandler, minParams: 2,
usablePreReg: true, },
minParams: 1, "RESUME": {
}, handler: resumeHandler,
"SANICK": { usablePreReg: true,
handler: sanickHandler, minParams: 1,
minParams: 2, },
oper: true, "SANICK": {
}, handler: sanickHandler,
"SAMODE": { minParams: 2,
handler: modeHandler, oper: true,
minParams: 1, },
capabs: []string{"samode"}, "SAMODE": {
}, handler: modeHandler,
"SCENE": { minParams: 1,
handler: sceneHandler, capabs: []string{"samode"},
minParams: 2, },
}, "SCENE": {
"TAGMSG": { handler: sceneHandler,
handler: tagmsgHandler, minParams: 2,
minParams: 1, },
}, "TAGMSG": {
"QUIT": { handler: tagmsgHandler,
handler: quitHandler, minParams: 1,
usablePreReg: true, },
minParams: 0, "QUIT": {
}, handler: quitHandler,
"REHASH": { usablePreReg: true,
handler: rehashHandler, minParams: 0,
minParams: 0, },
oper: true, "REHASH": {
capabs: []string{"oper:rehash"}, handler: rehashHandler,
}, minParams: 0,
"TIME": { oper: true,
handler: timeHandler, capabs: []string{"oper:rehash"},
minParams: 0, },
}, "TIME": {
"TOPIC": { handler: timeHandler,
handler: topicHandler, minParams: 0,
minParams: 1, },
}, "TOPIC": {
"UNDLINE": { handler: topicHandler,
handler: unDLineHandler, minParams: 1,
minParams: 1, },
oper: true, "UNDLINE": {
}, handler: unDLineHandler,
"UNKLINE": { minParams: 1,
handler: unKLineHandler, oper: true,
minParams: 1, },
oper: true, "UNKLINE": {
}, handler: unKLineHandler,
"USER": { minParams: 1,
handler: userHandler, oper: true,
usablePreReg: true, },
minParams: 4, "USER": {
}, handler: userHandler,
"USERHOST": { usablePreReg: true,
handler: userhostHandler, minParams: 4,
minParams: 1, },
}, "USERHOST": {
"VERSION": { handler: userhostHandler,
handler: versionHandler, minParams: 1,
minParams: 0, },
}, "VERSION": {
"WEBIRC": { handler: versionHandler,
handler: webircHandler, minParams: 0,
usablePreReg: true, },
minParams: 4, "WEBIRC": {
}, handler: webircHandler,
"WHO": { usablePreReg: true,
handler: whoHandler, minParams: 4,
minParams: 1, },
}, "WHO": {
"WHOIS": { handler: whoHandler,
handler: whoisHandler, minParams: 1,
minParams: 1, },
}, "WHOIS": {
"WHOWAS": { handler: whoisHandler,
handler: whowasHandler, minParams: 1,
minParams: 1, },
}, "WHOWAS": {
handler: whowasHandler,
minParams: 1,
},
}
} }