Skip to content
This repository was archived by the owner on Jun 4, 2025. It is now read-only.

Commit 80e7750

Browse files
committed
Add option to not @ping when sending auto daily shop
1 parent 5460029 commit 80e7750

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

discord/alerts.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,12 @@ export const sendDailyShop = async (id, shop, channelId, valorantUser, tryOnOthe
299299
return;
300300
}
301301

302+
const shouldPing = getSetting(id, "pingOnAutoDailyShop");
303+
const content = shouldPing ? `<@${id}>` : null;
304+
302305
const rendered = await renderOffers(shop, id, valorantUser, await VPEmoji(id, channel));
303306
await channel.send({
304-
content: `<@${id}>`,
307+
content,
305308
...rendered
306309
});
307310
}

misc/settings.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,26 @@ import {findKeyOfValue} from "./util.js";
77
export const settings = {
88
dailyShop: { // stores false or channel id
99
set: (value, interaction) => value === 'true' ? interaction.channelId : false,
10-
render: (value) => {
11-
if(value?.startsWith?.('#')) return value;
12-
return value ? `<#${value}>` : false;
10+
render: (value, interaction) => {
11+
const isChannelId = (v) => !isNaN(parseFloat(v));
12+
if(isChannelId(value)) return s(interaction).info.ALERT_IN_CHANNEL.f({ c: value });
13+
return value;
14+
},
15+
choices: (interaction) => {
16+
// [interaction.channel?.name || s(interaction).info.ALERT_IN_DM_CHANNEL, false]
17+
// if the channel name is not in cache, assume it's a DM channel
18+
let channelOption = interaction.channel?.name
19+
? s(interaction).info.ALERT_IN_CHANNEL_NAME.f({ c: interaction.channel.name })
20+
: s(interaction).info.ALERT_IN_DM_CHANNEL;
21+
return [channelOption, false];
1322
},
14-
choices: (interaction) => [`#${interaction.channel?.name || s(interaction).info.ALERT_IN_DM_CHANNEL}`, false],
1523
values: [true, false],
1624
default: false
1725
},
26+
pingOnAutoDailyShop: {
27+
values: [true, false],
28+
default: true
29+
},
1830
hideIgn: {
1931
values: [true, false],
2032
default: false

valorant/auth.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ export const redeemCookies = async (id, cookies) => {
363363
}
364364

365365
export const refreshToken = async (id, account=null) => {
366+
console.log(`Refreshing token for ${id}...`)
366367
let response = {success: false}
367368

368369
let user = getUser(id, account);

0 commit comments

Comments
 (0)