Compare commits
2 Commits
8f2ae75dc8
...
9cbd57b4b2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9cbd57b4b2 | ||
|
|
f518c31a98 |
@ -140,7 +140,7 @@ class Credentials_Module():
|
|||||||
return tempCert
|
return tempCert
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def find_Discord_Credential(self, searchParam: str):
|
def find_Discord_Credential(self, searchParam: str):
|
||||||
print("Searching for Discord Credential named: " + searchParam)
|
print("Searching for Discord Credential named: " + searchParam)
|
||||||
foundSomething = False
|
foundSomething = False
|
||||||
@ -169,8 +169,7 @@ class Credentials_Module():
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
credentialLoadingFunctions = { # this is a mapping of the Credential enum to function pointers
|
credentialLoadingFunctions = { # this is a mapping of the Credential enum to function pointers
|
||||||
Credential.Twitch_Credential: load_Twitch_Credential,
|
Credential.Twitch_Credential: load_Twitch_Credential,
|
||||||
Credential.Discord_Credential: load_Discord_Credential,
|
Credential.Discord_Credential: load_Discord_Credential,
|
||||||
|
|||||||
4
db.py
4
db.py
@ -20,7 +20,7 @@ class db_module():
|
|||||||
createEngine = False
|
createEngine = False
|
||||||
else:
|
else:
|
||||||
credential = self.dbCredential
|
credential = self.dbCredential
|
||||||
|
|
||||||
if createEngine:
|
if createEngine:
|
||||||
self.engine = create_engine(credential.engine_url)
|
self.engine = create_engine(credential.engine_url)
|
||||||
self.currentWorkingDB = credential.databaseName
|
self.currentWorkingDB = credential.databaseName
|
||||||
@ -70,7 +70,7 @@ class db_module():
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
testModule = db_module()
|
testModule = db_module()
|
||||||
|
|
||||||
credentials_manager = credentials.Credentials_Module()
|
credentials_manager = credentials.Credentials_Module()
|
||||||
credentials_manager.load_credentials()
|
credentials_manager.load_credentials()
|
||||||
testModule.dbCredential = credentials_manager.find_DB_Credential("praxis_bot")
|
testModule.dbCredential = credentials_manager.find_DB_Credential("praxis_bot")
|
||||||
|
|||||||
@ -42,7 +42,7 @@ class Discord_Module(discord.Client):
|
|||||||
def main(self):
|
def main(self):
|
||||||
print("starting loop")
|
print("starting loop")
|
||||||
self.loop.create_task(self.startup())
|
self.loop.create_task(self.startup())
|
||||||
self.loop.run_forever()
|
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)
|
||||||
@ -52,12 +52,12 @@ class Discord_Module(discord.Client):
|
|||||||
print(message.content)
|
print(message.content)
|
||||||
#print(message.channel.id)
|
#print(message.channel.id)
|
||||||
#Message ID
|
#Message ID
|
||||||
#print(str(message.id))
|
#print(str(message.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.
|
# This will check for the praxis_bot-tts channel and will TTS stuff from there.
|
||||||
@ -67,14 +67,14 @@ class Discord_Module(discord.Client):
|
|||||||
await self.eval_commands(message)
|
await self.eval_commands(message)
|
||||||
#await self.tts_message(message)
|
#await self.tts_message(message)
|
||||||
|
|
||||||
|
|
||||||
async def eval_triggeredEvents(self, message: discord.Message):
|
async def eval_triggeredEvents(self, message: discord.Message):
|
||||||
|
|
||||||
# This will check for the selected channels and will TTS stuff from there.
|
# This will check for the selected channels and will TTS stuff from there.
|
||||||
for channel in self.selected_ttsChannels:
|
for channel in self.selected_ttsChannels:
|
||||||
if channel == message.channel.id:
|
if channel == message.channel.id:
|
||||||
await self.tts_message(message)
|
await self.tts_message(message)
|
||||||
|
|
||||||
|
|
||||||
async def eval_automaticEvents(self, message: discord.Message):
|
async def eval_automaticEvents(self, message: discord.Message):
|
||||||
pass
|
pass
|
||||||
@ -85,7 +85,7 @@ class Discord_Module(discord.Client):
|
|||||||
try:
|
try:
|
||||||
#first_space_idx = message.text.index(' ')
|
#first_space_idx = message.text.index(' ')
|
||||||
|
|
||||||
# This fixes a error where if you send a command without arguments it fails because
|
# This fixes a error where if you send a command without arguments it fails because
|
||||||
# it cant find the substring.
|
# it cant find the substring.
|
||||||
if message.content.find(" ") != -1:
|
if message.content.find(" ") != -1:
|
||||||
first_space_idx = message.content.index(' ')
|
first_space_idx = message.content.index(' ')
|
||||||
@ -123,7 +123,7 @@ class Discord_Module(discord.Client):
|
|||||||
# Checks for basic slurs.
|
# Checks for basic slurs.
|
||||||
async def contains_slur(self, message: discord.Message):
|
async def contains_slur(self, message: discord.Message):
|
||||||
containsSlur: bool = False
|
containsSlur: bool = False
|
||||||
|
|
||||||
if await self.slur_check(message.content) or await self.slur_check(message.author.display_name):
|
if await self.slur_check(message.content) or await self.slur_check(message.author.display_name):
|
||||||
containsSlur = True
|
containsSlur = True
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ class Discord_Module(discord.Client):
|
|||||||
isBot = True
|
isBot = True
|
||||||
print("<{ bot detected! }> ")
|
print("<{ bot detected! }> ")
|
||||||
return isBot
|
return isBot
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -168,4 +168,3 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
testModule.main()
|
testModule.main()
|
||||||
|
|
||||||
|
|
||||||
6
main.py
6
main.py
@ -40,7 +40,7 @@ def discord_module_init(dbCert, discordCert):
|
|||||||
|
|
||||||
def thread_main():
|
def thread_main():
|
||||||
global twitch_chat
|
global twitch_chat
|
||||||
global discord_connection
|
global discord_connection
|
||||||
global credentials_manager
|
global credentials_manager
|
||||||
|
|
||||||
twitch_chat = twitch_script.Twitch_Module()
|
twitch_chat = twitch_script.Twitch_Module()
|
||||||
@ -62,12 +62,12 @@ def thread_main():
|
|||||||
threads.append(discord)
|
threads.append(discord)
|
||||||
discord.start()
|
discord.start()
|
||||||
|
|
||||||
print("---Post Thread Creation Test---")
|
print("---Post Thread Creation Test---")
|
||||||
for t in threads:
|
for t in threads:
|
||||||
t.join()
|
t.join()
|
||||||
|
|
||||||
print("---Point of no return---")
|
print("---Point of no return---")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user