Skip to content

Commit

Permalink
#none fixed /events cmd on empty api data
Browse files Browse the repository at this point in the history
  • Loading branch information
jgaribsin committed Mar 17, 2024
1 parent 3c488e5 commit 13666e1
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/commands/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,19 @@ const subcmds: {[key: string]: (job: CommandInteraction) => Promise<void>} = {

async function all(interaction: CommandInteraction) {
const events = getAllEvents();

if (events.length === 0) {
await interaction.editReply({
embeds: [
new EmbedBuilder()
.setTitle('Zero Active Events')
.setDescription('Please check back later for new galactic events!')
.setThumbnail(factionSprites['Humans'])
.setFooter({text: FOOTER_MESSAGE})
.setTimestamp(),
],
});
return;
}
const embeds: EmbedBuilder[] = [];
for (const event of events) {
const title = event.title;
Expand All @@ -59,6 +71,19 @@ async function all(interaction: CommandInteraction) {

async function latest(interaction: CommandInteraction) {
const event = getLatestEvent();
if (!event) {
await interaction.editReply({
embeds: [
new EmbedBuilder()
.setTitle('Zero Active Events')
.setDescription('Please check back later for new galactic events!')
.setThumbnail(factionSprites['Humans'])
.setFooter({text: FOOTER_MESSAGE})
.setTimestamp(),
],
});
return;
}
const title = event.title;
let message = event.message;

Expand Down

0 comments on commit 13666e1

Please sign in to comment.