Compare commits

...

2 Commits

Author SHA1 Message Date
Alex Orid
8f2ae75dc8 Discord TTS Channel 2020-11-19 00:22:07 -05:00
Alex Orid
a57ac29e72 Discord Script Tweak 2020-11-18 02:16:55 -05:00
2 changed files with 24 additions and 3 deletions

View File

@ -17,6 +17,7 @@ import credentials
import discord import discord
import discord.message import discord.message
import discord.channel import discord.channel
import discord.abc
from cooldowns import Cooldown_Module from cooldowns import Cooldown_Module
@ -33,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)
@ -48,19 +50,36 @@ 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 == "//test": if message.content == "//testing":
await message.channel.send('test response') await message.channel.send('test response')
#test = self.get_channel(431129571308339210)
#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):
# containsURL: bool = self.contains_url(message) # containsURL: bool = self.contains_url(message)
try: try:

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