feat: add Tormentica to /a

This commit is contained in:
2023-01-05 13:41:50 +01:00
parent 31378b91fe
commit 6f96eec7fe
3 changed files with 72 additions and 45 deletions

View File

@@ -1,12 +1,32 @@
import { commandModule, CommandType } from '@sern/handler'
import { Context } from "@sern/handler";
import { ApplicationCommandOptionType, AttachmentBuilder, AutocompleteInteraction, EmbedBuilder } from "discord.js";
import { publish } from "#plugins";
const choices = ['XaviXE', 'Paula', 'William', 'Espejito2500', 'Wheelook', 'MarioCabrera', 'Paticama', 'Vinci', 'SrIzan', 'ItsAdrian', 'ByHGT', 'Irene', 'Boniato64'];
import { commandModule, CommandType } from '@sern/handler';
import { Context } from '@sern/handler';
import {
ApplicationCommandOptionType,
AttachmentBuilder,
AutocompleteInteraction,
EmbedBuilder,
} from 'discord.js';
import { publish } from '#plugins';
const choices = [
'XaviXE',
'Paula',
'William',
'Espejito2500',
'Wheelook',
'MarioCabrera',
'Paticama',
'Vinci',
'SrIzan',
'ItsAdrian',
'ByHGT',
'Irene',
'Boniato64',
'Tormentarosa',
];
export default commandModule({
name: 'a',
type: CommandType.Slash,
type: CommandType.Slash,
plugins: [publish()],
description: 'A',
//alias : [],
@@ -18,49 +38,56 @@ export default commandModule({
autocomplete: true,
command: {
onEvent: [],
async execute(ctx: AutocompleteInteraction){
async execute(ctx: AutocompleteInteraction) {
const focusedValue = ctx.options.getFocused();
const filtered = choices.filter(choice => choice.startsWith(focusedValue));
await ctx.respond(
filtered.map(choice => ({ name: choice, value: choice })),
const filtered = choices.filter((choice) =>
choice.startsWith(focusedValue)
);
}
}
}
await ctx.respond(
filtered.map((choice) => ({ name: choice, value: choice }))
);
},
},
},
],
execute: async (ctx, options) => {
let option
try {option = options[1].getString('usuario', true)} catch(error) {option = undefined}
if (!option) {
const imagesArray = [
'./images/a/XaviXE.png',
'./images/a/Paula.png',
'./images/a/William.png',
'./images/a/Espejito2500.png',
'./images/a/Wheelook.png',
'./images/a/MarioCabrera.png',
'./images/a/Paticama.png',
'./images/a/Vinci.png',
'./images/a/SrIzan.png',
'./images/a/ItsAdrian.png',
'./images/a/ByHGT.png',
'./images/a/Irene.png',
'./images/a/Boniato64.png',
]
const images = imagesArray[Math.floor(Math.random() * imagesArray.length)];
const option = options[1].getString('usuario');
if (!option) {
const imagesArray = [
'./images/a/XaviXE.png',
'./images/a/Paula.png',
'./images/a/William.png',
'./images/a/Espejito2500.png',
'./images/a/Wheelook.png',
'./images/a/MarioCabrera.png',
'./images/a/Paticama.png',
'./images/a/Vinci.png',
'./images/a/SrIzan.png',
'./images/a/ItsAdrian.png',
'./images/a/ByHGT.png',
'./images/a/Irene.png',
'./images/a/Boniato64.png',
'./images/a/Tormentarosa.png',
];
const images =
imagesArray[Math.floor(Math.random() * imagesArray.length)];
await ctx.reply({content: 'A', files: [images]});
await ctx.reply({ content: 'A', files: [images] });
} else {
if (choices.indexOf(options[1].getString('usuario', true)) > -1) {
const attachmentbuilder = new AttachmentBuilder(
`./images/a/${options[1].getString('usuario', true)}.png`
);
await ctx.reply({ content: 'A', files: [attachmentbuilder] });
} else {
if (choices.indexOf(options[1].getString('usuario', true)) > -1) {
const attachmentbuilder = new AttachmentBuilder(`./images/a/${options[1].getString('usuario', true)}.png`)
await ctx.reply({content: 'A', files: [attachmentbuilder]})
} else {
const embed = new EmbedBuilder()
.setTitle("A no encontrado!")
.setDescription(`Qué raro, no se ha encontrado ese /a...\nPorqué no pruebas a poner uno del autocompletado?`)
.setColor("Red")
await ctx.reply({embeds: [embed], ephemeral: true})
}
const embed = new EmbedBuilder()
.setTitle('A no encontrado!')
.setDescription(
`Qué raro, no se ha encontrado ese /a...\nPorqué no pruebas a poner uno del autocompletado?`
)
.setColor('Red');
await ctx.reply({ embeds: [embed], ephemeral: true });
}
}
},
});
});

View File

@@ -33,7 +33,7 @@ export default commandModule({
.then((res) => res.data);
await modal.reply({
content:
'Enviado!, Gracias por utilizar tu Mona Lisa de confianza\n~Sr Izan, 2022',
'Enviado!\nSé paciente ya que el bot no es automático.',
ephemeral: true,
});
const embed = new EmbedBuilder()

BIN
images/a/Tormentarosa.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB