Threading Fix
This commit is contained in:
parent
b2b1d87949
commit
c04322ccd7
@ -3,6 +3,7 @@ import re
|
|||||||
|
|
||||||
from discord import message
|
from discord import message
|
||||||
from discord.client import Client
|
from discord.client import Client
|
||||||
|
import asyncio
|
||||||
|
|
||||||
import config as config
|
import config as config
|
||||||
import db
|
import db
|
||||||
@ -22,6 +23,7 @@ from cooldowns import Cooldown_Module
|
|||||||
class Discord_Module(discord.Client):
|
class Discord_Module(discord.Client):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
self.loop = asyncio.get_event_loop()
|
||||||
self.dbCredential: credentials.DB_Credential
|
self.dbCredential: credentials.DB_Credential
|
||||||
self.discordCredential: credentials.Discord_Credential
|
self.discordCredential: credentials.Discord_Credential
|
||||||
|
|
||||||
@ -32,8 +34,13 @@ class Discord_Module(discord.Client):
|
|||||||
|
|
||||||
self.tts_enabled: bool = False
|
self.tts_enabled: bool = False
|
||||||
|
|
||||||
|
async def startup(self):
|
||||||
|
await self.start(self.discordCredential.token)
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
self.run(self.discordCredential.token)
|
print("starting loop")
|
||||||
|
self.loop.create_task(self.startup())
|
||||||
|
self.loop.run_forever()
|
||||||
|
|
||||||
async def on_ready(self):
|
async def on_ready(self):
|
||||||
print('Logged on as', self.user)
|
print('Logged on as', self.user)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user