mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: added basic infrastructure for ratings command
This commit is contained in:
1 parent
9419aec116
commit
aa6011b18d
40 files changed
+227
-96
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { CacheType, ChatInputCommandInteraction } from 'discord.js';
|
||||
import { RegionDomain } from '../../constants/regions';
|
||||
import { Region } from '../../constants/regions';
|
||||
import listPlayers, {
|
||||
usernamePatternWithoutPosition,
|
||||
} from '../blitz/listPlayers';
|
||||
@@ -8,7 +8,7 @@ import throwError from '../node/throwError';
|
||||
export const serverAndIdPattern = /(com|eu|asia)\/[0-9]+/;
|
||||
|
||||
export interface ResolvedPlayer {
|
||||
server: RegionDomain;
|
||||
region: Region;
|
||||
id: number;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ export default async function resolvePlayerFromCommand(
|
||||
if (serverAndIdPattern.test(username)) {
|
||||
const [server, accountId] = username.split('/');
|
||||
return {
|
||||
server: server as RegionDomain,
|
||||
region: server as Region,
|
||||
id: Number(accountId),
|
||||
} satisfies ResolvedPlayer;
|
||||
} else {
|
||||
@@ -39,7 +39,7 @@ export default async function resolvePlayerFromCommand(
|
||||
|
||||
if (accounts[0]) {
|
||||
return {
|
||||
server: accounts[0].server,
|
||||
region: accounts[0].server,
|
||||
id: accounts[0].account_id,
|
||||
} satisfies ResolvedPlayer;
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user