Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return sacrifice icon to item search #5405

Merged
merged 5 commits into from
Oct 11, 2023
Merged
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: 2 additions & 0 deletions src/lib/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@
for (const [roleID, chance, name] of rareRolesSrc) {
if (roll(chance / 10)) {
if (msg.member?.roles.cache.has(roleID)) continue;
if (!production) {

Check warning on line 59 in src/lib/events.ts

View workflow job for this annotation

GitHub Actions / ESLint

[eslint] reported by reviewdog 🐶 Unexpected any value in conditional. An explicit comparison or type cast is required. Raw Output: {"ruleId":"@typescript-eslint/strict-boolean-expressions","severity":1,"message":"Unexpected any value in conditional. An explicit comparison or type cast is required.","line":59,"column":9,"nodeType":"Identifier","messageId":"conditionErrorAny","endLine":59,"endColumn":19,"suggestions":[{"messageId":"conditionFixCastBoolean","fix":{"range":[2457,2467],"text":"(Boolean(production))"},"desc":"Explicitly cast value to a boolean (`Boolean(value)`)"}]}
return msg.channel.send(`${msg.author}, you would've gotten the **${name}** role.`);
}
msg.member?.roles.add(roleID);

Check warning on line 62 in src/lib/events.ts

View workflow job for this annotation

GitHub Actions / ESLint

[eslint] reported by reviewdog 🐶 Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator. Raw Output: {"ruleId":"@typescript-eslint/no-floating-promises","severity":1,"message":"Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator.","line":62,"column":4,"nodeType":"ExpressionStatement","messageId":"floatingVoid","endLine":62,"endColumn":34,"suggestions":[{"messageId":"floatingFixVoid","fix":{"range":[2568,2598],"text":"void msg.member?.roles.add(roleID);"},"desc":"Add void operator to ignore."}]}
msg.react(Emoji.Gift);

Check warning on line 63 in src/lib/events.ts

View workflow job for this annotation

GitHub Actions / ESLint

[eslint] reported by reviewdog 🐶 Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator. Raw Output: {"ruleId":"@typescript-eslint/no-floating-promises","severity":1,"message":"Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator.","line":63,"column":4,"nodeType":"ExpressionStatement","messageId":"floatingVoid","endLine":63,"endColumn":26,"suggestions":[{"messageId":"floatingFixVoid","fix":{"range":[2602,2624],"text":"void msg.react(Emoji.Gift);"},"desc":"Add void operator to ignore."}]}

const channel = globalClient.channels.cache.get(Channel.Notifications);

Expand All @@ -70,7 +70,7 @@
.map(i => i[2])
.includes(name)
) {
(channel as TextChannel).send(

Check warning on line 73 in src/lib/events.ts

View workflow job for this annotation

GitHub Actions / ESLint

[eslint] reported by reviewdog 🐶 Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator. Raw Output: {"ruleId":"@typescript-eslint/no-floating-promises","severity":1,"message":"Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator.","line":73,"column":5,"nodeType":"ExpressionStatement","messageId":"floatingVoid","endLine":75,"endColumn":7,"suggestions":[{"messageId":"floatingFixVoid","fix":{"range":[2799,2926],"text":"void (channel as TextChannel).send(\n\t\t\t\t\t`${Emoji.Fireworks} **${msg.author.username}** just received the **${name}** role. `\n\t\t\t\t);"},"desc":"Add void operator to ignore."}]}
`${Emoji.Fireworks} **${msg.author.username}** just received the **${name}** role. `
);
}
Expand All @@ -96,16 +96,16 @@
const user = await mUserFetch(msg.author.id);
const userPets = user.user.pets as ItemBank;
const newUserPets = { ...userPets };
if (!newUserPets[pet.id]) newUserPets[pet.id] = 1;

Check warning on line 99 in src/lib/events.ts

View workflow job for this annotation

GitHub Actions / ESLint

[eslint] reported by reviewdog 🐶 Unexpected number value in conditional. An explicit zero/NaN check is required. Raw Output: {"ruleId":"@typescript-eslint/strict-boolean-expressions","severity":1,"message":"Unexpected number value in conditional. An explicit zero/NaN check is required.","line":99,"column":8,"nodeType":"MemberExpression","messageId":"conditionErrorNumber","endLine":99,"endColumn":27,"suggestions":[{"messageId":"conditionFixCompareZero","fix":{"range":[3703,3723],"text":"newUserPets[pet.id] === 0"},"desc":"Change condition to check for 0 (`value !== 0`)"},{"messageId":"conditionFixCompareNaN","fix":{"range":[3703,3723],"text":"Number.isNaN(newUserPets[pet.id])"},"desc":"Change condition to check for NaN (`!Number.isNaN(value)`)"},{"messageId":"conditionFixCastBoolean","fix":{"range":[3703,3723],"text":"!Boolean(newUserPets[pet.id])"},"desc":"Explicitly cast value to a boolean (`Boolean(value)`)"}]}
else newUserPets[pet.id]++;
await user.update({
pets: { ...newUserPets }
});
if (!channelIsSendable(msg.channel)) return;
if (userPets[pet.id] > 1) {
msg.channel.send(`${msg.author} has a funny feeling like they would have been followed. ${pet.emoji}`);

Check warning on line 106 in src/lib/events.ts

View workflow job for this annotation

GitHub Actions / ESLint

[eslint] reported by reviewdog 🐶 Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator. Raw Output: {"ruleId":"@typescript-eslint/no-floating-promises","severity":1,"message":"Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator.","line":106,"column":4,"nodeType":"ExpressionStatement","messageId":"floatingVoid","endLine":106,"endColumn":107,"suggestions":[{"messageId":"floatingFixVoid","fix":{"range":[3916,4019],"text":"void msg.channel.send(`${msg.author} has a funny feeling like they would have been followed. ${pet.emoji}`);"},"desc":"Add void operator to ignore."}]}
} else {
msg.channel.send(`You have a funny feeling like you’re being followed, ${msg.author} ${pet.emoji}

Check warning on line 108 in src/lib/events.ts

View workflow job for this annotation

GitHub Actions / ESLint

[eslint] reported by reviewdog 🐶 Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator. Raw Output: {"ruleId":"@typescript-eslint/no-floating-promises","severity":1,"message":"Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator.","line":108,"column":4,"nodeType":"ExpressionStatement","messageId":"floatingVoid","endLine":109,"endColumn":49,"suggestions":[{"messageId":"floatingFixVoid","fix":{"range":[4034,4180],"text":"void msg.channel.send(`You have a funny feeling like you’re being followed, ${msg.author} ${pet.emoji}\nType \\`/tools user mypets\\` to see your pets.`);"},"desc":"Add void operator to ignore."}]}
Type \`/tools user mypets\` to see your pets.`);
}
}
Expand Down Expand Up @@ -189,6 +189,7 @@
if (items.length === 0) return msg.reply('No results for that item.');

const gettedItem = items[0];
const { sacrificed_bank: sacrificedBank } = await user.fetchStats({ sacrificed_bank: true });

let str = `Found ${items.length} items:\n${items
.slice(0, 5)
Expand All @@ -197,10 +198,11 @@

if (user.cl.has(item.id)) icons.push(Emoji.CollectionLog);
if (user.bank.has(item.id)) icons.push(Emoji.Bank);
if (((sacrificedBank as ItemBank)[item.id] ?? 0) > 0) icons.push(Emoji.Incinerator);

const price = toKMB(Math.floor(item.price));

let str = `${index + 1}. ${item.name} ID[${item.id}] Price[${price}] ${

Check warning on line 205 in src/lib/events.ts

View workflow job for this annotation

GitHub Actions / ESLint

[eslint] reported by reviewdog 🐶 'str' is already declared in the upper scope on line 194 column 8. Raw Output: {"ruleId":"no-shadow","severity":1,"message":"'str' is already declared in the upper scope on line 194 column 8.","line":205,"column":10,"nodeType":"Identifier","messageId":"noShadow","endLine":205,"endColumn":13}
item.tradeable ? 'Tradeable' : 'Untradeable'
} [Wiki Page](${item.wiki_url}) ${icons.join(' ')}`;
if (gettedItem.id === item.id) {
Expand Down Expand Up @@ -309,8 +311,8 @@
];

export async function onMessage(msg: Message) {
rareRoles(msg);

Check warning on line 314 in src/lib/events.ts

View workflow job for this annotation

GitHub Actions / ESLint

[eslint] reported by reviewdog 🐶 Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator. Raw Output: {"ruleId":"@typescript-eslint/no-floating-promises","severity":1,"message":"Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator.","line":314,"column":2,"nodeType":"ExpressionStatement","messageId":"floatingVoid","endLine":314,"endColumn":17,"suggestions":[{"messageId":"floatingFixVoid","fix":{"range":[9624,9639],"text":"void rareRoles(msg);"},"desc":"Add void operator to ignore."}]}
petMessages(msg);

Check warning on line 315 in src/lib/events.ts

View workflow job for this annotation

GitHub Actions / ESLint

[eslint] reported by reviewdog 🐶 Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator. Raw Output: {"ruleId":"@typescript-eslint/no-floating-promises","severity":1,"message":"Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator.","line":315,"column":2,"nodeType":"ExpressionStatement","messageId":"floatingVoid","endLine":315,"endColumn":19,"suggestions":[{"messageId":"floatingFixVoid","fix":{"range":[9641,9658],"text":"void petMessages(msg);"},"desc":"Add void operator to ignore."}]}
if (!msg.content || msg.author.bot || !channelIsSendable(msg.channel)) return;
const content = msg.content.trim();
if (!content.includes(mentionText)) return;
Expand Down
Loading