From e6537120127b9cf957e06414ba61efffe4b13492 Mon Sep 17 00:00:00 2001 From: Juzlus Date: Wed, 10 Jun 2026 14:42:00 +0200 Subject: [PATCH] update readme --- .github/readme-pl.md | 2 +- .github/readme.md | 2 +- .github/update_thanks.py | 65 +++++++++++++++++++++-------- .github/workflows/update_thanks.yml | 1 + readme-pl.md | 12 +++++- readme.md | 12 +++++- 6 files changed, 70 insertions(+), 24 deletions(-) diff --git a/.github/readme-pl.md b/.github/readme-pl.md index 046d947..fd5c368 100644 --- a/.github/readme-pl.md +++ b/.github/readme-pl.md @@ -35,7 +35,7 @@ jRandomSkills to plugin do CounterStrike 2, który wprowadza chaos i frajdę do ## 🖼️ Prezentacja Pluginu ![Preview](https://github.com/Juzlus/jRandomSkills/blob/main/.github/preview.gif?raw=true) -![Preview2](https://github.com/Juzlus/jRandomSkills/blob/main/.github/preview2.gif?raw=true +![Preview2](https://github.com/Juzlus/jRandomSkills/blob/main/.github/preview2.gif?raw=true) ## 🌐 Serwer Testowy Dołącz do serwera testowego 3v3 i wypróbuj plugin jRandomSkills: diff --git a/.github/readme.md b/.github/readme.md index d14c5bb..c7b7a43 100644 --- a/.github/readme.md +++ b/.github/readme.md @@ -35,7 +35,7 @@ jRandomSkills is a plugin for CounterStrike 2 that brings chaos and fun to gamep ## 🖼️ Preview ![Preview](https://github.com/Juzlus/jRandomSkills/blob/main/.github/preview.gif?raw=true) -![Preview2](https://github.com/Juzlus/jRandomSkills/blob/main/.github/preview2.gif?raw=true +![Preview2](https://github.com/Juzlus/jRandomSkills/blob/main/.github/preview2.gif?raw=true) ## 🌐 Test Server Join the 3v3 test server and try out the jRandomSkills plugin: diff --git a/.github/update_thanks.py b/.github/update_thanks.py index d3a353b..ea21c31 100644 --- a/.github/update_thanks.py +++ b/.github/update_thanks.py @@ -111,46 +111,75 @@ def get_github_contributors(repo, extra_logins): def get_discord_users(user_ids): - cells = [] + token = os.getenv("DISCORD_BOT_TOKEN") + + if not token: + print("DISCORD_BOT_TOKEN not found") + return "" + headers = { - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" + "Authorization": f"Bot {token}" } - + + cells = [] + for uid in user_ids: try: response = requests.get( - f"https://pfpfinder.com/api/discord/user/{uid}", - headers=headers, + f"https://discord.com/api/v10/users/{uid}", + headers=headers, timeout=10 ) + if response.status_code != 200: print(f"Discord API: Status {response.status_code}") + print(response.text) continue data = response.json() - global_name = data.get("global_name") - username = data.get("username") - if global_name: - name = global_name - else: - print(f"Warning: {uid} has no global_name, falling back to username '{username}'") - name = username - source_url = (data.get("avatar") or "").replace(".gif", ".png") - if not source_url: - default_index = (int(uid) >> 22) % 6 - source_url = f"https://cdn.discordapp.com/embed/avatars/{default_index}.png" + name = ( + data.get("global_name") + or data.get("username") + ) + + avatar_hash = data.get("avatar") + + if avatar_hash: + source_url = ( + f"https://cdn.discordapp.com/avatars/" + f"{uid}/{avatar_hash}.png?size=128" + ) + else: + discriminator = data.get("discriminator", "0") + + if discriminator == "0": + default_index = (int(uid) >> 22) % 6 + else: + default_index = int(discriminator) % 5 + + source_url = ( + f"https://cdn.discordapp.com/embed/avatars/" + f"{default_index}.png" + ) uid_hash = hashlib.sha1(uid.encode()).hexdigest()[:12] filename = f"discord_{uid_hash}.png" + avatar_url = save_avatar(source_url, filename) + if not avatar_url: continue - cells.append(make_cell(avatar_url=avatar_url, name=name)) + cells.append( + make_cell( + avatar_url=avatar_url, + name=name + ) + ) except Exception as e: - print(f"Discord API Error: {e}") + print(f"Discord API Error for: {e}") return build_table(cells) if cells else "" diff --git a/.github/workflows/update_thanks.yml b/.github/workflows/update_thanks.yml index 9b39f76..9f2b940 100644 --- a/.github/workflows/update_thanks.yml +++ b/.github/workflows/update_thanks.yml @@ -29,6 +29,7 @@ jobs: env: DISCORD_USER_IDS: ${{ secrets.DISCORD_USER_IDS }} EXTRA_USERS_GITHUB: ${{ secrets.EXTRA_USERS_GITHUB }} + DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }} run: python .github/update_thanks.py - name: Commit changes diff --git a/readme-pl.md b/readme-pl.md index ccfa73a..b95b4c6 100644 --- a/readme-pl.md +++ b/readme-pl.md @@ -35,7 +35,7 @@ jRandomSkills to plugin do CounterStrike 2, który wprowadza chaos i frajdę do ## 🖼️ Prezentacja Pluginu ![Preview](https://github.com/Juzlus/jRandomSkills/blob/main/.github/preview.gif?raw=true) -![Preview2](https://github.com/Juzlus/jRandomSkills/blob/main/.github/preview2.gif?raw=true +![Preview2](https://github.com/Juzlus/jRandomSkills/blob/main/.github/preview2.gif?raw=true) ## 🌐 Serwer Testowy Dołącz do serwera testowego 3v3 i wypróbuj plugin jRandomSkills: @@ -360,7 +360,15 @@ Plugin korzysta z zawartości następujących projektów: ㅤ -[THANKS] +
+ + + +
Ryuu Jin
Ryuu Jin
cj☭
cj☭
k4chen
k4chen
luno
luno
+ +Jeśli jesteś na tej liście i chcesz usunąć swój profil, skontaktuj się ze mną. + +
## 📋 Lista Zmian diff --git a/readme.md b/readme.md index 242e23b..a1db3a5 100644 --- a/readme.md +++ b/readme.md @@ -35,7 +35,7 @@ jRandomSkills is a plugin for CounterStrike 2 that brings chaos and fun to gamep ## 🖼️ Preview ![Preview](https://github.com/Juzlus/jRandomSkills/blob/main/.github/preview.gif?raw=true) -![Preview2](https://github.com/Juzlus/jRandomSkills/blob/main/.github/preview2.gif?raw=true +![Preview2](https://github.com/Juzlus/jRandomSkills/blob/main/.github/preview2.gif?raw=true) ## 🌐 Test Server Join the 3v3 test server and try out the jRandomSkills plugin: @@ -362,7 +362,15 @@ This plugin uses content from the following projects: ㅤ -[THANKS] +
+ + + +
Ryuu Jin
Ryuu Jin
cj☭
cj☭
k4chen
k4chen
luno
luno
+ +If you are on this list and want your profile removed, please contact me. + +
## 📋 Changelog