adding .assume

This commit is contained in:
Cephra 2017-08-18 12:01:06 +02:00
parent 7370b26a43
commit e68d74f81d

View File

@ -21,6 +21,13 @@ ISPS = (
'unity-media',
)
GENDERS = (
'male',
'female',
'shemale',
'hermaphrodite',
)
@irc3.plugin
class Useless(DatabasePlugin):
@ -332,6 +339,20 @@ class Useless(DatabasePlugin):
return '{} is {}% of an asshole.'.format(nick, asshole_perc)
@command
def assume(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Assumes the gender of a nick or yourself.
%%assume [<nick>]
"""
nick = args.get('<nick>') or mask.nick
gender_ix = random.randint(0, len(GENDERS))
gender = GENDERS[gender_ix]
return 'Assuming {}''s gender... it''s a {}.'.format(nick, gender)
# noinspection PyMethodMayBeStatic
def _rainbow(self, i, char):
return '\x03{0:02d}{1}'.format(RAINBOW[i % RAINBOW_LEN], char)