Discord TTS Channel

This commit is contained in:
Alex Orid 2020-11-19 00:22:07 -05:00
parent a57ac29e72
commit 8f2ae75dc8
2 changed files with 21 additions and 6 deletions

View File

@ -34,6 +34,7 @@ class Discord_Module(discord.Client):
self.commands = command_loader.load_commands_new(AbstractCommand.CommandType.DISCORD) self.commands = command_loader.load_commands_new(AbstractCommand.CommandType.DISCORD)
self.tts_enabled: bool = False self.tts_enabled: bool = False
self.selected_ttsChannels:list = []
async def startup(self): async def startup(self):
await self.start(self.discordCredential.token) await self.start(self.discordCredential.token)
@ -49,22 +50,34 @@ class Discord_Module(discord.Client):
async def on_message(self, message: discord.Message): async def on_message(self, message: discord.Message):
print("{" + message.guild.name + "}[ " + str(message.channel) + " ](" + message.author.display_name + ")> ") print("{" + message.guild.name + "}[ " + str(message.channel) + " ](" + message.author.display_name + ")> ")
print(message.content) print(message.content)
#print(message.channel.id)
#Message ID #Message ID
#print(str(message.id)) #print(str(message.id))
#Channel ID
#print(str(message.channel.id)) #print(str(message.channel.id))
if message.content == "//testing": if message.content == "//testing":
await message.channel.send('test response') await message.channel.send('test response')
#test = self.get_channel(431129571308339210) #test = self.get_channel(431129571308339210)
#await test.send("testerino") #await test.send("testerino")
if not await self.isSenderBot(message): if not await self.isSenderBot(message):
# This will check for the praxis_bot-tts channel and will TTS stuff from there.
await self.eval_triggeredEvents(message)
if self.cooldownModule.isCooldownActive("discordRateLimit") == False: if self.cooldownModule.isCooldownActive("discordRateLimit") == False:
await self.eval_commands(message) await self.eval_commands(message)
#await self.tts_message(message)
async def eval_triggeredEvents(self, message: discord.Message):
# This will check for the selected channels and will TTS stuff from there.
for channel in self.selected_ttsChannels:
if channel == message.channel.id:
await self.tts_message(message) await self.tts_message(message)
async def eval_automaticEvents(self, message: discord.Message):
pass
async def eval_commands(self, message: discord.Message): async def eval_commands(self, message: discord.Message):

View File

@ -32,6 +32,8 @@ def discord_module_init(dbCert, discordCert):
discord_connection.dbCredential = dbCert discord_connection.dbCredential = dbCert
discord_connection.discordCredential = discordCert discord_connection.discordCredential = discordCert
discord_connection.selected_ttsChannels.append(431129571308339210)
discord_connection.main() discord_connection.main()