function to receive interaction

This commit is contained in:
2022-01-27 18:48:37 -06:00
parent 0a9918a508
commit a461fad0c1
2 changed files with 25 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
import * as cheerio from 'cheerio';
import { CommandInteraction } from 'discord.js';
import { IncomingMessage } from 'http';
import http from 'https';
@@ -148,4 +149,15 @@ export async function getPlayer(name: string): Promise<uniteApiData|null> {
return null;
}
export async function getPlayerInteraction(interaction: CommandInteraction): Promise<void> {
let username = interaction.options.getString('username', true);
interaction.deferReply();
let data = await getPlayer(username);
if (data === null)
await interaction.reply('Unable to find user');
else
await interaction.reply('```\n'+JSON.stringify(data, null, 2)+'\n```');
}
//await getPlayer('IanWhysp')