mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: basic verification
This commit is contained in:
1 parent
363f110c2f
commit
74c9f1e4da
4 files changed
+80
-11
No files matched your search
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"cSpell.words": ["Abhi"],
|
"cSpell.words": ["Abhi", "SKLLD", "wargaming"],
|
||||||
"deno.enable": false,
|
"deno.enable": false,
|
||||||
"deno.unstable": false
|
"deno.unstable": false
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
{
|
{
|
||||||
"token": "",
|
"discord_token": "",
|
||||||
"clientId": "",
|
"discord_client_id": "",
|
||||||
"guildId": ""
|
"discord_guild_id": "",
|
||||||
|
"discord_verify_channel": "",
|
||||||
|
"wargaming_application_id": ""
|
||||||
}
|
}
|
||||||
+72
-7
@@ -1,15 +1,80 @@
|
|||||||
import { CommandInteraction, SlashCommandBuilder } from 'discord.js';
|
import {
|
||||||
|
CommandInteraction,
|
||||||
|
EmbedBuilder,
|
||||||
|
SlashCommandBuilder,
|
||||||
|
} from 'discord.js';
|
||||||
|
import config from '../../config.json' assert { type: 'json' };
|
||||||
|
|
||||||
export function execute(interaction: CommandInteraction) {
|
export async function execute(interaction: CommandInteraction) {
|
||||||
interaction.reply(
|
const response = (await fetch(
|
||||||
|
`https://api.wotblitz.${
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
`you said your blitz username was ${interaction.options.getString(
|
interaction.options.getString('server') === 'na'
|
||||||
|
? 'com'
|
||||||
|
: //@ts-ignore
|
||||||
|
interaction.options.getString('server')
|
||||||
|
}/wotb/account/list/?application_id=${
|
||||||
|
config.wargaming_application_id
|
||||||
|
//@ts-ignore
|
||||||
|
}&search=${interaction.options.getString('ign')}`,
|
||||||
|
).then((response) => response.json())) as {
|
||||||
|
data: { nickname: string; account_id: number }[];
|
||||||
|
};
|
||||||
|
|
||||||
|
if (response.data.length === 1) {
|
||||||
|
//@ts-ignore
|
||||||
|
if (response.data[0].nickname === interaction.options.getString('ign')) {
|
||||||
|
interaction.reply({
|
||||||
|
embeds: [
|
||||||
|
new EmbedBuilder()
|
||||||
|
.setColor('#82ff29')
|
||||||
|
.setTitle(`${interaction.user.username} is verified`)
|
||||||
|
.setDescription(
|
||||||
|
`The user is now verified as ${
|
||||||
|
//@ts-ignore
|
||||||
|
interaction.options.getString('ign')
|
||||||
|
}`,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
interaction.reply({
|
||||||
|
embeds: [
|
||||||
|
new EmbedBuilder()
|
||||||
|
.setColor('#ff4747')
|
||||||
|
.setTitle(`Account not found`)
|
||||||
|
.setDescription(
|
||||||
|
//@ts-ignore
|
||||||
|
`No exact matches were found for "${interaction.options.getString(
|
||||||
'ign',
|
'ign',
|
||||||
)} in ${
|
)}" in the ${
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
interaction.options.getString('server')
|
interaction.options.getString('server')
|
||||||
}`,
|
} server. Are you sure you have no typos? Capitalization matters.`,
|
||||||
);
|
),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
interaction.reply({
|
||||||
|
embeds: [
|
||||||
|
new EmbedBuilder()
|
||||||
|
.setColor('#ff4747')
|
||||||
|
.setTitle(`Account not found`)
|
||||||
|
.setDescription(
|
||||||
|
//@ts-ignore
|
||||||
|
`Are you sure your username is "${interaction.options.getString(
|
||||||
|
'ign',
|
||||||
|
)}" in the ${
|
||||||
|
//@ts-ignore
|
||||||
|
interaction.options.getString('server')
|
||||||
|
} server? I found ${
|
||||||
|
response.data.length < 100 ? response.data.length : 'over 100'
|
||||||
|
} accounts. Try re-running the command.`,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const data = new SlashCommandBuilder()
|
export const data = new SlashCommandBuilder()
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ client.on('ready', (c) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
client.on('guildMemberAdd', async (member) => {
|
client.on('guildMemberAdd', async (member) => {
|
||||||
|
console.log(`${member.user.tag} joined`);
|
||||||
|
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
await member.guild.channels.cache.get(config.discord_verify_channel)?.send({
|
await member.guild.channels.cache.get(config.discord_verify_channel)?.send({
|
||||||
embeds: [
|
embeds: [
|
||||||
|
|||||||
Reference in new issue
Block a user