Fixes n shit

This commit is contained in:
mrhanky 2017-06-30 20:14:02 +02:00
parent f8bf6b6d55
commit 57df82943b
No known key found for this signature in database
GPG Key ID: 67D772C481CB41B8
6 changed files with 28 additions and 25 deletions

View File

@ -144,11 +144,10 @@ def migrate_users():
try: try:
cur.execute(''' cur.execute('''
insert into insert into
users (nick, host, husbando, waifu, fines) users (nick, husbando, waifu, fines)
values values
(%s, %s, %s, %s, %s) (%s, %s, %s, %s)
''', [u['nick'].strip(), ''', [u['nick'].strip(),
u['mask'].strip() if u['mask'] else None,
husbando, husbando,
waifu, waifu,
fines]) fines])

View File

@ -23,7 +23,7 @@ class Coins(Plugin):
@command @command
def btc(self, mask: IrcString, target: IrcString, args: DocOptDict): def btc(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Gets the Bitcoin values from BitStamp. """Gets the Bitcoin values from cryptowatch.
%%btc [<currency>] %%btc [<currency>]
""" """
@ -31,7 +31,7 @@ class Coins(Plugin):
@command @command
def eth(self, mask: IrcString, target: IrcString, args: DocOptDict): def eth(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Gets the Ethereum values from etherscan.io. """Gets the Ethereum values from cryptowatch.
%%eth [<currency>] %%eth [<currency>]
""" """

View File

@ -61,7 +61,7 @@ class Quotes(DatabasePlugin):
@command(options_first=True) @command(options_first=True)
def q(self, mask: IrcString, target: IrcString, args: DocOptDict): def q(self, mask: IrcString, target: IrcString, args: DocOptDict):
"""Get, add or delete quots for a user """Get, add or delete quotes for an user.
%%q <cmd> <nick> <quote>... %%q <cmd> <nick> <quote>...
%%q <nick> [<index>] %%q <nick> [<index>]

View File

@ -63,12 +63,12 @@ class Rape(DatabasePlugin):
insert into insert into
users (nick, fines) users (nick, fines)
values values
(%s, %s, %s) (%s, %s)
on conflict (nick) do update set on conflict (nick) do update set
fines = users.fines + excluded.fines fines = users.fines + excluded.fines
returning returning
fines fines
''', [nick, fine]) ''', [mask.nick, fine])
self.con.commit() self.con.commit()
# Get reason based on rand value # Get reason based on rand value
@ -78,7 +78,7 @@ class Rape(DatabasePlugin):
self.bot.action(target, self.bot.action(target,
'fines {nick} \x02${fine}\x02 for {reason}. ' 'fines {nick} \x02${fine}\x02 for {reason}. '
'You owe: \x0304${total}\x03' 'You owe: \x0304${total}\x03'
.format(nick=nick, .format(nick=mask.nick,
fine=fine, fine=fine,
reason=reason, reason=reason,
total=self.cur.fetchone()['fines'])) total=self.cur.fetchone()['fines']))

View File

@ -169,8 +169,8 @@ class Useless(DatabasePlugin):
%%choose <items>... %%choose <items>...
""" """
choice = random.choice(' '.join(args['<items>']).split(',')) choice = random.choice(' '.join(args['<items>']).split(','))
return '{nick}, I\'d choose: {choice}'.format(nick=mask.nick, return '{nick}: {choice}'.format(nick=mask.nick,
choice=choice.strip()) choice=choice.strip())
@command @command
def jn(self, mask: IrcString, target: IrcString, args: DocOptDict): def jn(self, mask: IrcString, target: IrcString, args: DocOptDict):

View File

@ -25,17 +25,21 @@ class Weather(Plugin):
req = requests.get(self.URL.format(' '.join(args['<location>']))) req = requests.get(self.URL.format(' '.join(args['<location>'])))
data = req.json() data = req.json()
if 'error' in data: if 'error' in data:
return '[Weather] Location not found' return '\x02[Weather]\x0F Error'
res = data['query']['results']['channel'] elif not data['query']['results']:
return '[Weather] {city}, {region}, {country}: {temp}°{unit_temp} ' \ return '\x02[Weather]\x0F Location not found'
'{text}, {direction} {speed} {unit_speed}' \ else:
.format(city=res['location']['city'], res = data['query']['results']['channel']
region=res['location']['region'].strip(), return '\x02[Weather]\x0F {city}, {region}, {country}: ' \
country=res['location']['country'], '\x02{temp}°{unit_temp} {text}\x0F, ' \
temp=res['item']['condition']['temp'], '\x02{direction} {speed} {unit_speed}\x0F' \
text=res['item']['condition']['text'], .format(city=res['location']['city'],
direction='↑↗→↘↓↙←↖'[round(int(res['wind']['direction']) region=res['location']['region'].strip(),
/ 45) % 8], country=res['location']['country'],
speed=res['wind']['speed'], temp=res['item']['condition']['temp'],
unit_temp=res['units']['temperature'], text=res['item']['condition']['text'],
unit_speed=res['units']['speed']) direction='↑↗→↘↓↙←↖'[round(int(res['wind']['direction'])
/ 45) % 8],
speed=res['wind']['speed'],
unit_temp=res['units']['temperature'],
unit_speed=res['units']['speed'])