Skip to content

Commit

Permalink
adminchannel: allow non-op .topic in -t channels
Browse files Browse the repository at this point in the history
Depends on #1980. Fixes #1842.
  • Loading branch information
half-duplex committed Jan 23, 2021
1 parent bdc10e0 commit 9c324e8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions sopel/modules/adminchannel.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,16 +287,19 @@ def kickban(bot, trigger):


@plugin.require_chanmsg
@plugin.require_privilege(plugin.OP, ERROR_MESSAGE_NO_PRIV)
@plugin.command('topic')
def topic(bot, trigger):
"""Change the channel topic
The bot must be a channel operator for this command to work.
The bot must be a channel operator for this command to work in +t channels.
"""
if bot.channels[trigger.sender].privileges[bot.nick] < plugin.HALFOP:
mode_t = bot.channels[trigger.sender].modes.get("t", False)
if mode_t and not bot.has_channel_privilege(trigger.sender, plugin.HALFOP):
bot.reply(ERROR_MESSAGE_NOT_OP)
return
if mode_t and bot.channels[trigger.sender].privileges[trigger.nick] < plugin.HALFOP:
bot.reply(ERROR_MESSAGE_NO_PRIV)
return
if not trigger.group(2):
return
channel = trigger.sender.lower()
Expand Down

0 comments on commit 9c324e8

Please sign in to comment.