functional queue
This commit is contained in:
12
src/api.ts
12
src/api.ts
@@ -7,9 +7,11 @@ import http from 'https';
|
||||
//while names cant have spaces, the name slot in ogtitle could be shown as "No Player Name" which has spaces
|
||||
const uniteApiRegex = {
|
||||
//$1 = name, $2 = id
|
||||
ogtitle: /Unite API - ([\w\d ]+) \((.*)\)/,
|
||||
ogtitle: /unite api - ([\w\d ]+) \((.*)\)/i,
|
||||
//$1 = level, $2 = rank, $3 = elo, $4 = battles, $5 = wins, $6 = win rate
|
||||
ogdescription: /Pokémon Unite : Lv.(\d+) (\w+) \((\d+)\)\n Battles : (\d+)\n Wins : (\d+)\n Win Rate : (\d+)%/,
|
||||
ogdescription: /pokémon unite : lv\.(\d+) (\w+) \((\d+)\)\n battles : (\d+)\n Wins : (\d+)\n win rate : (\d+)%/i,
|
||||
//for non-masters (no elo)
|
||||
//ogdescription: /pokémon unite : lv\.(\d+) (\w+): class (\d+) *\n battles : (\d+) *\n wins : (\d+) *\n win rate : (\d+)%/i,
|
||||
}
|
||||
|
||||
type uniteApiData = {
|
||||
@@ -151,13 +153,13 @@ export async function getPlayer(name: string): Promise<uniteApiData|null> {
|
||||
|
||||
export async function getPlayerInteraction(interaction: CommandInteraction): Promise<void> {
|
||||
let username = interaction.options.getString('username', true);
|
||||
interaction.deferReply();
|
||||
await interaction.deferReply();
|
||||
|
||||
let data = await getPlayer(username);
|
||||
if (data === null)
|
||||
await interaction.reply('Unable to find user');
|
||||
await interaction.editReply('Unable to find user');
|
||||
else
|
||||
await interaction.reply('```\n'+JSON.stringify(data, null, 2)+'\n```');
|
||||
await interaction.editReply('```\n'+JSON.stringify(data, null, 2)+'\n```');
|
||||
}
|
||||
|
||||
//await getPlayer('IanWhysp')
|
||||
Reference in New Issue
Block a user