Allow members with same role as bot to ASAP announcements.
authorCMDR furrycat <elite@furrycat.net>
Mon, 6 Mar 2017 15:05:08 +0000 (15:05 +0000)
committerCMDR furrycat <elite@furrycat.net>
Mon, 6 Mar 2017 15:05:08 +0000 (15:05 +0000)
plugin/announcements/announcements.py

index baffd89..95c1018 100644 (file)
@@ -149,7 +149,7 @@ class Announcements(DBConnection):
               log.debug('Member {} on server {} can show announcement {}.'.format(member.name, server.name, announcement.id))
               return announcement
 
-    if command in ['edit', 'delete', 'schedule']:
+    if command in ['asap', 'edit', 'delete', 'schedule']:
       if announcement is not None:
         if announcement.member_id == author.id:
           log.debug('Anyone can manage own announcements.')
@@ -161,7 +161,7 @@ class Announcements(DBConnection):
           if member.top_role > announcer.top_role:
             log.debug('Member {} with role {} on server {} can edit announcements from lower role.'.format(member.name, member.top_role.name, server.name))
             return announcement
-          elif member.top_role == announcer.top_role:
+          elif command == 'asap' or member.top_role == announcer.top_role:
             if member.top_role == member.server.me.top_role:
               log.debug('Member {} with role {} on server {} can edit announcements.'.format(member.name, member.top_role.name, server.name))
               return announcement
@@ -669,7 +669,7 @@ class Announcements(DBConnection):
         await cat.yelp(message.channel)
 
   async def schedule_announcement(self, message, id, **args):
-    announcement = await self.can_manage_announcements(message.author, message.channel, 'schedule', id = id)
+    announcement = await self.can_manage_announcements(message.author, message.channel, 'schedule' if 'pause' in args else 'asap', id = id)
     if not announcement:
       return