Commit 7c3f68af authored by Trevor Cappallo's avatar Trevor Cappallo
Browse files

speculative deletion change

parent 86ea0722
......@@ -22,6 +22,8 @@ reSummary = re.compile('^\s*(.*)\*\s+([0-9a-fA-F]+)\s+([0-9a-fA-F]+)\s+([0-9a-fA
games=[]
recentlySaid=[]
myMessages = []
seekingIPs = []
lastData = ""
currentGames={}
cnt=0
......@@ -95,7 +97,7 @@ async def on_ready():
@tasks.loop(seconds=5.0)
async def status_task():
global games, cnt, currentGames, recentlySaid
global games, cnt, currentGames, recentlySaid, myMessages, seekingIPs
data = requests.get("https://www.managames.com/tennis/online/TE4_ServerList.php?Poll=1")
info = parse_server_poll(data.text.replace('\n',' '))
games = info['games']
......@@ -167,10 +169,31 @@ async def status_task():
pprint.pprint(line)
with open('all.log', 'a') as f:
f.write(f"[{str(datetime.datetime.now()).split('.')[0]}] > {pprint.pformat(line)}\n")
await ch.send(line)
myMessages.append((line, await ch.send(line)))
removed = False
if ") wants to play a " in line:
pName = line.split("**")[1]
for i in range(len(myMessages)-2,max(len(myMessages)-50,1),-1):
if pName in myMessages[i][0]:
if ") wants to play a " in myMessages[i][0]:
# s = f'~~{myMessages[i][0]}~~'
pprint.pprint(myMessages[i])
with open('all.log', 'a') as f:
f.write(f"[{str(datetime.datetime.now()).split('.')[0]}] x {pprint.pformat(myMessages[i][0])}\n")
await myMessages[i][1].delete()
myMessages.pop(i)
removed = True
break
if len(games) == 0:
recentlySaid = []
if len(myMessages) > 100:
myMessages = myMessages[-100:]
cnt+=1
bot.run(TOKEN)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment