This commit is contained in:
Fierelier 2021-05-17 06:55:35 +02:00
parent bdc8e5f36a
commit eb38836c61
4 changed files with 34 additions and 33 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
__pycache__/
userdata/
token.txt

View File

@ -2,7 +2,10 @@ import queue
import importlib
import asyncio
discordThread = importlib.import_module("discord-thread")
discordThread.run("no")
token = ""
with open("token.txt") as f:
token = f.read()
discordThread.run(token)
def main():
try:

View File

@ -6,6 +6,3 @@ observeDirectMessageChannels = true
[lostMessageTracker]
trackMessages = true
acquireAllOnReconnect = true
[performance]
loopTime = 0.1

View File

@ -75,9 +75,6 @@ def readConfig():
global cObserveDirectMessageChannels
cObserveDirectMessageChannels = stringToBool(config["default"]["observeDirectMessageChannels"])
global cLoopTime
cLoopTime = float(config["performance"]["loopTime"])
readConfig()
def shouldIgnoreChannel(channel):
@ -160,6 +157,7 @@ class discordClient(threading.Thread):
async def acquireAllLostMessages(self):
eprint("Acquiring lost messages...")
with fetchMessageLock:
for channel in self.getTrackedChannels():
messageIDs = False
with fileLock:
@ -205,7 +203,7 @@ class discordClient(threading.Thread):
async def on_message(self,message,tracked = False):
if shouldIgnoreChannel(message.channel): return
if tracked == False:
with fileLock:
with fetchMessageLock, fileLock:
messageIDs = self.readChannelMessageIdFile(message.channel)
if not str(message.id) in messageIDs:
self.addToChannelMessageIdFile(message)