Skip to content

Commit

Permalink
fix: only convert id to number if integer, fix #9, fix #42
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Aug 13, 2024
1 parent 94b887c commit 86bbcce
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,12 @@ export class Internal {
private static prepareArg(name: string, params: string[], args: any[]) {
const fixedArg = Object.fromEntries(params.map((name, index) => [name, args[index]]))
for (const key in fixedArg) {
if (!name.includes('guild') && key.endsWith('_id')) fixedArg[key] = +fixedArg[key]
if (!name.includes('guild') && key.endsWith('_id')) {
const value = +fixedArg[key]
if (Math.abs(value) <= 1 << 32) {
fixedArg[key] = value
}
}
}
return fixedArg
}
Expand Down

0 comments on commit 86bbcce

Please sign in to comment.