CONSISTENCY

This commit is contained in:
mrhanky 2017-08-22 15:16:29 +02:00
parent f8d80c3177
commit 9d1602046d
No known key found for this signature in database
GPG Key ID: 67D772C481CB41B8

View File

@ -53,10 +53,8 @@ class Useless(DatabasePlugin):
def bounce(self, mask, target): def bounce(self, mask, target):
nick = IrcString(mask).nick nick = IrcString(mask).nick
if target != '#w0bm' or nick == self.bot.nick: if target == '#w0bm' and nick != self.bot.nick:
return self.bot.privmsg(target, '{}: Du musst bouncen!'.format(nick))
self.bot.privmsg(target, '{}: Du musst bouncen!'.format(nick))
@irc3.event(r'(?i)^:\S+ PRIVMSG (?P<target>\S+) :.*(woah|whoa).*$') @irc3.event(r'(?i)^:\S+ PRIVMSG (?P<target>\S+) :.*(woah|whoa).*$')
def woah(self, target: str): def woah(self, target: str):
@ -86,7 +84,7 @@ class Useless(DatabasePlugin):
@command @command
def kill(self, mask: IrcString, target: IrcString, args: DocOptDict): def kill(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Kills a user with a random message. """Kills a user with a random message
%%kill [<nick>] %%kill [<nick>]
""" """
@ -106,7 +104,7 @@ class Useless(DatabasePlugin):
@command @command
def yiff(self, mask: IrcString, target: IrcString, args: DocOptDict): def yiff(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Yiffs a user with a random message. """Yiffs a user with a random message
%%yiff [<nick>] %%yiff [<nick>]
""" """
@ -127,11 +125,11 @@ class Useless(DatabasePlugin):
@command @command
def waifu(self, mask: IrcString, target: IrcString, args: DocOptDict): def waifu(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Get waifu for a user. """Get waifu for a user
%%waifu [<nick>...] %%waifu [<nick>...]
""" """
nick = ' '.join(args.get('<nick>')) or mask.nick nick = ' '.join(args.get('<nick>', mask.nick))
if nick.startswith('='): if nick.startswith('='):
waifu = nick[1:] waifu = nick[1:]
@ -149,7 +147,7 @@ class Useless(DatabasePlugin):
self.bot.notice(mask.nick, 'Waifu set to: {}'.format(waifu)) self.bot.notice(mask.nick, 'Waifu set to: {}'.format(waifu))
except Error as ex: except Error as ex:
print(ex) self.log.error(ex)
self.con.rollback() self.con.rollback()
else: else:
self.cur.execute(''' self.cur.execute('''
@ -163,15 +161,15 @@ class Useless(DatabasePlugin):
result = self.cur.fetchone() result = self.cur.fetchone()
if result and result['waifu']: if result and result['waifu']:
return '\x02[Waifu]\x0F {}: {}'.format(nick, result['waifu']) return '\x02[Waifu]\x02 {}: {}'.format(nick, result['waifu'])
@command @command
def husbando(self, mask: IrcString, target: IrcString, args: DocOptDict): def husbando(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Get husbando for a user. """Get husbando for a user
%%husbando [<nick>...] %%husbando [<nick>...]
""" """
nick = ' '.join(args.get('<nick>')) or mask.nick nick = ' '.join(args.get('<nick>', mask.nick))
if nick.startswith('='): if nick.startswith('='):
nick = nick[1:] nick = nick[1:]
@ -189,7 +187,7 @@ class Useless(DatabasePlugin):
self.bot.notice(mask.nick, 'Husbando set to: {}'.format(nick)) self.bot.notice(mask.nick, 'Husbando set to: {}'.format(nick))
except Error as ex: except Error as ex:
print(ex) self.log.error(ex)
self.con.rollback() self.con.rollback()
else: else:
self.cur.execute(''' self.cur.execute('''
@ -203,12 +201,12 @@ class Useless(DatabasePlugin):
result = self.cur.fetchone() result = self.cur.fetchone()
if result and result['husbando']: if result and result['husbando']:
return '\x02[Husbando]\x0F {}: {}'.format(nick, result['husbando']) return '\x02[Husbando]\x02 {}: {}'.format(nick, result['husbando'])
@command @command
def storyofpomfface(self, mask: IrcString, target: IrcString, def storyofpomfface(self, mask: IrcString, target: IrcString,
args: DocOptDict): args: DocOptDict):
"""Story of pomf face. """Story of pomf face
%%storyofpomfface %%storyofpomfface
""" """
@ -217,7 +215,7 @@ class Useless(DatabasePlugin):
@command @command
def choose(self, mask: IrcString, target: IrcString, args: DocOptDict): def choose(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Decides between items separated by comma. """Decides between items (separated by comma)
%%choose <items>... %%choose <items>...
""" """
@ -236,24 +234,23 @@ class Useless(DatabasePlugin):
@command @command
def kiss(self, mask: IrcString, target: IrcString, args: DocOptDict): def kiss(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Kisses a user. """Kisses a user
%%kiss [<nick>] %%kiss [<nick>]
""" """
return '(づ。◕‿‿◕。)\x0304。。・゜゜・。。・゜❤\x0F {} \x0304❤'.format(args.get('<nick>', mask.nick)) return '(づ。◕‿‿◕。)\x0304。。・゜゜・。。・゜❤\x03 {} \x0304❤'.format(args.get('<nick>', mask.nick))
@command @command
def hug(self, mask: IrcString, target: IrcString, args: DocOptDict): def hug(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Hugs a user. """Hugs a user
%%hug [<nick>] %%hug [<nick>]
""" """
return '\x0304♥♡❤♡♥\x0F {} \x0304♥♡❤♡♥'.format(args.get('<nick>', mask.nick)) return '\x0304♥♡❤♡♥\x03 {} \x0304♥♡❤♡♥'.format(args.get('<nick>', mask.nick))
@command @command
def bier(self, mask: IrcString, target: IrcString, args: DocOptDict): def bier(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Gives nick a beer. """Gives nick a beer
%%bier [<nick>] %%bier [<nick>]
""" """
@ -262,7 +259,7 @@ class Useless(DatabasePlugin):
@command @command
def fucken(self, mask: IrcString, target: IrcString, args: DocOptDict): def fucken(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Kills and fucks a nick. """Kills and fucks a nick
%%fucken [<nick>] %%fucken [<nick>]
""" """
@ -271,7 +268,7 @@ class Useless(DatabasePlugin):
@command @command
def anhero(self, mask: IrcString, target: IrcString, args: DocOptDict): def anhero(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Kicks a nick. """Kicks a nick
%%anhero %%anhero
""" """
@ -279,7 +276,7 @@ class Useless(DatabasePlugin):
@command @command
def sudoku(self, mask: IrcString, target: IrcString, args: DocOptDict): def sudoku(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Kicks a nick. """Kicks a nick
%%sudoku %%sudoku
""" """
@ -287,7 +284,7 @@ class Useless(DatabasePlugin):
@command @command
def hack(self, mask: IrcString, target: IrcString, args: DocOptDict): def hack(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Hacks (a user). """Hacks (a nick)
%%hack [<nick>] %%hack [<nick>]
""" """
@ -304,7 +301,7 @@ class Useless(DatabasePlugin):
@command @command
def rainbow(self, mask: IrcString, target: IrcString, args: DocOptDict): def rainbow(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Colorize a word in rainbow colors. """Colorize a word in rainbow colors
%%rainbow <word>... %%rainbow <word>...
""" """
@ -319,7 +316,7 @@ class Useless(DatabasePlugin):
@command @command
def wrainbow(self, mask: IrcString, target: IrcString, args: DocOptDict): def wrainbow(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Colorize words in a sentence with rainbow colors. """Colorize words in a sentence with rainbow colors
%%wrainbow <words>... %%wrainbow <words>...
""" """
@ -329,15 +326,17 @@ class Useless(DatabasePlugin):
def halfwidth(self, mask: IrcString, target: IrcString, args: DocOptDict): def halfwidth(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Turns UPPERCASE words into halfwidth characters """Turns UPPERCASE words into halfwidth characters
%%halfwidth <text>... %%halfwidth <words>...
""" """
def halfwidth_replace(match):
def replace(match):
return ''.join(chr(0xFF20 + (ord(c) - 64)) for c in match.group(0)) return ''.join(chr(0xFF20 + (ord(c) - 64)) for c in match.group(0))
return '[HALFWIDTH] {}'.format(re.sub(r'(?:\b)[A-Z]+(?:\b)', halfwidth_replace, ' '.join(args['<text>'])))
return '\x02[HALFWIDTH]\x02 {}'.format(re.sub(r'(?:\b)[A-Z]+(?:\b)', replace, ' '.join(args['<words>'])))
@command @command
def asshole(self, mask: IrcString, target: IrcString, args: DocOptDict): def asshole(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Checks how much of an asshole you are. """Checks how much of an asshole you are
%%asshole [<nick>] %%asshole [<nick>]
""" """
@ -355,7 +354,7 @@ class Useless(DatabasePlugin):
@command @command
def assume(self, mask: IrcString, target: IrcString, args: DocOptDict): def assume(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Assumes the gender of a nick or yourself. """Assumes the gender of a nick or yourself
%%assume [<nick>] %%assume [<nick>]
""" """