Skip to content

Commit

Permalink
fix(variables): currency variables to get user from trigger (#3021) (#…
Browse files Browse the repository at this point in the history
…3024)

* fix(variables): currency variables to get user from trigger

* add null check back
  • Loading branch information
CKY- authored Mar 10, 2025
1 parent 290917e commit ed15c77
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/backend/variables/builtin/currency/currency-rank.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReplaceVariable } from "../../../../types/variables";
import { ReplaceVariable, Trigger } from "../../../../types/variables";
import { OutputDataType, VariableCategory } from "../../../../shared/variable-constants";

import currencyAccess from "../../../currency/currency-access";
Expand All @@ -18,7 +18,8 @@ const model : ReplaceVariable = {
categories: [VariableCategory.USER, VariableCategory.NUMBERS],
possibleDataOutput: [OutputDataType.NUMBER]
},
evaluator: async (_, currencyName: string, username: string) => {
evaluator: async (trigger: Trigger, currencyName: string, username?: string) => {
username ??= trigger.metadata.username;
if (currencyName == null || username == null) {
return 0;
}
Expand Down
5 changes: 3 additions & 2 deletions src/backend/variables/builtin/currency/currency.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReplaceVariable } from "../../../../types/variables";
import { ReplaceVariable, Trigger } from "../../../../types/variables";
import { OutputDataType, VariableCategory } from "../../../../shared/variable-constants";

import currencyAccess from "../../../currency/currency-access";
Expand All @@ -18,7 +18,8 @@ const model : ReplaceVariable = {
categories: [VariableCategory.USER, VariableCategory.NUMBERS],
possibleDataOutput: [OutputDataType.NUMBER]
},
evaluator: async (_, currencyName: string, username: string) => {
evaluator: async (trigger: Trigger, currencyName: string, username?: string) => {
username ??= trigger.metadata.username;
if (currencyName == null || username == null) {
return 0;
}
Expand Down

0 comments on commit ed15c77

Please sign in to comment.