1
0
Fork 0
mirror of https://github.com/fluffle/goirc synced 2025-07-05 21:09:24 +00:00

Remove Commands from core goirc.

This dictates too much about how people might want to parse and act upon
information from PRIVMSGs, and thus should be an optional thing.
This commit is contained in:
Alex Bramley 2013-02-27 20:23:24 +00:00
parent 7bb84985ee
commit 4cd3831e92
5 changed files with 1 additions and 241 deletions

View file

@ -99,37 +99,3 @@ func (conn *Conn) h_NICK(line *Line) {
conn.cfg.Me.Nick = line.Args[0]
}
}
// Handle PRIVMSGs that trigger Commands
func (conn *Conn) h_PRIVMSG(line *Line) {
txt := line.Args[1]
if conn.cfg.CommandStripNick && strings.HasPrefix(txt, conn.cfg.Me.Nick) {
// Look for '^${nick}[:;>,-]? '
l := len(conn.cfg.Me.Nick)
switch txt[l] {
case ':', ';', '>', ',', '-':
l++
}
if txt[l] == ' ' {
txt = strings.TrimSpace(txt[l:])
}
}
cmd, l := conn.cmdMatch(txt)
if cmd == nil {
return
}
if conn.cfg.CommandStripPrefix {
txt = strings.TrimSpace(txt[l:])
}
if txt != line.Args[1] {
line = line.Copy()
line.Args[1] = txt
}
cmd.Execute(conn, line)
}
func (conn *Conn) c_HELP(line *Line) {
if cmd, _ := conn.cmdMatch(line.Args[1]); cmd != nil {
conn.Privmsg(line.Args[0], cmd.Help())
}
}