Compare commits

...

2 Commits

Author SHA1 Message Date
Alex Orid
c04322ccd7 Threading Fix 2020-11-17 05:30:43 -05:00
Alex Orid
b2b1d87949 Fixed Command Typo 2020-11-16 16:59:55 -05:00
2 changed files with 9 additions and 2 deletions

View File

@ -18,5 +18,5 @@ class CommandTTS(AbstractCommand, metaclass=ABCMeta):
bot.tts_enabled = True bot.tts_enabled = True
elif args[1] == "stop": elif args[1] == "stop":
if twitch_message.sender.lower() == twitch_message.channel: if twitch_message.sender.lower() == twitch_message.channel:
bot.send_message("tts activated on #%s" % twitch_message.channel) bot.send_message("tts deactivated on #%s" % twitch_message.channel)
bot.tts_enabled = False bot.tts_enabled = False

View File

@ -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)