mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: cleaned discord
This commit is contained in:
1 parent
169588a211
commit
01ed20941d
30 files changed
+93
-121
No files matched your search
+11
-11
@@ -2,11 +2,11 @@ import { SlashCommandBuilder } from 'discord.js';
|
||||
import markdownEscape from 'markdown-escape';
|
||||
import discord from '../../discord.json' assert { type: 'json' };
|
||||
import getWargamingResponse from '../core/blitz/getWargamingResponse.js';
|
||||
import addUsernameOption from '../core/discord/addUsernameOption.js';
|
||||
import negativeEmbed from '../core/discord/negativeEmbed.js';
|
||||
import positiveEmbed from '../core/discord/positiveEmbed.js';
|
||||
import addUsernameChoices from '../core/discord/addUsernameChoices.js';
|
||||
import autocompleteUsername from '../core/discord/autocompleteUsername.js';
|
||||
import embedNegative from '../core/discord/embedNegative.js';
|
||||
import embedPositive from '../core/discord/embedPositive.js';
|
||||
import resolvePlayerFromCommand from '../core/discord/resolvePlayerFromCommand.js';
|
||||
import usernameAutocomplete from '../core/discord/usernameAutocomplete.js';
|
||||
import { WARGAMING_APPLICATION_ID } from '../core/node/args.js';
|
||||
import { CommandRegistry } from '../events/interactionCreate/index.js';
|
||||
import { AccountInfo } from '../types/accountInfo.js';
|
||||
@@ -20,7 +20,7 @@ export default {
|
||||
command: new SlashCommandBuilder()
|
||||
.setName('verify')
|
||||
.setDescription("Set's the user's username to their in-game name")
|
||||
.addStringOption((option) => addUsernameOption(option).setRequired(true)),
|
||||
.addStringOption((option) => addUsernameChoices(option).setRequired(true)),
|
||||
|
||||
async handler(interaction) {
|
||||
const blitzAccount = await resolvePlayerFromCommand(interaction);
|
||||
@@ -38,13 +38,13 @@ export default {
|
||||
interaction.guild?.members.cache.get(interaction.member?.user.id);
|
||||
|
||||
if (!interaction.guild?.members.me?.permissions.has('ManageNicknames')) {
|
||||
return negativeEmbed(
|
||||
return embedNegative(
|
||||
`${markdownEscape(interaction.user.username)} failed to verify`,
|
||||
"I don't have the permission to change your nickname.",
|
||||
);
|
||||
}
|
||||
if (!interaction.member || !member) {
|
||||
return negativeEmbed(
|
||||
return embedNegative(
|
||||
`${interaction.user.username} is not in this server`,
|
||||
"I couldn't find this person in this server. Did they leave?",
|
||||
);
|
||||
@@ -55,7 +55,7 @@ export default {
|
||||
|
||||
if (interaction.guildId === discord.sklld_guild_id) {
|
||||
if (!interaction.guild?.members.me?.permissions.has('ManageRoles')) {
|
||||
return negativeEmbed(
|
||||
return embedNegative(
|
||||
`${markdownEscape(interaction.user.username)} failed to verify`,
|
||||
"I don't have the permission to change your manage roles.",
|
||||
);
|
||||
@@ -65,19 +65,19 @@ export default {
|
||||
await member.roles.add(discord.sklld_peasant_role);
|
||||
}
|
||||
|
||||
return positiveEmbed(
|
||||
return embedPositive(
|
||||
`${interaction.user.username} is verified`,
|
||||
`The user is now verified as ${markdownEscape(
|
||||
accountInfo[id].nickname,
|
||||
)}${markdownEscape(clanTag)}`,
|
||||
);
|
||||
} catch (error) {
|
||||
return negativeEmbed(
|
||||
return embedNegative(
|
||||
`${interaction.user.username} failed to verify`,
|
||||
"I can't change your nickname because you have higher permissions than me. Try setting your nickname to your Blitz username manually.",
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
autocomplete: usernameAutocomplete,
|
||||
autocomplete: autocompleteUsername,
|
||||
} satisfies CommandRegistry;
|
||||
Reference in new issue
Block a user