Skip to content

Commit

Permalink
Merge pull request #305 from the-hideout/price-error-fix
Browse files Browse the repository at this point in the history
Fix error in price command
  • Loading branch information
Razzmatazzz authored Aug 26, 2024
2 parents e3cd960 + 3ace440 commit 38ced3c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
10 changes: 9 additions & 1 deletion bot.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import autocomplete from './modules/autocomplete.mjs';
//import { updateChoices } from './modules/game-data.mjs';
import { initShardMessenger, respondToParentMessage } from './modules/shard-messenger.mjs';
import sendWebhook from './modules/webhook.mjs';
import progress from './modules/progress-shard.mjs';

process.env.IS_SHARD = 'true';

Expand Down Expand Up @@ -106,6 +107,13 @@ discordClient.on('interactionCreate', async interaction => {
try {
await command.default.execute(interaction);
} catch (error) {
const { lang, gameMode } = await progress.getInteractionSettings(interaction).catch(error => {
console.log('Error getting lang and gameMode for error', error);
return {
lang: 'unknown',
gameMode: 'unknown',
};
});
console.error(`Error executing /${interaction.commandName} command on shard ${discordClient.shard.ids[0]}`, error);
console.error(`Command duration:`, new Date() - interaction.start, 'ms');
if (error.message === 'Unknown Message') {
Expand All @@ -126,7 +134,7 @@ discordClient.on('interactionCreate', async interaction => {
sendWebhook({
title: `Error running /${interaction.commandName} command on shard ${discordClient.shard.ids[0]}`,
message: error.stack,
footer: `Command invoked by @${interaction.member.user.username} | ${interaction.member.guild ? `Server: ${interaction.member.guild.name}` : 'DM'}`,
footer: `Command invoked by @${interaction.member.user.username} | ${interaction.member.guild ? `Server: ${interaction.member.guild.name}` : 'DM'} | lang: ${lang} | mode ${gameMode}`,
files: [
new AttachmentBuilder(
Buffer.from(JSON.stringify(interaction.options, null, 4), 'utf8'),
Expand Down
7 changes: 6 additions & 1 deletion commands/boss.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,14 @@ const defaultFunction = {

mapEmbed.addFields(
{ name: `${t('Spawn Chance')} 🎲`, value: `${bossData.spawnChance * 100}%`, inline: true },
{ name: `${t('Spawn Locations')} πŸ“`, value: spawnLocations, inline: true },
//{ name: `${t('Spawn Locations')} πŸ“`, value: spawnLocations, inline: true },
//{ name: 'Spawn Time πŸ•’', value: spawnTime, inline: true },
);
if (spawnLocations) {
mapEmbed.addFields(
{ name: `${t('Spawn Locations')} πŸ“`, value: spawnLocations, inline: true },
);
}
if (escortNames) {
mapEmbed.addFields({name: `${t('Escort')} πŸ’‚`, value: escortNames, inline: true});
}
Expand Down
1 change: 0 additions & 1 deletion commands/price.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ const defaultFunction = {
const itemname = `[${matchedItems[i].name}](${matchedItems[i].link})`;

if (itemname.length + 2 + otheritems.length > 2048) {
ending.
ending.setFooter({text: `${matchedItems.length-i} ${t('additional results not shown.')} | ${gameModeLabel}`});

break;
Expand Down

0 comments on commit 38ced3c

Please sign in to comment.