#214 Add ephemeral reply upon rules success #231
1 changed files with 10 additions and 3 deletions
|
@ -32,13 +32,13 @@ export default class Rules extends Command {
|
||||||
const rules = JSON.parse(rulesFile) as IRules[];
|
const rules = JSON.parse(rulesFile) as IRules[];
|
||||||
|
|
||||||
const embeds: EmbedBuilder[] = [];
|
const embeds: EmbedBuilder[] = [];
|
||||||
|
|
||||||
rules.forEach(rule => {
|
rules.forEach(rule => {
|
||||||
Vylpes marked this conversation as resolved
|
|||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setColor(EmbedColours.Ok)
|
.setColor(EmbedColours.Ok)
|
||||||
.setTitle(rule.title || "Rules")
|
.setTitle(rule.title || "Rules")
|
||||||
.setDescription(rule.description ? rule.description.join("\n") : "*none*");
|
.setDescription(rule.description ? rule.description.join("\n") : "*none*");
|
||||||
|
|
||||||
if (rule.image) {
|
if (rule.image) {
|
||||||
embed.setImage(rule.image);
|
embed.setImage(rule.image);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,14 @@ export default class Rules extends Command {
|
||||||
if (!channel) {
|
if (!channel) {
|
||||||
Vylpes marked this conversation as resolved
VylpesTester
commented
Might be worth adding a failed embed here, just in case and so it doesn't fail Might be worth adding a failed embed here, just in case and so it doesn't fail
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await channel.send({ embeds: embeds });
|
await channel.send({ embeds: embeds });
|
||||||
|
|
||||||
|
const successEmbed = new EmbedBuilder()
|
||||||
|
.setColor(EmbedColours.Ok)
|
||||||
|
.setTitle("Success")
|
||||||
|
.setDescription("The rules have sent to this channel successfully");
|
||||||
|
|
||||||
|
await interaction.reply({ embeds: [ successEmbed], ephemeral: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue
Should we do anything if rules is empty? What about if the rules fail to be produced?