Just trying different things

pull/8/head
sgoudham 4 years ago
parent c0a26ba776
commit 9bca4f0ff3

@ -86,6 +86,19 @@ class Bot(commands.Bot):
self.modmail_cache = {}
self.member_cache = MyCoolCache(2)
async def create_connection():
"""Setting up connection using asyncpg"""
self.db = await asyncpg.create_pool(
host=host,
port=int(port),
user=user,
password=password,
database=db,
loop=self.loop)
create_connection()
async def startup_cache_log():
"""Store the guilds/modmail systems in cache from the database on startup"""
@ -125,7 +138,7 @@ class Bot(commands.Bot):
# Establish Database Connection
# self.loop.run_until_complete(create_connection())
# Load Information Into Cache
# self.loop.run_until_complete(startup_cache_log())
self.loop.run_until_complete(startup_cache_log())
async def post_bot_stats():
"""Update guild count on discord.bots.gg"""
@ -700,14 +713,3 @@ class Bot(commands.Bot):
self.run(API_TOKEN)
except discord.errors.LoginFailure as e:
print(e, "Login unsuccessful.")
async def create_connection(self):
"""Setting up connection using asyncpg"""
self.db = await asyncpg.create_pool(
host=host,
port=int(port),
user=user,
password=password,
database=db,
loop=self.loop)

@ -20,7 +20,6 @@ from bot import Bot
# Initiating Bot Object As Client
client = Bot()
client.create_connection()
@client.command()
@ -39,5 +38,7 @@ async def test(ctx):
print(client.member_cache.cache)
client.create_connection()
# Run the bot
client.execute()

Loading…
Cancel
Save