feat: kick command

This commit is contained in:
2022-08-04 21:57:25 +02:00
parent c2fd56c43d
commit 2cd06ab872
8 changed files with 452 additions and 497 deletions

View File

@@ -1,3 +1,4 @@
TOKEN=token
PREFIX=v!
ECONOMY_MONGODB=mongodb://
ECONOMY_MONGODB=mongodb://
HYPIXEL_API=API_KEY

View File

@@ -4,7 +4,7 @@ vinci bot
- ~~form to apply for the minecraft server~~ DONE!
- moderation commands
- ~~welcome to users~~ DONE!
- economy system (wip)
- economy system
- modmail
- socials notification system
- chatbot using IBM's AI (thanks @gosevil for the idea)

37
commands/kick.ts Normal file
View File

@@ -0,0 +1,37 @@
const { commandModule, CommandType } = require('@sern/handler');
import { publish } from "../src/plugins/publish";
import { ownerOnly } from "../src/plugins/ownerOnly";
import { ApplicationCommandOptionType, EmbedBuilder } from 'discord.js'
export default commandModule({
name: 'kick',
type: CommandType.Both,
plugins: [publish(['1000400148289036298', '928018226330337280']), ownerOnly()],
description: 'ADMIN: Expulsa usuarios.',
options: [{
name: 'usuario',
description: 'Escribe un usuario.',
type: ApplicationCommandOptionType.User,
required: true,
min_value: 2,
max_value: 100
},
{
name: 'razon',
description: 'Escribe la razón.',
type: ApplicationCommandOptionType.String,
required: true
}],
//alias : [],
execute: async (ctx, options, message) => {
const userToBan = options[1].getMember('usuario', true);
const reason = options[1].get('razon', true).value;
const kickEmbed = new EmbedBuilder()
.setTitle('Nuevo kick.')
.setDescription(`Kick efectuado por <@${ctx.author}>.\nRazón: ${reason}.`);
const sendToMods = ctx.client.guilds.cache.get('928018226330337280')!.channels.cache.get('1004118323258208257')
await sendToMods.send({content: `Se ha expulsado a ${userToBan}.\nKick efectuado por ${ctx.user} con razón "${reason}."`})
userToBan.kick(reason)
await ctx.reply({content: 'Expulsado correctamente!'})
},
});

View File

@@ -22,6 +22,5 @@ export default commandModule({
// si no dice ni sí ni que no, le decimos al usuario que envíe de nuevo el formulario con sí o no.
await modal.reply({content: '**ERROR: No se ha enviado el formulario porque no has respondido ni sí ni no.**\nVuelve a intentarlo o notifica este error mencionando a Sr Izan en el servidor.', ephemeral: true})
}
}
});

View File

@@ -1,22 +1,13 @@
import { SernEmitter } from "@sern/handler";
const { EconomyManager } = require('quick.eco');
const { Client, GatewayIntentBits } = require("discord.js");
const { Sern } = require("@sern/handler");
const dotenv = require("dotenv").config();
const sernPrefix = process.env.PREFIX
const token = process.env.TOKEN
const mongo = process.env.ECONOMY_MONGODB
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMembers, GatewayIntentBits.MessageContent, GatewayIntentBits.GuildMembers],
restTimeOffset: 0
});
/*const eco = new EconomyManager({
adapter: 'mongo',
adapterOptions: {
collection: 'money', // => Collection Name
uri: mongo // => Mongodb uri
}
});*/
Sern.init({client,
sernPrefix,

889
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -21,11 +21,11 @@
},
"homepage": "https://github.com/SrIzan10/vinci#readme",
"dependencies": {
"@quick.eco/mongo": "^1.0.4",
"@sern/handler": "^1.1.7-beta",
"@sern/handler": "^1.1.8-beta",
"axios": "^0.27.2",
"discord.js": "^14.0.3",
"date-and-time": "^2.4.1",
"discord.js": "^14.1.2",
"dotenv": "^16.0.1",
"quick.eco": "^6.0.0"
"mongoose": "^6.5.0"
}
}

0
schemas/balance.ts Normal file
View File