Skip to content

Commit

Permalink
Update The bot to latest Configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
exatombe committed Jan 3, 2024
1 parent 45cd829 commit af91358
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
10 changes: 6 additions & 4 deletions src/bot/commands/ai/advanced/imagine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,16 @@ export default async function AdvancedImagine(command: CommandsBase, interaction
let files: AttachmentPayload[] = [];
let processed = bt.__({ phrase: "Generation started..", locale: interaction.locale }) + "\n";
if (stat.queue_position && stat.queue_position > 0) {
processed += bt.__({ phrase: "(Position in the queue: %s -", locale: interaction.locale }, String(stat.queue_position));
processed += bt.__({ phrase: "(Position in the queue: %s -", locale: interaction.locale }, String(stat.queue_position)) + "\n";
}
if (stat.waiting && stat.waiting > 0) {
processed += ` En attente: ${stat.waiting})\n`;
processed += bt.__({ phrase: "Waiting : %s", locale: interaction.locale }, String(stat.waiting));
processed += bt.__({ phrase: "Waiting : %s", locale: interaction.locale }, String(stat.waiting)) + "\n";
}
if(stat.finished && stat.finished > 0) {
processed += bt.__({ phrase: "Finished : %s", locale: interaction.locale }, String(stat.finished)) + "\n";
}
if (stat.processing && stat.processing > 0) {
processed += bt.__({ phrase: "Processing : %s", locale: interaction.locale }, String(stat.processing));
processed += bt.__({ phrase: "Processing : %s", locale: interaction.locale }, String(stat.processing)) + "\n";
processed += bt.__({ phrase: "(Estimated waiting time: <t:%s:R>)", locale: interaction.locale }, String(parseInt((((Date.now() + (wait_time) * 1000)) / 1000).toString())));
}
if (stat.kudos && stat.kudos > 0) {
Expand Down
6 changes: 4 additions & 2 deletions src/bot/commands/ai/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default async function Help(command: CommandsBase, interaction: CommandIn
return cmd.name === interaction.commandName;
});
if (!AiCommand) return interaction.reply({
content: bt.__({ phrase: "An error occurred, command not found", locale: interaction.locale }),
content: bt.__({ phrase: "An error occurred, command not found", locale: interaction.locale }),
flags: MessageFlags.Ephemeral
});
let options = AiCommand.options;
Expand Down Expand Up @@ -38,7 +38,9 @@ export default async function Help(command: CommandsBase, interaction: CommandIn

}).join("\n");

let description = bt.__("Decriptions of commands\n%s\nFor the login command </%s login:%s>, you will first have to go to [AI Horde](https://stablehorde.net/register) enter a nickname, then copy the API key you will just have to paste it into the modal that will open", optionsMapped, AiCommand.name, AiCommand.id);
let description = bt.__({
phrase: "Decriptions of commands\n%s\nFor the login command </%s login:%s>, you will first have to go to [AI Horde](https://stablehorde.net/register) enter a nickname, then copy the API key you will just have to paste it into the modal that will open", locale: interaction.locale
}, optionsMapped, AiCommand.name, AiCommand.id);
interaction.reply({
embeds: [
new EmbedBuilder()
Expand Down
10 changes: 6 additions & 4 deletions src/bot/commands/ai/imagine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,16 @@ export default async function Imagine(command: CommandsBase, interaction: Comman
let files: AttachmentPayload[] = [];
let processed = bt.__({ phrase: "Generation started..", locale: interaction.locale }) + "\n";
if (stat.queue_position && stat.queue_position > 0) {
processed += bt.__({ phrase: "(Position in the queue: %s -", locale: interaction.locale }, String(stat.queue_position));
processed += bt.__({ phrase: "(Position in the queue: %s -", locale: interaction.locale }, String(stat.queue_position)) + "\n";
}
if (stat.waiting && stat.waiting > 0) {
processed += ` En attente: ${stat.waiting})\n`;
processed += bt.__({ phrase: "Waiting : %s", locale: interaction.locale }, String(stat.waiting));
processed += bt.__({ phrase: "Waiting : %s", locale: interaction.locale }, String(stat.waiting)) + "\n";
}
if(stat.finished && stat.finished > 0) {
processed += bt.__({ phrase: "Finished : %s", locale: interaction.locale }, String(stat.finished)) + "\n";
}
if (stat.processing && stat.processing > 0) {
processed += bt.__({ phrase: "Processing : %s", locale: interaction.locale }, String(stat.processing));
processed += bt.__({ phrase: "Processing : %s", locale: interaction.locale }, String(stat.processing)) + "\n";
processed += bt.__({ phrase: "(Estimated waiting time: <t:%s:R>)", locale: interaction.locale }, String(parseInt((((Date.now() + (wait_time) * 1000)) / 1000).toString())));
}
if (stat.kudos && stat.kudos > 0) {
Expand Down
12 changes: 8 additions & 4 deletions src/bot/commands/deleteMessage.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import Bot from "..";
import { ApplicationCommandType, CacheType, ContextMenuCommandBuilder, ContextMenuCommandInteraction, Routes } from "discord.js";
import baseCommands from "./baseCommands";
import { bt } from "../../main";
const MessageCommand = new ContextMenuCommandBuilder()
.setName("Delete Message")
.setNameLocalizations({
fr: "Supprimer le message",
})
.setType(ApplicationCommandType.Message)
.toJSON();

Expand All @@ -14,7 +18,7 @@ export class DeleteMessage extends baseCommands {
async run(interaction: ContextMenuCommandInteraction<CacheType>) {
if (interaction.isMessageContextMenuCommand()) {
if(!interaction.targetMessage.interaction) return interaction.reply({
content: "Ce message ne peut pas être supprimé",
content: bt.__({ phrase: "This message is not a command", locale: interaction.locale }),
ephemeral: true
});
if (interaction.targetMessage.interaction.user.id === interaction.user.id) {
Expand All @@ -23,16 +27,16 @@ export class DeleteMessage extends baseCommands {
});
interaction.deleteReply(interaction.targetMessage.id).then(() => {
i.edit({
content: "Message supprimé",
content: bt.__({ phrase: "Message deleted", locale: interaction.locale }),
});
}).catch((err) => {
i.edit({
content: "Une erreur est survenue",
content: bt.__({ phrase: "An error occurred, the message could not be deleted", locale: interaction.locale }),
});
});
} else {
interaction.reply({
content: "Vous ne pouvez pas supprimer ce message",
content: bt.__({ phrase: "You can't delete this message", locale: interaction.locale }),
ephemeral: true
});
}
Expand Down

0 comments on commit af91358

Please sign in to comment.