.. _fbf.plugs.core.controlchar: controlchar ~~~~~~~~~~~ .. automodule:: fbf.plugs.core.controlchar :show-inheritance: :members: :undoc-members: CODE ---- :: # fbf/plugs/common/controlchar.py # # """ command to control the control (command) characters. The cc is a string containing the allowed control characters. """ .. _fbf.plugs.core.controlchar_fbf_imports: fbf imports -------------- :: from fbf.lib.commands import cmnds from fbf.lib.examples import examples .. _fbf.plugs.core.controlchar_cc_command: cc command ------------- :: def handle_cc(bot, ievent): """ arguments: [] - set/get control character of channel. """ try: what = ievent.args[0] if not ievent.msg and not bot.users.allowed(ievent.userhost, 'OPER'): return if len(what) > 1: ievent.reply("only one character is allowed") return try: ievent.chan.data.cc = what except (KeyError, TypeError): ievent.reply("no channel %s in database" % chan) return ievent.chan.save() ievent.reply('control char set to %s' % what) except IndexError: try: cchar = ievent.getcc() ievent.reply('controlchar are/is %s' % cchar) except (KeyError, TypeError): ievent.reply("default cc is %s" % bot.cfg['defaultcc']) cmnds.add('cc', handle_cc, 'USER') examples.add('cc', 'set control char of channel or show control char of channel','1) cc ! 2) cc') .. _fbf.plugs.core.controlchar_cc-add_command: cc-add command ----------------- :: def handle_ccadd(bot, ievent): """ arguments: - add a control char to the channels cc list. """ try: what = ievent.args[0] if not bot.users.allowed(ievent.userhost, 'OPER'): return if len(what) > 1: ievent.reply("only one character is allowed") return try: ievent.chan.data.cc += what except (KeyError, TypeError): ievent.reply("no channel %s in database" % ievent.channel) return ievent.chan.save() ievent.reply('control char %s added' % what) except IndexError: ievent.missing(' []') cmnds.add('cc-add', handle_ccadd, 'OPER', allowqueue=False) examples.add('cc-add', 'cc-add .. add control character', 'cc-add #') .. _fbf.plugs.core.controlchar_cc-del_command: cc-del command ----------------- :: def handle_ccdel(bot, ievent): """ arguments: - remove a control char from the channels cc list. """ try: what = ievent.args[0] if not bot.users.allowed(ievent.userhost, 'OPER'): return if len(what) > 1: ievent.reply("only one character is allowed") return if ievent.chan.data.cc: ievent.chan.data.cc = ievent.chan.data.cc.replace(what, '') ievent.chan.save() ievent.reply('control char %s deleted' % what) except IndexError: ievent.missing(' []') cmnds.add('cc-del', handle_ccdel, 'OPER') examples.add('cc-del', 'cc-del .. remove cc', 'cc-del #')