loads of changes, most mod commands done
diff --git a/src/utils/confirmationMessage.ts b/src/utils/confirmationMessage.ts
index 2b769bb..5464e31 100644
--- a/src/utils/confirmationMessage.ts
+++ b/src/utils/confirmationMessage.ts
@@ -1,5 +1,6 @@
import Discord, { CommandInteraction, MessageActionRow, Message } from "discord.js";
import EmojiEmbed from "./generateEmojiEmbed.js"
+import getEmojiByName from "./getEmojiByName.js";
class confirmationMessage {
interaction: CommandInteraction;
@@ -22,8 +23,8 @@
setDescription(description: string) { this.description = description; return this }
setColor(color: string) { this.color = color; return this }
- async send() {
- let m = await this.interaction.reply({
+ async send(editOnly?: boolean) {
+ let object = {
embeds: [
new EmojiEmbed()
.setEmoji(this.emoji)
@@ -36,16 +37,24 @@
new Discord.MessageButton()
.setCustomId("yes")
.setLabel("Yes")
- .setStyle("SUCCESS"),
+ .setStyle("SUCCESS")
+ .setEmoji(getEmojiByName("CONTROL.TICK", "id")),
new Discord.MessageButton()
.setCustomId("no")
- .setLabel("Cancel") // TODO:
+ .setLabel("Cancel")
.setStyle("DANGER")
+ .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
])
],
ephemeral: true,
fetchReply: true
- })
+ }
+ let m;
+ if ( editOnly ) {
+ m = await this.interaction.editReply(object);
+ } else {
+ m = await this.interaction.reply(object)
+ }
let component;
try {
component = await (m as Message).awaitMessageComponent({filter: (m) => m.user.id === this.interaction.user.id, time: 2.5 * 60 * 1000});
diff --git a/src/utils/getEmojiByName.ts b/src/utils/getEmojiByName.ts
index 64c7ede..0ec7cd6 100644
--- a/src/utils/getEmojiByName.ts
+++ b/src/utils/getEmojiByName.ts
@@ -1,11 +1,20 @@
import emojis from '../config/emojis.json' assert {type: 'json'};
-function getEmojiByName(name: string): string {
+function getEmojiByName(name: string, format?: string): string {
let split = name.split(".");
let id = emojis
split.forEach(part => {
id = id[part];
});
+ if ( format === "id" ) {
+ if (id === undefined) return "0";
+ return id.toString();
+ }
+ if (id === undefined) {
+ return `<a:a:946346549271732234>`
+ } else if (id.toString().startsWith("a")) {
+ return `<a:a:${id.toString().slice(0, -1)}>`
+ }
return `<:a:${id}>`;
}