Browse Source

Only +v or +o users can issue bot commands

Limit access to the bot to voiced or oped users in the target
channel. This lets us use ChanServ to autovoice users but also
give temprary access to anyone on-channel as necessary.
changes/56/473756/1
Thierry Carrez 4 years ago
parent
commit
c0cb4a0bdd
  1. 6
      ptgbot/bot.py

6
ptgbot/bot.py

@ -100,7 +100,11 @@ class PTGBot(irc.bot.SingleServerIRCBot):
msg = e.arguments[0][1:]
chan = e.target
if msg.startswith('#') and auth:
if msg.startswith('#'):
if not (self.channels[chan].is_voiced(nick) or
self.channels[chan].is_oper(nick)):
self.send(chan, "%s: Need voice to issue commands" % (nick,))
return
words = msg.split()
if len(words) < 3:
self.send(chan, "%s: Incorrect number of arguments" % (nick,))

Loading…
Cancel
Save