Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bot.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -134,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'} | lang: ${lang} | mode ${gameMode}`,
footer: `Command invoked by @${interaction.member?.user?.username ?? 'Unknown User'} | ${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
2 changes: 1 addition & 1 deletion commands/goons.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const defaultFunction = {
json: {
map: selectedMap.nameId,
timestamp: new Date().getTime(),
accountId: parseInt(interaction.user.id.slice(-10)),
discordId: interaction.user.id,
gameMode: gameMode,
},
}).json();
Expand Down
13 changes: 7 additions & 6 deletions modules/progress.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,9 @@ const buildDefaultProgress = id => {
restock: {},
},
};
const gameModes = ['regular', 'pve'];
for (const gameMode of gameModes) {
progress[gameMode] = getDefaultGameModeProgress();
progress.alerts[gameMode] = [];
progress.alerts.restock[gameMode] = [];
}
return progress;
};
Expand Down Expand Up @@ -167,9 +166,14 @@ const getUserProgress = async id => {
if (Array.isArray(userProgress[id].alerts.restock)) {
userProgress[id].alerts.restock = {
regular: userProgress[id].alerts.restock,
pve: [],
};
}
for (const gameMode of gameModes) {
if (!userProgress[id].alerts.restock[gameMode]) {
userProgress[id].alerts.restock[gameMode] = [];
}

}
return userProgress[id];
};

Expand Down Expand Up @@ -249,9 +253,6 @@ const addRestockAlert = async (id, traders, locale) => {
if (locale) {
prog.locale = locale;
}
if (!prog.alerts.restock[gameMode]) {
prog.alerts.restock[gameMode] = [];
}
const restockAlerts = prog.alerts.restock[gameMode];
for (const traderId of traders) {
if (!restockAlerts.includes(traderId)) restockAlerts.push(traderId);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "The Tarkov.dev's Escape from Tarkov Discord bot",
"main": "index.mjs",
"engines": {
"node": "20.*"
"node": "22.*"
},
"repository": {
"type": "git",
Expand Down
Loading