Commit c50e9136 authored by Trevor Cappallo's avatar Trevor Cappallo
Browse files

hopefully fixed spam bug

parent f8f29424
......@@ -16,6 +16,7 @@ reSummary = re.compile('^\s*(.*)\*\s+([0-9a-fA-F]+)\s+([0-9a-fA-F]+)\s+([0-9a-fA
oldGames=[]
newGames=[]
recentlySaid=[]
currentGames={}
cnt=0
......@@ -82,7 +83,7 @@ async def on_ready():
@tasks.loop(seconds=15.0)
async def status_task():
global oldGames, newGames, cnt, currentGames
global oldGames, newGames, cnt, currentGames, recentlySaid
data = requests.get("https://www.managames.com/tennis/online/TE4_ServerList.php?Poll=1")
# if cnt==0:
# info = parse_server_poll('0 10E1 "POLAND vs TennisStar" B180D41 12C 6AC 96 "" "6/3 4/6 7/6" 510 2 46 617DAC94 * 1 0 0 34 1ED48 0 MG-on'.replace('\n',' '))
......@@ -113,15 +114,22 @@ async def status_task():
s = f"{game['name']} (elo: {game['elo']}, rep: {game['reputation']}%) wants to play a {game['game_info']['nb_set']}-set match."
if len(game['tagline'])>0:
s += f" Comment: {game['tagline']}"
out += [s]
if s not in recentlySaid:
out += [s]
recentlySaid.append(s)
if len(recentlySaid) > 5:
recentlySaid = recentlySaid[-5:]
pprint.pprint(out)
await ch.send("\n".join(out))
if len(out) > 0:
await ch.send("\n".join(out))
oldGames = [sorted([str(y) for y in x.values()]) for x in newGames]
# oldGames += newGames
# oldGames =
# if (len(oldGames)>10):
# oldGames=oldGames[-10:]
else:
recentlySaid = []
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