1
0
mirror of http://aero2k.de/t/repos/urlbot-native.git synced 2017-09-06 15:25:38 +02:00

enhanced random mode for the "dice" command

This commit is contained in:
urlbot
2014-09-24 21:35:51 +02:00
parent d70c0161d5
commit e6950657b8
2 changed files with 10 additions and 3 deletions

View File

@@ -241,9 +241,13 @@ def parse_commands(data):
elif 'source' in data:
chat_write('My source code can be found at %s' % conf('src-url'))
elif 'dice' in data:
rnd = random.randint(1, 6)
dice_char = [u'', u'', u'', u'', u'', u'']
chat_write('rolling a dice for %s: %s (%d)' %(reply_user, dice_char[rnd-1], rnd))
if reply_user in conf('enhanced-random-user'):
rnd = 0 # this might confuse users. good.
else:
rnd = random.randint(1, 6)
dice_char = [u'', u'', u'', u'', u'', u'', u'']
chat_write('rolling a dice for %s: %s (%d)' %(reply_user, dice_char[rnd], rnd))
elif 'uptime' in data:
u = int(uptime + time.time())
plural_uptime = 's'

View File

@@ -7,6 +7,9 @@ if '__main__' == __name__:
config = {}
config['src-url'] = 'FIXME'
# the "dice" feature will use more efficient random data (0) for given users
config['enhanced-random-user'] = ( 'FIXME', 'FIXME' )
def conf(val):
if val in config.keys():
return config[val]