added admin command for impersonating any irc command

remove db
This commit is contained in:
alex 2018-10-21 13:14:08 +01:00
parent 61b84d9fd9
commit 19716c3afb
2 changed files with 24 additions and 14 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
# personal reasons (。◕ ‿ ◕。)
*.db
*.tgz
# ---> Go
# Binaries for programs and plugins

View File

@ -38,14 +38,24 @@ func (w *WatBot) HandleIrcMsg(c *irc.Client, m *irc.Message) {
}
}
func (w *WatBot) Admin(m *irc.Message) bool {
return m.Prefix.Host == "tripsit/operator/hibs"
}
func (w *WatBot) Msg(m *irc.Message) {
if m.Params[0] == w.Nick && m.Prefix.Host == "tripsit/operator/hibs" {
if "join" == m.Params[1] {
w.write("JOIN", "##wat")
if !strings.Contains(m.Prefix.Host, "tripsit") || (m.Params[0] != "##wat" && m.Params[0] != "##test" && !w.Admin(m)) {
return
}
}
if strings.Contains(m.Prefix.Host, "tripsit") && m.Params[0] == "##wat" {
args := strings.FieldsFunc(m.Params[1], func(c rune) bool {return c == ' '})
if w.Admin(m) {
// Do a special admin command and return, or continue
if args[0] == "imp" {
w.write(args[1], args[2:]...)
}
}
if len(args) < 1 && args[0] != "wat" && args[0][0] != '#' {
return
}
@ -55,7 +65,6 @@ func (w *WatBot) Msg(m *irc.Message) {
user := strings.ToLower(m.Prefix.Name)
player := w.Db.User(user, m.Prefix.Host, true)
w.game.Msg(m, &player, args)
}
}
func (w *WatBot) Run() {