Compare commits

..

No commits in common. "0029e4a4561656f4dda7c2dd4d4fd3c129b2f52c" and "2ddb170b48f0b827341321dd8d34256f4901db8e" have entirely different histories.

5 changed files with 46 additions and 31 deletions

View file

@ -7,7 +7,7 @@
# any secret values. # any secret values.
BOT_TOKEN= BOT_TOKEN=
BOT_VER=0.3.1 BOT_VER=0.3.0 DEV
BOT_AUTHOR=Vylpes BOT_AUTHOR=Vylpes
BOT_OWNERID=147392775707426816 BOT_OWNERID=147392775707426816
BOT_CLIENTID=682942374040961060 BOT_CLIENTID=682942374040961060

View file

@ -7,7 +7,7 @@
# any secret values. # any secret values.
BOT_TOKEN= BOT_TOKEN=
BOT_VER=0.3.1 BOT_VER=0.3.0
BOT_AUTHOR=Vylpes BOT_AUTHOR=Vylpes
BOT_OWNERID=147392775707426816 BOT_OWNERID=147392775707426816
BOT_CLIENTID=1093810443589529631 BOT_CLIENTID=1093810443589529631

View file

@ -7,7 +7,7 @@
# any secret values. # any secret values.
BOT_TOKEN= BOT_TOKEN=
BOT_VER=0.3.1 BOT_VER=0.3.0 BETA
BOT_AUTHOR=Vylpes BOT_AUTHOR=Vylpes
BOT_OWNERID=147392775707426816 BOT_OWNERID=147392775707426816
BOT_CLIENTID=1147976642942214235 BOT_CLIENTID=1147976642942214235

View file

@ -27,11 +27,15 @@ export default class Reroll extends ButtonEvent {
return; return;
} }
try {
let image: Buffer; let image: Buffer;
const imageFileName = randomCard.card.path.split("/").pop()!; const imageFileName = randomCard.card.path.split("/").pop()!;
try {
image = readFileSync(path.join(process.cwd(), 'cards', randomCard.card.path)); image = readFileSync(path.join(process.cwd(), 'cards', randomCard.card.path));
} catch {
await interaction.reply(`Unable to fetch image for card ${randomCard.card.id}`);
return;
}
await interaction.deferReply(); await interaction.deferReply();
@ -46,18 +50,22 @@ export default class Reroll extends ButtonEvent {
const row = CardDropHelperMetadata.GenerateDropButtons(randomCard, claimId, interaction.user.id); const row = CardDropHelperMetadata.GenerateDropButtons(randomCard, claimId, interaction.user.id);
try {
await interaction.editReply({ await interaction.editReply({
embeds: [ embed ], embeds: [ embed ],
files: [ attachment ], files: [ attachment ],
components: [ row ], components: [ row ],
}); });
CoreClient.ClaimId = claimId;
} catch (e) { } catch (e) {
console.error(e); console.error(e);
await interaction.editReply(`Unable to send next drop. Please try again, and report this if it keeps happening. (${randomCard.card.id})`); if (e instanceof DiscordAPIError) {
await interaction.editReply(`Unable to send next drop. Please try again, and report this if it keeps happening. Code: ${e.code}`);
} else {
await interaction.editReply(`Unable to send next drop. Please try again, and report this if it keeps happening. Code: UNKNOWN`);
} }
} }
CoreClient.ClaimId = claimId;
}
} }

View file

@ -35,11 +35,15 @@ export default class Drop extends Command {
return; return;
} }
try {
let image: Buffer; let image: Buffer;
const imageFileName = randomCard.card.path.split("/").pop()!; const imageFileName = randomCard.card.path.split("/").pop()!;
try {
image = readFileSync(path.join(process.cwd(), 'cards', randomCard.card.path)); image = readFileSync(path.join(process.cwd(), 'cards', randomCard.card.path));
} catch {
await interaction.reply(`Unable to fetch image for card ${randomCard.card.id}`);
return;
}
await interaction.deferReply(); await interaction.deferReply();
@ -54,19 +58,22 @@ export default class Drop extends Command {
const row = CardDropHelperMetadata.GenerateDropButtons(randomCard, claimId, interaction.user.id); const row = CardDropHelperMetadata.GenerateDropButtons(randomCard, claimId, interaction.user.id);
try {
await interaction.editReply({ await interaction.editReply({
embeds: [ embed ], embeds: [ embed ],
files: [ attachment ], files: [ attachment ],
components: [ row ], components: [ row ],
}); });
CoreClient.ClaimId = claimId;
} catch (e) { } catch (e) {
console.error(e); console.error(e);
await interaction.editReply(`Unable to send next drop. Please try again, and report this if it keeps happening. (${randomCard.card.id})`); if (e instanceof DiscordAPIError) {
await interaction.editReply(`Unable to send next drop. Please try again, and report this if it keeps happening. Code: ${e.code}`);
} else {
await interaction.editReply(`Unable to send next drop. Please try again, and report this if it keeps happening. Code: UNKNOWN`);
}
} }
CoreClient.ClaimId = claimId;
} }
} }