feat: comandos 8ball, slowmode, timeout

This commit is contained in:
2022-08-10 18:37:45 +02:00
parent 5622247ef0
commit bfa94f343c
5 changed files with 76 additions and 3 deletions

36
commands/fun/8ball.ts Normal file
View File

@@ -0,0 +1,36 @@
const { commandModule, CommandType } = require('@sern/handler');
import { publish } from "../../src/plugins/publish";
import { ownerOnly } from "../../src/plugins/ownerOnly"
import { ApplicationCommandOptionType } from "discord.js";
/*
import { publish } from "../../src/plugins/publish";
import { ownerOnly } from "../../src/plugins/ownerOnly"
*/
export default commandModule({
name: '8ball',
type: CommandType.Both,
plugins: [publish(['1000400148289036298', '928018226330337280'])],
description: 'Preguntale a la 8-ball cosas.',
//alias : [],
options: [{
name: "pregunta",
description: "Escribe lo que le quieres preguntar.",
type: ApplicationCommandOptionType.String,
required: true
}],
execute: async (ctx, options) => {
// yes, the question argument is never used. There is no reason to use it in the code.
var eightballwords = [
'Probablemente',
'Sí',
'No',
'Dudable',
'Como lo veo, todo indica a que sí',
'A lo mejor',
'No cuentes con ello',
'Buena suerte'
]
await ctx.reply({content: `La bola tiene respuesta: ${eightballwords[Math.floor(Math.random() * eightballwords.length)]}.`, ephemeral: true})
},
});

View File

@@ -0,0 +1,36 @@
const { commandModule, CommandType } = require('@sern/handler');
import { publish } from "../../src/plugins/publish";
import { ownerOnly } from "../../src/plugins/ownerOnly"
import { ApplicationCommandOptionType } from "discord.js";
export default commandModule({
name: 'slowmode',
type: CommandType.Both,
plugins: [publish(['1000400148289036298', '928018226330337280']), ownerOnly()],
description: 'ADMIN: Pon modo lento a canales de texto',
options: [
{
name: "segundos",
description: "Los segundos de modo lento",
type: ApplicationCommandOptionType.Number,
required: true
},
{
name: "razon",
description: "La razón del modo lento",
type: ApplicationCommandOptionType.String,
required: true
}
],
//alias : [],
execute: async (ctx, options) => {
const seconds = options[1].getNumber("segundos", true);
const reason = options[1].getString("razon", true);
ctx.channel.setRateLimitPerUser(seconds, reason)
ctx.reply({content: `Se han añadido ${seconds} segundos de modo lento al canal de voz actual`})
const sendToMods = ctx.client.guilds.cache.get('928018226330337280')!.channels.cache.get('1004118323258208257')
await sendToMods.send({content: `Se ha aplicado modo lento al canal ${ctx.channel}.\nEfectuado por ${ctx.user} con ${seconds} segundos de retardo.\nRazón: ${reason}`})
},
});

View File

@@ -10,7 +10,7 @@ import { ownerOnly } from "../../src/plugins/ownerOnly"
export default commandModule({
name: 'timeout',
type: CommandType.Both,
plugins: [publish(['1000400148289036298', '928018226330337280'])],
plugins: [publish(['1000400148289036298', '928018226330337280']), ownerOnly()],
description: 'ADMIN: Silencia a usuarios.',
options: [
{
@@ -41,7 +41,7 @@ export default commandModule({
const minutosToMilisegundos = minutos * 60 * 1000
const sendToMods = ctx.client.guilds.cache.get('928018226330337280')!.channels.cache.get('1004118323258208257')
await sendToMods.send({content: `Se ha silenciado a ${usuario}.\nSlencio efectuado por ${ctx.user} con ${minutos} de duración.\nRazón: ${razon}`})
await sendToMods.send({content: `Se ha silenciado a ${usuario}.\nSlencio efectuado por ${ctx.user} con ${minutos} minutos de duración.\nRazón: ${razon}`})
usuario.timeout(minutosToMilisegundos, razon).then(() => {ctx.reply({content: `Se ha silenciado a ${usuario} correctamente.`, ephemeral: true})})
}

View File

@@ -13,7 +13,8 @@ export default commandModule({
// , '928018226330337280'
description: 'A ping command',
//alias : [],
execute: async (ctx, args) => {
options: [],
execute: async (ctx, options) => {
await ctx.reply('Hello World!');
},
});