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:
cur.execute('''
insert into
users (nick, host, husbando, waifu, fines)
users (nick, husbando, waifu, fines)
values
(%s, %s, %s, %s, %s)
(%s, %s, %s, %s)
''', [u['nick'].strip(),
u['mask'].strip() if u['mask'] else None,
husbando,
waifu,
fines])

View File

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

View File

@ -61,7 +61,7 @@ class Quotes(DatabasePlugin):
@command(options_first=True)
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 <nick> [<index>]

View File

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

View File

@ -169,8 +169,8 @@ class Useless(DatabasePlugin):
%%choose <items>...
"""
choice = random.choice(' '.join(args['<items>']).split(','))
return '{nick}, I\'d choose: {choice}'.format(nick=mask.nick,
choice=choice.strip())
return '{nick}: {choice}'.format(nick=mask.nick,
choice=choice.strip())
@command
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>'])))
data = req.json()
if 'error' in data:
return '[Weather] Location not found'
res = data['query']['results']['channel']
return '[Weather] {city}, {region}, {country}: {temp}°{unit_temp} ' \
'{text}, {direction} {speed} {unit_speed}' \
.format(city=res['location']['city'],
region=res['location']['region'].strip(),
country=res['location']['country'],
temp=res['item']['condition']['temp'],
text=res['item']['condition']['text'],
direction='↑↗→↘↓↙←↖'[round(int(res['wind']['direction'])
/ 45) % 8],
speed=res['wind']['speed'],
unit_temp=res['units']['temperature'],
unit_speed=res['units']['speed'])
return '\x02[Weather]\x0F Error'
elif not data['query']['results']:
return '\x02[Weather]\x0F Location not found'
else:
res = data['query']['results']['channel']
return '\x02[Weather]\x0F {city}, {region}, {country}: ' \
'\x02{temp}°{unit_temp} {text}\x0F, ' \
'\x02{direction} {speed} {unit_speed}\x0F' \
.format(city=res['location']['city'],
region=res['location']['region'].strip(),
country=res['location']['country'],
temp=res['item']['condition']['temp'],
text=res['item']['condition']['text'],
direction='↑↗→↘↓↙←↖'[round(int(res['wind']['direction'])
/ 45) % 8],
speed=res['wind']['speed'],
unit_temp=res['units']['temperature'],
unit_speed=res['units']['speed'])