mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: markdownEscape
This commit is contained in:
1 parent
01b5ec9bc2
commit
5ef1f87236
11 files changed
+75
-26
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import markdownEscape from 'markdown-escape';
|
||||
import { CommandRegistry } from '../behaviors/interactionCreate.js';
|
||||
import { NEGATIVE_COLOR, POSITIVE_COLOR } from '../constants/colors.js';
|
||||
import { BlitzServer } from '../constants/servers.js';
|
||||
@@ -108,7 +109,7 @@ export default {
|
||||
poweredByBlitzStars(
|
||||
new EmbedBuilder()
|
||||
.setTitle(
|
||||
`${data.nickname} is ${
|
||||
`${markdownEscape(data.nickname)} is ${
|
||||
eligible ? '' : 'not '
|
||||
}eligible for ${CLANS[clan].name}`,
|
||||
)
|
||||
@@ -116,10 +117,14 @@ export default {
|
||||
.setDescription(
|
||||
`${
|
||||
eligible
|
||||
? `${data.nickname} meets all the requirements set for ${CLANS[clan].name}.`
|
||||
: `${data.nickname}'s shortcomings for ${
|
||||
? `${markdownEscape(
|
||||
data.nickname,
|
||||
)} meets all the requirements set for ${
|
||||
CLANS[clan].name
|
||||
} (${
|
||||
}.`
|
||||
: `${markdownEscape(
|
||||
data.nickname,
|
||||
)}'s shortcomings for ${CLANS[clan].name} (${
|
||||
clan === 'sklld' ? '30 days stats' : 'career stats'
|
||||
}):\n\n${issues.join('\n')}`
|
||||
}\n\n${blitzLinks(data)}`,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import markdownEscape from 'markdown-escape';
|
||||
import { CommandRegistry } from '../behaviors/interactionCreate.js';
|
||||
import { NEGATIVE_COLOR, POSITIVE_COLOR } from '../constants/colors.js';
|
||||
import { BlitzServer } from '../constants/servers.js';
|
||||
@@ -68,7 +69,9 @@ export default {
|
||||
.sort((a, b) => b[1] - a[1])
|
||||
.map(([nickname, inactiveDays]) => {
|
||||
const days = Math.floor(inactiveDays);
|
||||
return `**${nickname}**: ${days} day${days === 1 ? '' : 's'}`;
|
||||
return `**${markdownEscape(nickname)}**: ${days} day${
|
||||
days === 1 ? '' : 's'
|
||||
}`;
|
||||
});
|
||||
const hasInactiveMembers = inactiveInfo.length > 0;
|
||||
|
||||
@@ -80,8 +83,8 @@ export default {
|
||||
)
|
||||
.setTitle(
|
||||
hasInactiveMembers
|
||||
? `${clan.name}'s inactive members`
|
||||
: `No inactive members in ${clan.name}`,
|
||||
? `${markdownEscape(clan.name)}'s inactive members`
|
||||
: `No inactive members in ${markdownEscape(clan.name)}`,
|
||||
)
|
||||
.setDescription(
|
||||
hasInactiveMembers
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import markdownEscape from 'markdown-escape';
|
||||
import { CommandRegistry } from '../behaviors/interactionCreate.js';
|
||||
import { SKILLED_COLOR } from '../constants/colors.js';
|
||||
import { Players } from '../types/players.js';
|
||||
@@ -38,12 +39,14 @@ export default {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setColor(SKILLED_COLOR)
|
||||
.setTitle(`Player search results for "${name}"`)
|
||||
.setTitle(`Player search results for "${markdownEscape(name)}"`)
|
||||
.setDescription(
|
||||
`\`\`\`${
|
||||
players.length === 0
|
||||
? 'No players found.'
|
||||
: players.map((player) => player.nickname).join('\n')
|
||||
: players
|
||||
.map((player) => markdownEscape(player.nickname))
|
||||
.join('\n')
|
||||
}\`\`\``,
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import markdownEscape from 'markdown-escape';
|
||||
import { CommandRegistry } from '../behaviors/interactionCreate.js';
|
||||
import { SKILLED_COLOR } from '../constants/colors.js';
|
||||
import { BlitzServer } from '../constants/servers.js';
|
||||
@@ -55,7 +56,7 @@ export default {
|
||||
new EmbedBuilder()
|
||||
.setColor(SKILLED_COLOR)
|
||||
.setTitle(
|
||||
`${data.nickname}'s ${
|
||||
`${markdownEscape(data.nickname)}'s ${
|
||||
period === 'career' ? period : `${period} day`
|
||||
} stats`,
|
||||
)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import markdownEscape from 'markdown-escape';
|
||||
import { CommandRegistry } from '../behaviors/interactionCreate.js';
|
||||
import { SKILLED_COLOR } from '../constants/colors.js';
|
||||
import { BlitzServer } from '../constants/servers.js';
|
||||
@@ -68,20 +69,20 @@ export default {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setTitle(
|
||||
`${account.nickname}'s owned ${
|
||||
`${markdownEscape(account.nickname)}'s owned ${
|
||||
tier === null ? '' : `tier ${tier} `
|
||||
}tanks`,
|
||||
)
|
||||
.setDescription(
|
||||
`${
|
||||
tanks.length === 0
|
||||
? `No tanks found for player in tier ${tier}`
|
||||
? `No tanks found in tier ${tier}`
|
||||
: tanks
|
||||
.map(
|
||||
(tank) =>
|
||||
`${TANK_TYPE_EMOJIS[tank.type]} ${tank.name} ${
|
||||
tank.is_premium ? '⭐' : ''
|
||||
}${
|
||||
`${TANK_TYPE_EMOJIS[tank.type]} ${markdownEscape(
|
||||
tank.name,
|
||||
)} ${tank.is_premium ? '⭐' : ''}${
|
||||
COMP_TANKS.includes(tank.tank_id) ? '🏆' : ''
|
||||
}`,
|
||||
)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import markdownEscape from 'markdown-escape';
|
||||
import discord from '../../discord.json' assert { type: 'json' };
|
||||
import { CommandRegistry } from '../behaviors/interactionCreate.js';
|
||||
import { NEGATIVE_COLOR, POSITIVE_COLOR } from '../constants/colors.js';
|
||||
@@ -52,7 +53,9 @@ export default {
|
||||
.setColor(POSITIVE_COLOR)
|
||||
.setTitle(`${interaction.user.username} is verified`)
|
||||
.setDescription(
|
||||
`The user is now verified as ${name}${clanTag}`,
|
||||
`The user is now verified as ${markdownEscape(
|
||||
name,
|
||||
)}${markdownEscape(clanTag)}`,
|
||||
),
|
||||
],
|
||||
});
|
||||
@@ -66,7 +69,11 @@ export default {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setColor(NEGATIVE_COLOR)
|
||||
.setTitle(`${interaction.user.username} failed to verify`)
|
||||
.setTitle(
|
||||
`${markdownEscape(
|
||||
interaction.user.username,
|
||||
)} failed to verify`,
|
||||
)
|
||||
.setDescription(
|
||||
'I may not have the permission to change your nickname.',
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user