Download:
child 8:8645840c53d1
parent 6:bddc9023ac66
7:7b7c6ad5c7ba
Anton Shestakov <av6@dwimlabs.net>, Wed, 11 May 2016 00:06:30 +0800
rollbot: configurable command prefix

1 файлов изменено, 5 вставок(+), 3 удалений(-) [+]
rollbot.py file | annotate | diff | comparison | revisions
--- a/rollbot.py Wed May 11 00:04:29 2016 +0800
+++ b/rollbot.py Wed May 11 00:06:30 2016 +0800
@@ -15,11 +15,11 @@
class RollBot(sleekxmpp.ClientXMPP):
- def __init__(self, jid, password, nick):
+ def __init__(self, jid, password, nick, prefix):
sleekxmpp.ClientXMPP.__init__(self, jid, password)
self.nick = nick
- self.prefix = '!'
+ self.prefix = prefix
self.commands = []
self.add_event_handler('session_start', self.start)
@@ -94,6 +94,7 @@
group.add_argument('-j', '--jid', help='JID to use')
group.add_argument('-p', '--password', help='password to use')
group.add_argument('-n', '--nick', help='MUC nickname')
+ group.add_argument('--prefix', help='command prefix (default: !)')
group = parser.add_mutually_exclusive_group()
group.add_argument('-q', '--quiet', help='set logging to ERROR', action='store_const', dest='loglevel', const=logging.ERROR, default=logging.INFO)
@@ -111,8 +112,9 @@
jid = lookup('jid', args, config)
password = lookup('password', args, config)
nick = lookup('nick', args, config, default='rollbot')
+ prefix = lookup('prefix', args, config, default='!')
- rollbot = RollBot(jid, password, nick)
+ rollbot = RollBot(jid, password, nick, prefix)
rollbot.auto_authorize = True
rollbot.auto_subscribe = True
rollbot.register_plugin('xep_0030') # Service Discovery