Skip to content

Commit

Permalink
Merge branch 'up' into undo
Browse files Browse the repository at this point in the history
  • Loading branch information
emptyrivers committed Jan 13, 2025
2 parents 67bcd91 + 7cc5bd4 commit 0a33965
Show file tree
Hide file tree
Showing 170 changed files with 108,076 additions and 197,169 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ body:
options:
- Retail (Default)
- Beta (WoW 11.0)
- Classic
- Wrath of the Lich King Classic
- Classic Era
- Cataclysm Classic
validations:
required: true

Expand Down
16 changes: 16 additions & 0 deletions .github/pr-commenter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
comment:
on-update: edit

glob-options:
dot: true
snippets:
- id: advertise_build_url_{{ build_id }}
files:
- '**'
body: |
{{#build_id}}
An experimental build of WeakAuras with the changes in this pull request is available [here](https://nightly.link/{{{repository}}}/actions/artifacts/{{{build_id}}}.zip).
Build Time: {{{datestr}}}
Commit: {{{commitSha}}}
{{/build_id}}
{{^build_id}}Experimental build was unsuccessful. See the logs for details.{{/build_id}}
2 changes: 1 addition & 1 deletion .github/scripts/.last_wow_build
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c258dd0d5fe7de9f254611ee2b042e2b
0c245919b5294f12f4c65238b15f550c
2 changes: 1 addition & 1 deletion .github/scripts/.last_wow_classic_beta_build
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3da970fc387261a86bd967f89a9001fa
680af5eed81500f7e4e789a2e9e3c99b
2 changes: 1 addition & 1 deletion .github/scripts/.last_wow_classic_build
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c91609c69ed2ab39d44039390a1be969
694cee226aaf48ada4ad5024064bfc88
2 changes: 1 addition & 1 deletion .github/scripts/.last_wow_classic_era_build
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f1d29e07d5a51596e8462c5a4e0c3adb
46febe610077a30555618a85064e1ede
3 changes: 1 addition & 2 deletions .github/scripts/atlas_update.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ print("Creating atlas file for", version)

local versionMap = {
wow = "_Retail",
wow_classic = "_Wrath",
wow_classic_beta = "_Cata",
wow_classic = "_Cata",
wow_classic_era = "_Vanilla"
}

Expand Down
7 changes: 1 addition & 6 deletions .github/scripts/csv_to_lua.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ local releases = {
},
wow_classic = {
input = "wow_classic.csv",
output = "ModelPathsWrath.lua",
generate = true,
},
wow_classic_beta = {
input = "wow_classic_beta.csv",
output = "ModelPathsCata.lua",
generate = true,
},
Expand All @@ -27,7 +22,7 @@ local releases = {
require("table")

if not arg[1] or not releases[arg[1]] then
print(arg[0], "<wow|wow_classic|wow_classic_beta|wow_classic_era>")
print(arg[0], "<wow|wow_classic|wow_classic_era>")
return
end

Expand Down
210 changes: 210 additions & 0 deletions .github/scripts/discordupdate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
#!/usr/bin/env python3
import discord
import unicodedata
import os
import sys

API_TOKEN = os.environ['DISCORD_ACCESS_TOKEN']
CHANNEL_ID = 1259514390000963594
MSG_ID = 1260693417336504482
VALID_ROLES = {
1102916915653001258, # Premium Members
1103105933971836958, # Platinum Support
1103105132239007824, # Gold Support
1102916921004937286, # Silver Support
689250157799407890, # Twitch Subscriber: Tier 3
689250157799407798, # Twitch Subscriber: Tier 2
689250157799407691, # Twitch Subscriber: Tier 1
563427483555201024, # Twitch Subscriber,
507633262445723668, # Patron Bronze
507260546119368714, # Patron Silver
506449385543041034, # Patron Gold
512016261631442945, # Patreon Goldish
635471797583872020, # Patreon Platinum
635471886134018049, # Patreon Diamond
512014685088907265, # Patreon
402021459440173056, # Regular
172440752045948928, # Moderator,
294497613565263872, # Super Moderator
}

MSG = """React to this message to have your name included in the Thanks list inside the WeakAuras GUI.
The bot runs every monday, and you have to be a member of the discord for the bot to verify your status.
Note, that most symbols are filtered. Pure Latin, Chinese or Korean should be fine.
And the names are reviewed by a human.
The bot is experimental and will probably break a few times.
"""

commitBodyFile = open("commit-body.txt", "w", encoding="utf-8")
def commitMsgPrint(*text):
string = ' '.join(text)
commitBodyFile.write(string + "\n")
print(string)

def has_cj(text):
for char in text:
for name in ('CJK','CHINESE','KATAKANA',):
if unicodedata.name(char).startswith(name):
return True
return False

def has_k(text):
for char in text:
if unicodedata.name(char).startswith("HANGUL"):
return True
return False

def checkChar(char):
for name in ('CJK','CHINESE','KATAKANA', 'LATIN', 'DIGIT', 'SPACE', 'HANGUL', 'CYRILLIC'):
if unicodedata.name(char).startswith(name):
return True
return False

def cleanName(name):
newName = "".join([c for c in name if checkChar(c)]).strip()
newName = newName.replace("[=[", "")
newName = newName.replace("]=]", "")
newName = newName.replace("|", "")
newName = newName[:25]
if newName != name:
commitMsgPrint("* Changing \"" + name + "\" to \"" + newName + "\"")
return newName


class DiscordNameGather(discord.Client):
mode = ""
messagePerAuthor = {}

def hasRightRole(self, roles):
for r in roles:
if r.id in VALID_ROLES:
return True
return False

async def on_ready(self):
for guild in self.guilds:
for channel in guild.channels:
if channel.id == CHANNEL_ID:
if self.mode == "msg":
await self.sendMessage(channel)
elif self.mode == "edit":
await self.editMessage(channel)
elif self.mode == "history":
await self.parseHistory(channel)
else:
await self.parseReactions(channel, MSG_ID)

await client.close()

async def sendMessage(self, channel):
message = channel.send(MSG)
commitMsgPrint("Send message with id:", (await message).id)

async def editMessage(self, channel):
message = await channel.fetch_message(MSG_ID)
await message.edit(content = MSG)


# Old method of enumerating messages in a channel
async def parseHistory(self, channel):
messages = [message async for message in channel.history(limit=2000)]
for message in messages:
self.handleHistoryMessage(message)
self.writeFile()

def handleHistoryMessage(self, message):
if isinstance(message.author, discord.member.Member):
if self.hasRightRole(message.author.roles):
if message.author.id not in self.messagePerAuthor:
self.messagePerAuthor[message.author.id] = message.content
commitMsgPrint(message.author.name, ":", message.content)
else:
commitMsgPrint("Ignoring user, because they don't have the right role:", message.author.name)

async def parseDMChannel(self, channel):
messages = [message async for message in channel.history(limit=1)]
if messages:
return messages[0]
return None

# New method of parsing reactions to a singular message
async def parseReactions(self, channel, msgId):
message = await channel.fetch_message(msgId)
for reaction in message.reactions:
async for user in reaction.users():
if isinstance(user, discord.member.Member):
if self.hasRightRole(user.roles):
self.messagePerAuthor[user.id] = user.display_name
msg = await self.parseDMChannel(user)
if msg:
self.messagePerAuthor[user.id] = msg.content
commitMsgPrint("Using DM message:", user.display_name, "=>", msg.content)
else:
commitMsgPrint("Ignoring User (missing role): ", user.display_name)
self.writeFile()


def writeFile(self):
names = list(self.messagePerAuthor.values())

commitMsgPrint("")
commitMsgPrint("Cleaning names")
names = [cleanName(name) for name in names]
names = [name for name in names if name != ""]

names.sort(key=lambda y: y.lower())

cjnames = filter(has_cj, names)
knames = filter(lambda n: not has_cj(n) and has_k(n), names)
latinnames = filter(lambda n: not has_cj(n) and not has_k(n), names)

discordListFile = open("WeakAuras/DiscordList.lua", "w", encoding="utf-8")
discordListFile.write("if not WeakAuras.IsLibsOK() then return end\n")
discordListFile.write("---@type string\n")
discordListFile.write("local AddonName = ...\n")
discordListFile.write("---@class Private\n")
discordListFile.write("local Private = select(2, ...)\n")

discordListFile.write("Private.DiscordList = {\n")
commitMsgPrint("")
commitMsgPrint("Final Latin Names List")
for name in latinnames:
discordListFile.write(" [=[" + name + "]=],\n")
commitMsgPrint("*", name)
discordListFile.write("}\n")

commitMsgPrint("")
commitMsgPrint("Final China/Japan List")
discordListFile.write("Private.DiscordListCJ = {\n")
for name in cjnames:
discordListFile.write(" [=[" + name + "]=],\n")
commitMsgPrint("*", name)
discordListFile.write("}\n")

commitMsgPrint("")
commitMsgPrint("Final Korea List")
discordListFile.write("Private.DiscordListK = {\n")
for name in knames:
discordListFile.write(" [=[" + name + "]=],\n")
commitMsgPrint("*", name)
discordListFile.write("}\n")

discordListFile.close()


intents = discord.Intents.default()
intents.message_content = True
intents.members = True

client = DiscordNameGather(intents=intents)

if __name__ == "__main__":
if len(sys.argv) > 1:
client.mode = sys.argv[1]
print("Running in mode", client.mode)

client.run(API_TOKEN)


3 changes: 1 addition & 2 deletions .github/scripts/update-atlas-files.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

for version in wow wow_classic wow_classic_beta wow_classic_era
for version in wow wow_classic wow_classic_era
do
wget -O "UiTextureAtlas.csv" "https://wago.tools/db2/UiTextureAtlas/csv?branch=${version}"
wget -O "UiTextureAtlasMember.csv" "https://wago.tools/db2/UiTextureAtlasMember/csv?branch=${version}"
Expand All @@ -10,6 +10,5 @@ do
done

mv Atlas_Retail.lua ../../WeakAuras/
mv Atlas_Wrath.lua ../../WeakAuras/
mv Atlas_Vanilla.lua ../../WeakAuras/
mv Atlas_Cata.lua ../../WeakAuras/
2 changes: 1 addition & 1 deletion .github/scripts/update-model-paths.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ update_model_paths() {

download_file "https://wago.tools/api/builds/latest" ".wago_tools.json"

branches=("wow" "wow_classic" "wow_classic_beta" "wow_classic_era")
branches=("wow" "wow_classic" "wow_classic_era")

for branch in "${branches[@]}"
do
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/atlas-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

jobs:
atlasUpdate:
if: github.repository == 'WeakAuras/WeakAuras2'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/discord-update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Create Discord Name Update Pull Request

on:
schedule:
- cron: "0 10 * * 1"
workflow_dispatch:

jobs:
discordUpdate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install discord pip
run: |
pip install discord.py
shell: bash
- name: Update Discord list
run: |
/usr/bin/env python3 .github/scripts/discordupdate.py
shell: bash
env:
DISCORD_ACCESS_TOKEN: ${{ secrets.DISCORD_ACCESS_TOKEN}}

- name: Save Commit Body in Variable
uses: Stanzilla/[email protected]
id: readCommitBody
with:
path: commit-body.txt

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
branch: update-discordlist
commit-message: Update Discord List
title: Update Discord List
body: ${{ steps.readCommitBody.outputs.text }}
delete-branch: true
add-paths: WeakAuras/DiscordList.lua

1 change: 1 addition & 0 deletions .github/workflows/modelpaths-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

jobs:
modelPathsUpdate:
if: github.repository == 'WeakAuras/WeakAuras2'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
Loading

0 comments on commit 0a33965

Please sign in to comment.