mirror of
https://github.com/SrIzan10/vinci.git
synced 2026-06-06 01:07:00 +00:00
feat: better a command and cat command
This commit is contained in:
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"dotenv.enableAutocloaking": false
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import { ownerOnly } from "../../src/plugins/ownerOnly"
|
||||
|
||||
export default commandModule({
|
||||
name: '8ball',
|
||||
type: CommandType.Both,
|
||||
type: CommandType.Slash,
|
||||
plugins: [publish({ guildIds: ['1000400148289036298', '928018226330337280'] })],
|
||||
description: 'Preguntale a la 8-ball cosas.',
|
||||
//alias : [],
|
||||
|
||||
@@ -1,29 +1,67 @@
|
||||
const { commandModule, CommandType } = require('@sern/handler');
|
||||
import { Context } from "@sern/handler";
|
||||
import { ApplicationCommandOptionType, AttachmentBuilder, EmbedBuilder } from "discord.js";
|
||||
import { publish } from "../../src/plugins/publish";
|
||||
const choices = ['XaviXE', 'Paula', 'William', 'Espejito2500', 'Wheelook', 'MarioCabrera', 'Paticama', 'Vinci', 'SrIzan', 'ItsAdrian', 'ByHGT'];
|
||||
|
||||
export default commandModule({
|
||||
name: 'a',
|
||||
type: CommandType.Both,
|
||||
type: CommandType.Slash,
|
||||
plugins: [publish({ guildIds: ['1000400148289036298', '928018226330337280'] })],
|
||||
description: 'A',
|
||||
//alias : [],
|
||||
options: [
|
||||
{
|
||||
name: 'usuario',
|
||||
description: 'Usuario que debería aparecer',
|
||||
type: ApplicationCommandOptionType.String,
|
||||
autocomplete: true,
|
||||
command: {
|
||||
onEvent: [],
|
||||
async execute(ctx){
|
||||
const focusedValue = ctx.options.getFocused();
|
||||
const filtered = choices.filter(choice => choice.startsWith(focusedValue));
|
||||
await ctx.respond(
|
||||
filtered.map(choice => ({ name: choice, value: choice })),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
execute: async (ctx, options) => {
|
||||
const imagesArray = [
|
||||
'./images/XaviXE.png',
|
||||
'./images/Paula.png',
|
||||
'./images/William.png',
|
||||
'./images/Espejito2500.png',
|
||||
'./images/Paula.png',
|
||||
'./images/Wheelook.png',
|
||||
'./images/MarioCabrera.png',
|
||||
'./images/Paticama.png',
|
||||
'./images/Vinci.png',
|
||||
'./images/SrIzan.png',
|
||||
'./images/ItsAdrian.png',
|
||||
'./images/ByHGT.png'
|
||||
]
|
||||
const images = imagesArray[Math.floor(Math.random() * imagesArray.length)];
|
||||
try {
|
||||
if (choices.indexOf(options[1].getString('usuario', true)) > -1) {
|
||||
const attachmentbuilder = new AttachmentBuilder(`./images/${options[1].getString('usuario', true)}.png`)
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle("A")
|
||||
.setImage(`attachment://${options[1].getString('usuario', true)}.png`)
|
||||
.setColor("Random")
|
||||
await ctx.reply({embeds: [embed], 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})
|
||||
}
|
||||
if (!options[1].getString('usuario', true)) {
|
||||
const imagesArray = [
|
||||
'./images/XaviXE.png',
|
||||
'./images/Paula.png',
|
||||
'./images/William.png',
|
||||
'./images/Espejito2500.png',
|
||||
'./images/Wheelook.png',
|
||||
'./images/MarioCabrera.png',
|
||||
'./images/Paticama.png',
|
||||
'./images/Vinci.png',
|
||||
'./images/SrIzan.png',
|
||||
'./images/ItsAdrian.png',
|
||||
'./images/ByHGT.png'
|
||||
]
|
||||
const images = imagesArray[Math.floor(Math.random() * imagesArray.length)];
|
||||
|
||||
await ctx.reply({content: 'A', files: [images]});
|
||||
await ctx.reply({content: 'A', files: [images]});
|
||||
}
|
||||
} catch (err) {}
|
||||
},
|
||||
});
|
||||
59
commands/fun/cat.ts
Normal file
59
commands/fun/cat.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
const { commandModule, CommandType } = require('@sern/handler');
|
||||
import { Context } from "@sern/handler";
|
||||
import axios from "axios";
|
||||
import { ActionRowBuilder, APIMessageActionRowComponent, ButtonBuilder, ButtonStyle, ComponentType, EmbedBuilder } from "discord.js";
|
||||
import { publish } from "../../src/plugins/publish";
|
||||
/*
|
||||
import { publish } from "../../src/plugins/publish";
|
||||
import { ownerOnly } from "../../src/plugins/ownerOnly"
|
||||
*/
|
||||
|
||||
export default commandModule({
|
||||
name: 'gato',
|
||||
type: CommandType.Slash,
|
||||
plugins: [publish({ guildIds: ['1000400148289036298', '928018226330337280'] })],
|
||||
description: 'QUIEN HA DICHO GATOS?!?!?!',
|
||||
//alias : [],
|
||||
options: [],
|
||||
execute: async (ctx: Context, options) => {
|
||||
const request = await axios.get(`https://api.thecatapi.com/v1/images/search?api_key=${process.env.CATAPI}`).then(res => res.data)
|
||||
const embed = new EmbedBuilder()
|
||||
.setAuthor({name: ctx.user.username, iconURL: ctx.user.displayAvatarURL()})
|
||||
.setColor("Random")
|
||||
.setImage(request[0].url)
|
||||
.setFooter({text: `ID: ${request[0].id}`})
|
||||
.setTitle('Gato')
|
||||
const row = new ActionRowBuilder<ButtonBuilder>()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId("cat-upvote")
|
||||
.setEmoji("⬆️")
|
||||
.setStyle(ButtonStyle.Success),
|
||||
new ButtonBuilder()
|
||||
.setCustomId("cat-downvote")
|
||||
.setEmoji("⬇️")
|
||||
.setStyle(ButtonStyle.Danger),
|
||||
)
|
||||
const message = await ctx.reply({embeds: [embed], components: [row]})
|
||||
const collector = message.createMessageComponentCollector({time: 30000, componentType: ComponentType.Button})
|
||||
collector.on('collect', async (i) => {
|
||||
await i.deferReply({ephemeral: true})
|
||||
if (i.customId === "cat-upvote") {
|
||||
await axios.post(`https://api.thecatapi.com/v1/votes?api_key=${process.env.CATAPI}`, {
|
||||
"image_id": request[0].id,
|
||||
"sub_id": i.user.id,
|
||||
"value": 1
|
||||
})
|
||||
i.editReply({content: "Has votado positivamente al gato con ID " + "`" + request[0].id + "`"})
|
||||
}
|
||||
if (i.customId === "cat-downvote") {
|
||||
await axios.post(`https://api.thecatapi.com/v1/votes?api_key=${process.env.CATAPI}`, {
|
||||
"image_id": request[0].id,
|
||||
"sub_id": i.user.id,
|
||||
"value": -1
|
||||
})
|
||||
i.editReply({content: "Has votado negativamente al gato con ID " + "`" + request[0].id + "`"})
|
||||
}
|
||||
})
|
||||
},
|
||||
});
|
||||
@@ -4,7 +4,7 @@ import { publish } from "../../src/plugins/publish";
|
||||
|
||||
export default commandModule({
|
||||
name: 'chiste',
|
||||
type: CommandType.Both,
|
||||
type: CommandType.Slash,
|
||||
plugins: [publish({ guildIds: ['1000400148289036298', '928018226330337280'] })],
|
||||
description: 'Enseña un chiste en inglés.',
|
||||
alias : ['joke'],
|
||||
|
||||
@@ -9,7 +9,7 @@ import { ownerOnly } from "../../src/plugins/ownerOnly"
|
||||
|
||||
export default commandModule({
|
||||
name: 'ip',
|
||||
type: CommandType.Both,
|
||||
type: CommandType.Slash,
|
||||
plugins: [publish({ guildIds: ['1000400148289036298', '928018226330337280'] })],
|
||||
//
|
||||
description: 'La IP del servidor de Minecraft',
|
||||
|
||||
@@ -6,7 +6,7 @@ import { ownerOnly } from "../../src/plugins/ownerOnly"
|
||||
|
||||
export default commandModule({
|
||||
name: 'mcform',
|
||||
type: CommandType.Both,
|
||||
type: CommandType.Slash,
|
||||
plugins: [publish({ guildIds: ['1000400148289036298', '928018226330337280'] })],
|
||||
description: 'Envia el formulario para entrar al servidor.',
|
||||
//alias : [],
|
||||
|
||||
@@ -10,7 +10,7 @@ import { ownerOnly } from "../../src/plugins/ownerOnly"
|
||||
|
||||
export default commandModule({
|
||||
name: 'radio',
|
||||
type: CommandType.Both,
|
||||
type: CommandType.Slash,
|
||||
plugins: [publish({ guildIds: ['1000400148289036298', '928018226330337280'] })],
|
||||
description: 'Reproduce la radio',
|
||||
options: [
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Resolver } from "../../resolver";
|
||||
|
||||
export default commandModule({
|
||||
name: 'rolemenu',
|
||||
type: CommandType.Both,
|
||||
type: CommandType.Slash,
|
||||
plugins: [publish({ guildIds: ['1000400148289036298', '928018226330337280'] }), ownerOnly()],
|
||||
description: 'ADMIN: Spawnea un menú de roles',
|
||||
//alias : [],
|
||||
|
||||
@@ -5,7 +5,7 @@ import { publish } from "../../src/plugins/publish";
|
||||
|
||||
export default commandModule({
|
||||
name: 'acortar',
|
||||
type: CommandType.Both,
|
||||
type: CommandType.Slash,
|
||||
plugins: [publish({ guildIds: ['1000400148289036298', '928018226330337280'] })],
|
||||
description: 'Acorta una URL a vinci.tk',
|
||||
options: [
|
||||
|
||||
@@ -6,7 +6,7 @@ import { ownerOnly } from "../../src/plugins/ownerOnly"
|
||||
|
||||
export default commandModule({
|
||||
name: 'sugerencias',
|
||||
type: CommandType.Both,
|
||||
type: CommandType.Slash,
|
||||
plugins: [publish({ guildIds: ['1000400148289036298', '928018226330337280'] })],
|
||||
description: 'Envia una sugerencia.',
|
||||
//alias : [],
|
||||
|
||||
@@ -4,7 +4,7 @@ const prettySeconds = require('pretty-seconds-spanish')
|
||||
|
||||
export default commandModule({
|
||||
name: 'uptime',
|
||||
type: CommandType.Both,
|
||||
type: CommandType.Slash,
|
||||
plugins: [publish({ guildIds: ['1000400148289036298', '928018226330337280'] })],
|
||||
description: 'Enseña el tiempo que ha estado encendido el bot.',
|
||||
//alias : [],
|
||||
|
||||
@@ -5,7 +5,7 @@ import { ApplicationCommandOptionType, EmbedBuilder } from 'discord.js'
|
||||
|
||||
export default commandModule({
|
||||
name: 'ban',
|
||||
type: CommandType.Both,
|
||||
type: CommandType.Slash,
|
||||
plugins: [publish({ guildIds: ['1000400148289036298', '928018226330337280'] }), ownerOnly()],
|
||||
description: 'ADMIN: Banea usuarios.',
|
||||
options: [{
|
||||
|
||||
@@ -9,7 +9,7 @@ import { ownerOnly } from "../../src/plugins/ownerOnly"
|
||||
|
||||
export default commandModule({
|
||||
name: 'eliminarmensaje',
|
||||
type: CommandType.Both,
|
||||
type: CommandType.Slash,
|
||||
plugins: [publish({ guildIds: ['1000400148289036298', '928018226330337280'] }), ownerOnly()],
|
||||
description: 'ADMIN: Elimina comandos por su ID.',
|
||||
//alias : [],
|
||||
|
||||
@@ -5,7 +5,7 @@ import { ApplicationCommandOptionType, EmbedBuilder } from 'discord.js'
|
||||
|
||||
export default commandModule({
|
||||
name: 'kick',
|
||||
type: CommandType.Both,
|
||||
type: CommandType.Slash,
|
||||
plugins: [publish({ guildIds: ['1000400148289036298', '928018226330337280'] }), ownerOnly()],
|
||||
description: 'ADMIN: Expulsa usuarios.',
|
||||
options: [
|
||||
|
||||
@@ -5,7 +5,7 @@ import { ApplicationCommandOptionType } from 'discord.js'
|
||||
|
||||
export default commandModule({
|
||||
name: 'prune',
|
||||
type: CommandType.Both,
|
||||
type: CommandType.Slash,
|
||||
plugins: [publish({ guildIds: ['1000400148289036298', '928018226330337280'] }), ownerOnly()],
|
||||
description: 'ADMIN: Elimina hasta 100 mensajes',
|
||||
options: [{
|
||||
|
||||
@@ -5,7 +5,7 @@ import { ApplicationCommandOptionType } from "discord.js";
|
||||
|
||||
export default commandModule({
|
||||
name: 'slowmode',
|
||||
type: CommandType.Both,
|
||||
type: CommandType.Slash,
|
||||
plugins: [publish({ guildIds: ['1000400148289036298', '928018226330337280'] }), ownerOnly()],
|
||||
description: 'ADMIN: Pon modo lento a canales de texto',
|
||||
options: [
|
||||
|
||||
@@ -9,7 +9,7 @@ import { ownerOnly } from "../../src/plugins/ownerOnly"
|
||||
|
||||
export default commandModule({
|
||||
name: 'timeout',
|
||||
type: CommandType.Both,
|
||||
type: CommandType.Slash,
|
||||
plugins: [publish({ guildIds: ['1000400148289036298', '928018226330337280'] }), ownerOnly()],
|
||||
description: 'ADMIN: Silencia a usuarios.',
|
||||
options: [
|
||||
|
||||
@@ -8,7 +8,7 @@ import { ownerOnly } from "../../src/plugins/ownerOnly"
|
||||
|
||||
export default commandModule({
|
||||
name: 'ping',
|
||||
type: CommandType.Both,
|
||||
type: CommandType.Slash,
|
||||
plugins: [publish({ guildIds: ['1000400148289036298'] })],
|
||||
// , '928018226330337280'
|
||||
description: 'A ping command',
|
||||
|
||||
@@ -6,13 +6,12 @@ export default eventModule({
|
||||
type: EventType.Discord,
|
||||
name: 'guildMemberAdd',
|
||||
execute(member: GuildMember) {
|
||||
// member.guild.channels.cache.get("968572106952560670").send(`${member.user} has joined the server!`);
|
||||
const newMemberEmbed = new EmbedBuilder()
|
||||
.setColor("Random")
|
||||
.setTitle("Nuevo miembro!")
|
||||
.setDescription(`${member.user} acaba de entrar al servidor!`)
|
||||
.setThumbnail(member.user.displayAvatarURL())
|
||||
.setTimestamp();
|
||||
.setColor("Random")
|
||||
.setTitle("Nuevo miembro!")
|
||||
.setDescription(`${member.user} acaba de entrar al servidor!`)
|
||||
.setThumbnail(member.user.displayAvatarURL())
|
||||
.setTimestamp();
|
||||
|
||||
const channel = member.client.guilds.cache.get('928018226330337280')!.channels.cache.get('993599947364634694') as TextChannel
|
||||
channel.send({embeds: [newMemberEmbed]})
|
||||
|
||||
1
index.ts
1
index.ts
@@ -18,7 +18,6 @@ export const db = mongoose.connect(process.env.MONGODB, {useNewUrlParser: true,u
|
||||
|
||||
Sern.init({
|
||||
client,
|
||||
sernPrefix,
|
||||
commands : './commands',
|
||||
sernEmitter : new SernEmitter(),
|
||||
events: './events'
|
||||
|
||||
14
package-lock.json
generated
14
package-lock.json
generated
@@ -11,7 +11,7 @@
|
||||
"dependencies": {
|
||||
"@discordjs/opus": "^0.8.0",
|
||||
"@discordjs/voice": "^0.11.0",
|
||||
"@sern/handler": "^1.2.0",
|
||||
"@sern/handler": "^1.2.1",
|
||||
"@xmldom/xmldom": "^0.8.2",
|
||||
"axios": "^0.27.2",
|
||||
"discord-bot-youtube-notifications": "^1.1.4",
|
||||
@@ -212,9 +212,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@sern/handler": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@sern/handler/-/handler-1.2.0.tgz",
|
||||
"integrity": "sha512-yXPwzuacYN+65hvf8VI16isw4Cy7Uo4TX5BgIA1dLaaAE7Fmxv6LvhQZjQQj/bw2gQdEY7XMoPlnggV7EpIlTw==",
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@sern/handler/-/handler-1.2.1.tgz",
|
||||
"integrity": "sha512-ElXlJC/tS5T++QCUCXw1uCCfMu4sVSg6UN6uD+Y9TigynpQsFpzHAKuOtyQwUcwIBbiB+NZ2xAbOiyVy0YpPvw==",
|
||||
"dependencies": {
|
||||
"rxjs": "^7.5.6",
|
||||
"ts-pattern": "^4.0.2",
|
||||
@@ -3010,9 +3010,9 @@
|
||||
"integrity": "sha512-ula2O0kpSZtX9rKXNeQMrHwNd7E4jPDJYUXmEGTFdMRfyfMw+FPyh04oKMjAiDuOi64bYgVkOV3MjK+loImFhQ=="
|
||||
},
|
||||
"@sern/handler": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@sern/handler/-/handler-1.2.0.tgz",
|
||||
"integrity": "sha512-yXPwzuacYN+65hvf8VI16isw4Cy7Uo4TX5BgIA1dLaaAE7Fmxv6LvhQZjQQj/bw2gQdEY7XMoPlnggV7EpIlTw==",
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@sern/handler/-/handler-1.2.1.tgz",
|
||||
"integrity": "sha512-ElXlJC/tS5T++QCUCXw1uCCfMu4sVSg6UN6uD+Y9TigynpQsFpzHAKuOtyQwUcwIBbiB+NZ2xAbOiyVy0YpPvw==",
|
||||
"requires": {
|
||||
"rxjs": "^7.5.6",
|
||||
"ts-pattern": "^4.0.2",
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
"dependencies": {
|
||||
"@discordjs/opus": "^0.8.0",
|
||||
"@discordjs/voice": "^0.11.0",
|
||||
"@sern/handler": "^1.2.0",
|
||||
"@sern/handler": "^1.2.1",
|
||||
"@xmldom/xmldom": "^0.8.2",
|
||||
"axios": "^0.27.2",
|
||||
"discord-bot-youtube-notifications": "^1.1.4",
|
||||
|
||||
Reference in New Issue
Block a user