Skip to content

Commit 30d3b08

Browse files
authored
Merge pull request #3515 from crowbartools/v5
5.66.5 Release
2 parents 3f67d86 + bdb6848 commit 30d3b08

5 files changed

Lines changed: 61 additions & 54 deletions

File tree

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
name: Bump dev version on release
22

33
on:
4-
release:
5-
types: [released]
4+
release:
5+
types: [released]
66

77
jobs:
8-
bumpversion:
9-
name: Bump version
10-
runs-on: ubuntu-latest
11-
steps:
12-
- name: Checkout repo
13-
uses: actions/checkout@v5
14-
with:
15-
ref: v5
8+
bumpversion:
9+
name: Bump version
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repo
13+
uses: actions/checkout@v5
14+
with:
15+
ref: v5
1616

17-
- name: Setup Nodejs
18-
uses: actions/setup-node@v5
19-
with:
20-
node-version: latest
17+
- name: Setup Nodejs
18+
uses: actions/setup-node@v5
19+
with:
20+
node-version: latest
2121

22-
- name: Git config
23-
run: |
24-
git config --local user.email "github-actions[bot]@users.noreply.github.com"
25-
git config --local user.name "github-actions[bot]"
22+
- name: Git config
23+
run: |
24+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
25+
git config --local user.name "github-actions[bot]"
2626
27-
- name: Update patch version
28-
run: npm version patch
27+
- name: Update patch version
28+
run: npm version patch
2929

30-
- name: Push
31-
run: git push
30+
- name: Push
31+
run: git push --force

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "firebotv5",
3-
"version": "5.66.4",
3+
"version": "5.66.5",
44
"description": "Powerful all-in-one bot for Twitch streamers.",
55
"main": "build/main.js",
66
"scripts": {

src/backend/pronouns/pronoun-manager.ts

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -51,41 +51,44 @@ class FirebotPronounManager {
5151
}
5252
}
5353

54-
async getUserPronouns(username: string): Promise<UserPronoun | undefined> {
55-
const cachedPronouns = this._userPronounCache.get<UserPronoun>(username);
54+
async getUserPronouns(username: string, fallback: string = "they/them"): Promise<UserPronoun | undefined> {
55+
if (!!username?.length) {
56+
const cachedPronouns = this._userPronounCache.get<UserPronoun>(username);
5657

57-
if (cachedPronouns) {
58-
return cachedPronouns;
59-
} else if (this._userNoPronounCache[username] === true) {
60-
return;
61-
}
62-
63-
const url = `${PRONOUN_SERVICE_BASE_URL}users/${username}?t=${new Date().getTime()}`;
64-
65-
try {
66-
const response = await this.callUrl(url);
67-
68-
if (response.ok) {
69-
const pronouns = await response.json() as UserPronounResponse;
70-
this._userPronounCache.set<UserPronoun>(username, {
71-
primary: pronouns.pronoun_id,
72-
secondary: pronouns.alt_pronoun_id
73-
});
74-
return this._userPronounCache.get<UserPronoun>(username);
75-
} else if (response.status === 404) {
76-
logger.debug(`No pronouns set for ${username}`);
77-
this._userNoPronounCache.set(username, true);
58+
if (cachedPronouns) {
59+
return cachedPronouns;
60+
} else if (this._userNoPronounCache[username] === true) {
7861
return;
7962
}
80-
} catch (error) {
81-
logger.warn(`Unable to get pronouns for ${username}`, error);
63+
64+
const url = `${PRONOUN_SERVICE_BASE_URL}users/${username}?t=${new Date().getTime()}`;
65+
66+
try {
67+
const response = await this.callUrl(url);
68+
69+
if (response.ok) {
70+
const pronouns = await response.json() as UserPronounResponse;
71+
this._userPronounCache.set<UserPronoun>(username, {
72+
primary: pronouns.pronoun_id,
73+
secondary: pronouns.alt_pronoun_id
74+
});
75+
return this._userPronounCache.get<UserPronoun>(username);
76+
} else if (response.status === 404) {
77+
logger.debug(`No pronouns set for ${username}`);
78+
this._userNoPronounCache.set(username, true);
79+
}
80+
} catch (error) {
81+
logger.warn(`Unable to get pronouns for ${username}`, error);
82+
}
8283
}
8384

84-
return;
85+
return !!fallback?.length
86+
? { primary: fallback.replace("/", "") }
87+
: undefined;
8588
};
8689

87-
async getUserFriendlyPronounString(username: string, type: "subject" | "object" | "both" = "both") {
88-
const pronouns = await this.getUserPronouns(username);
90+
async getUserFriendlyPronounString(username: string, fallback: string = "they/them", type: "subject" | "object" | "both" = "both") {
91+
const pronouns = await this.getUserPronouns(username, fallback);
8992

9093
if (pronouns) {
9194
return this.getFriendlyPronounString(pronouns.primary, pronouns.secondary, type);

src/backend/variables/builtin/user/pronouns.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ const model : ReplaceVariable = {
2929
pronounNumber: number | string = 0,
3030
fallback : string = "they/them"
3131
) => {
32+
if (!username?.length) {
33+
username = trigger.metadata.username;
34+
}
35+
3236
if (typeof pronounNumber === 'string' || <unknown>pronounNumber instanceof String) {
3337
pronounNumber = Number(`${pronounNumber}`);
3438
}
@@ -57,7 +61,7 @@ const model : ReplaceVariable = {
5761
break;
5862
}
5963

60-
const pronoun = await FirebotPronounManager.getUserFriendlyPronounString(username, type);
64+
const pronoun = await FirebotPronounManager.getUserFriendlyPronounString(username, fallback, type);
6165

6266
return !!pronoun?.length
6367
? pronoun

0 commit comments

Comments
 (0)