Skip to content

Commit

Permalink
Merge pull request #3 from bl3rune/name-override
Browse files Browse the repository at this point in the history
Fix environment variables not applying correctly
  • Loading branch information
bl3rune authored Feb 5, 2023
2 parents 0d6c9f4 + 5b059ac commit 988aa97
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gamedig-discord-bot",
"version": "1.2.0",
"version": "1.2.1",
"main": "dist/index.js",
"scripts": {
"build": "gulp",
Expand Down
16 changes: 11 additions & 5 deletions src/services/discord-publisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ private serverUp: Map<Type,boolean>;
let activity = this.buildActivityText(s);

if (activities != '') {
activities = activities + ' ///// ';
activities = activities + activitySeperator;
}
activities = activities + activity;
if (!this.serverUp.get(s.game)) {
console.log(`${s.game} : ${activity}`);
console.log(status);
this.announce(s.game, true);
}
this.serverUp.set(s.game,true);
Expand Down Expand Up @@ -121,12 +122,17 @@ private serverUp: Map<Type,boolean>;

let nameOverride = process.env['NAME_OVERRIDE' + '.' + response.game];
if (nameOverride) {
name = `${(status as any)[nameOverride]}`;
name = nameOverride;
}

let rawNameOverride = process.env['RAW_NAME_OVERRIDE' + '.' + response.game];
if (rawNameOverride && name === '') {
name = `${raw[rawNameOverride]}`;
let nameField = process.env['NAME_FIELD' + '.' + response.game];
if (nameField && name === '') {
name = `${(status as any)[nameField]}`;
}

let rawNameField = process.env['RAW_NAME_FIELD' + '.' + response.game];
if (rawNameField && name === '') {
name = `${raw[rawNameField]}`;
}

if (name === '') {
Expand Down

0 comments on commit 988aa97

Please sign in to comment.