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):
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<target>\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 [<nick>]
"""
@ -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 [<nick>]
"""
@ -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>...]
"""
nick = ' '.join(args.get('<nick>')) or mask.nick
nick = ' '.join(args.get('<nick>', 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>...]
"""
nick = ' '.join(args.get('<nick>')) or mask.nick
nick = ' '.join(args.get('<nick>', 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 <items>...
"""
@ -236,24 +234,23 @@ class Useless(DatabasePlugin):
@command
def kiss(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Kisses a user.
"""Kisses a user
%%kiss [<nick>]
"""
return '(づ。◕‿‿◕。)\x0304。。・゜゜・。。・゜❤\x0F {} \x0304❤'.format(args.get('<nick>', mask.nick))
return '(づ。◕‿‿◕。)\x0304。。・゜゜・。。・゜❤\x03 {} \x0304❤'.format(args.get('<nick>', mask.nick))
@command
def hug(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Hugs a user.
"""Hugs a user
%%hug [<nick>]
"""
return '\x0304♥♡❤♡♥\x0F {} \x0304♥♡❤♡♥'.format(args.get('<nick>', mask.nick))
return '\x0304♥♡❤♡♥\x03 {} \x0304♥♡❤♡♥'.format(args.get('<nick>', mask.nick))
@command
def bier(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Gives nick a beer.
"""Gives nick a beer
%%bier [<nick>]
"""
@ -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 [<nick>]
"""
@ -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 [<nick>]
"""
@ -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 <word>...
"""
@ -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 <words>...
"""
@ -329,15 +326,17 @@ class Useless(DatabasePlugin):
def halfwidth(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""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 '[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
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>]
"""
@ -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 [<nick>]
"""