@sopel.module.commands(u'safety')
def toggle_safety(bot, trigger):
 if ((not trigger.admin) and (bot.privileges[trigger.sender][trigger.nick] < OP)):
  bot.reply(u'Only channel operators can change safety settings')
  return
 allowed_states = [u'strict', u'on', u'off', u'local', u'local strict']
 if ((not trigger.group(2)) or (trigger.group(2).lower() not in allowed_states)):
  options = u' / '.join(allowed_states)
  bot.reply((u'Available options: %s' % options))
  return
 channel = trigger.sender.lower()
 bot.db.set_channel_value(channel, u'safety', trigger.group(2).lower())
 bot.reply((u'Safety is now set to "%s" on this channel' % trigger.group(2)))

@ sopel . module . commands ( u'safety' ) def toggle_safety ( bot , trigger ) : if ( ( not trigger . admin ) and ( bot . privileges [ trigger . sender ] [ trigger . nick ] < OP ) ) : bot . reply ( u'Only channel operators can change safety settings' ) return allowed_states = [ u'strict' , u'on' , u'off' , u'local' , u'local strict' ] if ( ( not trigger . group ( 2 ) ) or ( trigger . group ( 2 ) . lower ( ) not in allowed_states ) ) : options = u' / ' . join ( allowed_states ) bot . reply ( ( u'Available options: %s' % options ) ) return channel = trigger . sender . lower ( ) bot . db . set_channel_value ( channel , u'safety' , trigger . group ( 2 ) . lower ( ) ) bot . reply ( ( u'Safety is now set to "%s" on this channel' % trigger . group ( 2 ) ) )
set safety setting for channel .