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.
This commit is contained in:
Thierry Carrez 2017-05-29 15:19:15 +02:00
parent 8f2f63bdfe
commit c0cb4a0bdd
1 changed files with 5 additions and 1 deletions

View File

@ -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,))