Skip to content

Commit

Permalink
фикс моментиков
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgencheg committed Sep 2, 2024
1 parent 93bf395 commit 3c55b3b
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 20 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,9 @@ jobs:
git push
shell: bash
continue-on-error: true

- name: Publish changelog
run: Tools/actions_changelogs_since_last_run.py
env:
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
CHANGELOG_DISCORD_WEBHOOK: ${{ secrets.CHANGELOG_DISCORD_WEBHOOK }}
6 changes: 0 additions & 6 deletions .github/workflows/publish-lostparadise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,3 @@ jobs:
key: ${{ secrets.SSH }}
port: ${{ secrets.PORT }}
script: pwsh /var/www/wiki/push.ps1 ${{ github.sha }}

- name: Publish changelog
run: Tools/actions_changelogs_since_last_run.py
env:
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
CHANGELOG_DISCORD_WEBHOOK: ${{ secrets.CHANGELOG_DISCORD_WEBHOOK }}
59 changes: 47 additions & 12 deletions Content.Server/Chat/Managers/ChatSanitizationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,41 @@ public sealed class ChatSanitizationManager : IChatSanitizationManager
private static readonly Dictionary<string, string> SmileyToEmote = new()
{
// I could've done this with regex, but felt it wasn't the right idea.
{ "хд", "chatsan-laughs" },
{ "о-о", "chatsan-wide-eyed" }, // cyrillic о
{ "о.о", "chatsan-wide-eyed" }, // cyrillic о
{ "0_о", "chatsan-wide-eyed" }, // cyrillic о
{ "о/", "chatsan-waves" }, // cyrillic о
{ "о7", "chatsan-salutes" }, // cyrillic о
{ "0_o", "chatsan-wide-eyed" },
{ "лмао", "chatsan-laughs" },
{ "рофл", "chatsan-laughs" },
{ "яхз", "chatsan-shrugs" },
{ ":0", "chatsan-surprised" },
{ ":р", "chatsan-stick-out-tongue" }, // cyrillic р
{ "кек", "chatsan-laughs" },
{ "T_T", "chatsan-cries" },
{ "Т_Т", "chatsan-cries" }, // cyrillic T
{ "=_(", "chatsan-cries" },
{ "!с", "chatsan-laughs" },
{ "!в", "chatsan-sighs" },
{ "!х", "chatsan-claps" },
{ "!щ", "chatsan-snaps" },
{ "))", "chatsan-smiles-widely" },
{ ")", "chatsan-smiles" },
{ "((", "chatsan-frowns-deeply" },
{ "(", "chatsan-frowns" },
// Corvax-Localization-End
// Lost-Paradise-Localization-Start
{ "орууу", "chatsan-laughs" },
{ "хз", "chatsan-shrugs" },
{ "хсс", "chatsan-shrugs" },
{ "хссс", "chatsan-shrugs" },
{ "шшш", "chatsan-hiss" },
{ "авууу", "chatsan-awoo" },
{ "няяя", "chatsan-nyaaa" },
// Lost-Paradise-Localization-End
// I could've done this with regex, but felt it wasn't the right idea.
{ ":)", "chatsan-smiles" },
{ ":]", "chatsan-smiles" },
{ "=)", "chatsan-smiles" },
Expand Down Expand Up @@ -68,19 +103,19 @@ public sealed class ChatSanitizationManager : IChatSanitizationManager
{ "^^/", "chatsan-waves" },
{ ":/", "chatsan-uncertain" },
{ ":\\", "chatsan-uncertain" },
{ "лмао", "chatsan-laughs" },
{ "лмао.", "chatsan-laughs" },
{ "лол", "chatsan-laughs" },
{ "лол.", "chatsan-laughs" },
{ "хД", "chatsan-laughs" },
{ "хД.", "chatsan-laughs" },
{ "кек", "chatsan-laughs" },
{ "кек.", "chatsan-laughs" },
{ "рофл", "chatsan-laughs" },
{ "о7", "chatsan-salutes" },
{ "lmao", "chatsan-laughs" },
{ "lmao.", "chatsan-laughs" },
{ "lol", "chatsan-laughs" },
{ "lol.", "chatsan-laughs" },
{ "lel", "chatsan-laughs" },
{ "lel.", "chatsan-laughs" },
{ "kek", "chatsan-laughs" },
{ "kek.", "chatsan-laughs" },
{ "rofl", "chatsan-laughs" },
{ "o7", "chatsan-salutes" },
{ ";_;7", "chatsan-tearfully-salutes"},
{ "хз", "chatsan-shrugs" },
{ "хз.", "chatsan-shrugs" },
{ "idk", "chatsan-shrugs" },
{ "idk.", "chatsan-shrugs" },
{ ";)", "chatsan-winks" },
{ ";]", "chatsan-winks" },
{ "(;", "chatsan-winks" },
Expand Down
16 changes: 15 additions & 1 deletion Tools/actions_changelogs_since_last_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
GITHUB_TOKEN = os.environ["GITHUB_TOKEN"]
CHANGELOG_DIR = os.environ["CHANGELOG_DIR"]
CHANGELOG_DISCORD_WEBHOOK = os.environ["CHANGELOG_DISCORD_WEBHOOK"]
PR_NUMBER = os.environ["PR_NUMBER"]

# https://discord.com/developers/docs/resources/webhook
DISCORD_SPLIT_LIMIT = 2000
Expand All @@ -40,8 +41,21 @@ def main():
session.headers["Accept"] = "Accept: application/vnd.github+json"
session.headers["X-GitHub-Api-Version"] = "2022-11-28"

resp = session.get(f"{GITHUB_API_URL}/repos/{GITHUB_REPOSITORY}/pulls/{PR_NUMBER}")
resp.raise_for_status()
last_sha = resp.json()["merge_commit_sha"]

index = int(PR_NUMBER)
while True:
index -= 1
resp = session.get(f"{GITHUB_API_URL}/repos/{GITHUB_REPOSITORY}/pulls/{index}")
resp.raise_for_status()
merge_info = resp.json()
if merge_info["merged_at"]:
last_sha = merge_info["merge_commit_sha"]
break

most_recent = get_most_recent_workflow(session)
last_sha = most_recent['head_commit']['id']
print(f"Last successful publish job was {most_recent['id']}: {last_sha}")
last_changelog = yaml.safe_load(get_last_changelog(session, last_sha))
with open(CHANGELOG_DIR, "r") as f:
Expand Down
2 changes: 1 addition & 1 deletion Tools/changelogs/changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function writeChangelog(entry) {
fs.writeFileSync(
`../../${process.env.CHANGELOG_DIR}`,
"Entries:\n" +
yaml.dump(data.Entries, { indent: 2 }).replace(/^---/, "")
yaml.dump(data.Entries, { indent: 2 }).replace(/^---/, "")
);
}

Expand Down

0 comments on commit 3c55b3b

Please sign in to comment.