Browse Source

Let room operators clean up themselves

Add a '#ROOM clean' command at room operator level.

Change-Id: I81c08c9430df14615f2e4ec490f6b850335337be
changes/20/495320/1
Thierry Carrez 2 years ago
parent
commit
6a223d31fe
2 changed files with 11 additions and 2 deletions
  1. +5
    -0
      README.rst
  2. +6
    -2
      ptgbot/bot.py

+ 5
- 0
README.rst View File

@@ -41,6 +41,11 @@ Example::
#swift now discussing #glance support, come over!
#swift next at 3pm we plan to cover cold storage features

You can also remove all entries related to your room by issuing the following
command::

#ROOMNAME clean


Admin commands
==============


+ 6
- 2
ptgbot/bot.py View File

@@ -89,7 +89,8 @@ class PTGBot(irc.bot.SingleServerIRCBot):
self.identify_msg_cap = True

def usage(self, channel):
self.send(channel, "Format is '@ROOM [now|next] SESSION'")
self.send(channel,
"Format is '#ROOMNAME [ now ... | next ... | clean ]'")

def send_room_list(self, channel):
rooms = self.data.list_rooms()
@@ -114,7 +115,8 @@ class PTGBot(irc.bot.SingleServerIRCBot):
return

words = msg.split()
if len(words) < 3:
if ((len(words) < 2) or
(len(words) == 2 and words[1].lower() != 'clean')):
self.send(chan, "%s: Incorrect number of arguments" % (nick,))
self.usage(chan)
return
@@ -131,6 +133,8 @@ class PTGBot(irc.bot.SingleServerIRCBot):
self.data.add_now(room, session)
elif adverb == 'next':
self.data.add_next(room, session)
elif adverb == 'clean':
self.data.clean_rooms([room])
else:
self.send(chan, "%s: unknown directive '%s'" % (nick, adverb))
self.usage(chan)


Loading…
Cancel
Save