Fixed old connection closing method, used new function inside of confi
This commit is contained in:
parent
3d61f9afd4
commit
547025790e
14
cogs/core.py
14
cogs/core.py
|
@ -12,6 +12,7 @@ import re
|
|||
|
||||
class Core:
|
||||
"""Core commands, these are the not 'complicated' commands."""
|
||||
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
|
@ -28,7 +29,8 @@ class Core:
|
|||
perms.embed_links = True
|
||||
perms.read_message_history = True
|
||||
perms.attach_files = True
|
||||
await self.bot.say("Use this URL to add me to a server that you'd like!\n{}".format(discord.utils.oauth_url('183748889814237186',perms)))
|
||||
await self.bot.say("Use this URL to add me to a server that you'd like!\n{}"
|
||||
.format(discord.utils.oauth_url('183748889814237186', perms)))
|
||||
|
||||
@commands.command()
|
||||
async def joke(self):
|
||||
|
@ -89,12 +91,12 @@ class Core:
|
|||
await self.bot.say(response)
|
||||
|
||||
@commands.command(pass_context=True)
|
||||
async def roll(self, ctx, notation: str = "d6"):
|
||||
async def roll(self, ctx, notation: str="d6"):
|
||||
"""Rolls a die based on the notation given
|
||||
Format should be #d#"""
|
||||
try:
|
||||
dice = re.search("(\d*)d(\d*)",notation).group(1)
|
||||
num = re.search("(\d*)d(\d*)",notation).group(2)
|
||||
dice = re.search("(\d*)d(\d*)", notation).group(1)
|
||||
num = re.search("(\d*)d(\d*)", notation).group(2)
|
||||
except AttributeError:
|
||||
await self.bot.say("Please provide the die notation in #d#!")
|
||||
return
|
||||
|
@ -106,8 +108,8 @@ class Core:
|
|||
if int(num) > 25:
|
||||
await self.bot.say("What die has more than 25 sides? Please, calm down")
|
||||
return
|
||||
valueStr = str(random.randint(1,int(num)))
|
||||
for i in range(1,int(dice)):
|
||||
valueStr = str(random.randint(1, int(num)))
|
||||
for i in range(1, int(dice)):
|
||||
value = random.randint(1, int(num))
|
||||
valueStr += ", {}".format(value)
|
||||
|
||||
|
|
|
@ -36,8 +36,7 @@ def updateBattleRecords(winner, loser):
|
|||
sql = "insert into battle_records (id,record) values ('{0}','1-0')".format(winner.id)
|
||||
cursor.execute(sql)
|
||||
|
||||
config.connection.commit()
|
||||
config.connection.close()
|
||||
config.closeConnection()
|
||||
|
||||
# Update losers records
|
||||
sql = "select record from battle_records where id={0}".format(loser.id)
|
||||
|
|
Loading…
Reference in a new issue