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