Skip to content

Commit

Permalink
Minor update (it will nescessary work)
Browse files Browse the repository at this point in the history
  • Loading branch information
exatombe committed Dec 29, 2023
1 parent a6350fd commit 9693485
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/bot/commands/ai/info.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { ActionRowBuilder, CommandInteraction, CommandInteractionOptionResolver, EmbedBuilder, MessageFlags, ModalBuilder, TextInputBuilder, TextInputStyle } from "discord.js";
import CommandsBase from "../baseCommands";

export default async function Info(command: CommandsBase, interaction: CommandInteraction) {
export default async function Info(command: CommandsBase, interaction: CommandInteraction) {
interaction.deferReply();
let options = interaction.options;
let InteractionUser = interaction.user;
let notTheCurrentUser = false;
Expand All @@ -12,24 +13,28 @@ export default async function Info(command: CommandsBase, interaction: CommandIn
notTheCurrentUser = true;
}
}

interaction.editReply({
content: "Recherche en cours de l'utilisateur dans la base de donnée",
});
let userDatabase = await command.client.database.users.findFirst({
where: {
id: InteractionUser.id
}
});
if (!userDatabase) return interaction.reply({
if (!userDatabase) return interaction.editReply({
content: notTheCurrentUser ? "L'utilisateur n'est pas enregistré" : "Vous n'êtes pas enregistré" + `, ${notTheCurrentUser ? "il doit s'" : "vous devez vous"} enregistrer avec la commande </${interaction.commandName} login:${interaction.commandId}>`,
flags: MessageFlags.Ephemeral
});
interaction.editReply({
content: "Recherche en cours de l'utilisateur dans l'API",
});
let token = command.client.decryptString(userDatabase.horde_token);
interaction.deferReply();
let ai = command.client.aiHorde;
try {
let user = await ai.findUser({
token
});
interaction.editReply({
content:"",
embeds: [
new EmbedBuilder()
.setTitle(`Info de ${user.username}`)
Expand Down

0 comments on commit 9693485

Please sign in to comment.