@require_chanmsg
@require_privilege(OP, u'You are not a channel operator.')
@commands(u'topic')
def topic(bot, trigger):
 if (bot.privileges[trigger.sender][bot.nick] < HALFOP):
  return bot.reply(u"I'm not a channel operator!")
 if (not trigger.group(2)):
  return
 channel = trigger.sender.lower()
 narg = 1
 mask = None
 mask = bot.db.get_channel_value(channel, u'topic_mask')
 mask = (mask or default_mask(trigger))
 mask = mask.replace(u'%s', u'{}')
 narg = len(re.findall(u'{}', mask))
 top = trigger.group(2)
 args = []
 if top:
  args = top.split(u'~', narg)
 if (len(args) != narg):
  message = u'Not enough arguments. You gave {}, it requires {}.'.format(len(args), narg)
  return bot.say(message)
 topic = mask.format(*args)
 bot.write((u'TOPIC', ((channel + u' :') + topic)))

@ require_chanmsg @ require_privilege ( OP , u'You are not a channel operator.' ) @ commands ( u'topic' ) def topic ( bot , trigger ) : if ( bot . privileges [ trigger . sender ] [ bot . nick ] < HALFOP ) : return bot . reply ( u"I'm not a channel operator!" ) if ( not trigger . group ( 2 ) ) : return channel = trigger . sender . lower ( ) narg = 1 mask = None mask = bot . db . get_channel_value ( channel , u'topic_mask' ) mask = ( mask or default_mask ( trigger ) ) mask = mask . replace ( u'%s' , u'{}' ) narg = len ( re . findall ( u'{}' , mask ) ) top = trigger . group ( 2 ) args = [ ] if top : args = top . split ( u'~' , narg ) if ( len ( args ) != narg ) : message = u'Not enough arguments. You gave {}, it requires {}.' . format ( len ( args ) , narg ) return bot . say ( message ) topic = mask . format ( * args ) bot . write ( ( u'TOPIC' , ( ( channel + u' :' ) + topic ) ) )
this gives ops the ability to change the topic .