Last active
February 22, 2024 04:45
-
-
Save averwhy/6454c1a8d89f6c31ff6db953c867fa23 to your computer and use it in GitHub Desktop.
PINGER.py - For generating a ping list in xqc's chat. NO NEED TO MANUALLY COPY! The program will automatically copy to your clipboard!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import requests | |
import datetime | |
import pyperclip | |
STREAMER = 'xqc' | |
BLACKLIST = ('avrwhy', # myself obviously | |
#all xqc mods \/ | |
'xqcbot', 'thisapear', 'nightbot', 'hydration', 'zza_ow', 'mendo', 'netcat', | |
'timthetatman', 'moobot', 'kaanvict', 'crtvly', 'pokelawls', 'surefour', 'topkej', 'sinatraa', 'a_seagull', | |
'aimbotcalvin', 'numbratv', 'supertf', 'zostradamus', 'shadder2k', 'logviewer', 'eff2ct', 'sodapoppin', | |
'jayne', 'reckful', 'hnlbot', 'streamelements', 'ohbot', 'pajlada', 'infinitea', 'trainwreckstv', 'antvenom', | |
'aiden', 'm0xyy', 'schnozebot', 'ben', 'thonkbot', 'novakr', 'evomanny', 'zullxv', 'nvez', 'jessesmfi', 'fossabot', | |
'legoenthusiast', 'mightyoaks', 'spanova', 'thepositivebot', 'LittleDwarfBot', | |
#cuck usernames \/ | |
'wizwot', 'nothingsinger', | |
#opted out \/ | |
'sulphured', 'serun_ow' | |
) | |
LOG_LINK = "https://logs.ivr.fi/channel/{0}/{1}/{2}/{3}" | |
PREFIX = "SOYSCREAM 🔔 ALERT" | |
SUFFIX = "" | |
def carve_usernames(text: str, amount: int = 300, char_limit: int = 270) -> list[str]: | |
result = (re.findall(f"(?<=\#{STREAMER} )(.*?)(?=\:)", text))[-(amount):] | |
result.reverse() | |
final = [] | |
u_total = 0 | |
for u in result: | |
if u_total >= char_limit: | |
break | |
elif u in final: | |
continue # already in list | |
elif u.lower() in BLACKLIST: | |
continue | |
else: | |
u_total += (len(u)+1) # add 1 for the @ | |
final.append(u) | |
return final | |
def create_pings(char_limit: int = 270) -> None: | |
t = datetime.date.today() | |
y = t.year | |
m = t.month | |
d = t.day | |
try: res = requests.get(LOG_LINK.format(STREAMER, y, m, d)) | |
except Exception as e: | |
print(f"Requests error getting chat logs: {e}") | |
return | |
if res.text.strip() == "The requested channel has opted out of being logged": return print("The requested channel has opted out of being logged") | |
users = carve_usernames(res.text, char_limit) | |
ping = f"{PREFIX} @{' @'.join(users)} {SUFFIX}" | |
print(f"\nThe following was copied to clipboard automatically:\n\n{ping}") | |
pyperclip.copy(ping) | |
if __name__ == "__main__": | |
create_pings() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fixed an issue where the program would use local time instead of UTC (which is what the log site uses)