minecraft TLauncher form working?

This commit is contained in:
2022-07-27 20:12:16 +02:00
parent d1a88834be
commit 343f12bfb5
8 changed files with 83 additions and 48 deletions

View File

@@ -1,24 +1,13 @@
vinci bot
this project started on a trip to Rome
and got a lot of support on the discord server
So here I am
development will start at the time this commit is pushed
# heres a roadmap
- form to apply for the minecraft server (WIP)
- ~~form to apply for the minecraft server~~ DONE!
- moderation commands
- welcome to users
- welcome to users (WIP)
- economy system?
- modmail
- socials notification system
- chatbot using IBM's AI (thanks @gosevil for the idea)
- joke command
2 forks! tysm!
Ok i ran out of ideas now
2 forks! tysm!

View File

@@ -10,7 +10,18 @@ export default commandModule({
//alias : [],
async execute (modal) {
const value = modal.fields.getTextInputValue('mcUsernameInput');
const tlvalue = modal.fields.getTextInputValue('tlauncherInput');
if (tlvalue === 'Si' || tlvalue === 'Si'.toLowerCase() || tlvalue === 'S' || tlvalue === 'S'.toLowerCase()){
// si dice que sí está permitido, no se envía el formulario y se dice que no se puede usar TLauncher porque patatín patatán
await modal.reply({content: '**Hola! No se ha enviado el formulario porque has respondido que sí.**\nTLauncher no se puede utilizar en el servidor oficial de Minecraft debido a la gran vulnerabilidad que nos supone tenerlo no premium.\nAhora que tienes en cuenta esto, si estás en no premium, no puedes hacer nada. Si tienes MC comprado, corre de nuevo el comando respondiendo que no.\nGracias', ephemeral: true})
} else if (tlvalue === 'No' || tlvalue === 'No'.toLowerCase() || tlvalue === 'N' || tlvalue === 'N'.toLowerCase()){
// si dice que no está permitido, se envía el formulario
await modal.reply({content: 'Enviado!, Gracias por utilizar tu Mona Lisa de confianza\n~Sr Izan, 2022', ephemeral: true})
modal.client.guilds.cache.get("928018226330337280").channels.cache.get("998195363376803850").send(`Solicitud enviada por ${modal.user}.\nUsername de Minecraft: ${value}`);
} else {
// 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

@@ -2,12 +2,6 @@ const { commandModule, CommandType } = require('@sern/handler');
const { ActionRowBuilder, ButtonBuilder, ButtonStyle, ModalBuilder, EmbedBuilder, TextInputBuilder, TextInputStyle, InteractionType } = require('discord.js');
import { publish } from "../src/plugins/publish";
import { ownerOnly } from "../src/plugins/ownerOnly"
const langChooser = new EmbedBuilder()
.setColor('#00ff00')
.setTitle('Language chooser')
.setDescription('Choose the language to show')
.addFields({name: ':flag_es: Spanish', value: 'click the flag', inline: true}, {name: ':flag_gb: English', value: 'click the flag', inline: true})
.setFooter({text: 'shoutout to tormentarosa who found the english flag'});
export default commandModule({
@@ -23,18 +17,25 @@ export default commandModule({
// Create the text input components
const input = new TextInputBuilder()
.setCustomId('mcUsernameInput')
.setCustomId('mcUsernameInput')
// The label is the prompt the user sees for this input
.setLabel("Cuál es tu nombre de usuario de Minecraft?")
// Short means only a single line of text
.setStyle(TextInputStyle.Short);
const tlinput = new TextInputBuilder()
.setCustomId('tlauncherInput')
// The label is the prompt the user sees for this input
.setLabel("Cuál es tu nombre de usuario de Minecraft?")
.setLabel("TLauncher está permitido? Di Si o No.")
// Short means only a single line of text
.setStyle(TextInputStyle.Short);
// An action row only holds one text input,
// so you need one action row per text input.
const usernameActionRow = new ActionRowBuilder().addComponents(input);
const tlActionRow = new ActionRowBuilder().addComponents(tlinput);
// Add inputs to the modal
modal.addComponents([usernameActionRow]);
modal.addComponents(usernameActionRow, tlActionRow);
await ctx.interaction.showModal(modal);
}
});

View File

@@ -1,3 +1,5 @@
import { eventModule, EventType, SernEmitter } from "@sern/handler";
const { Client, GatewayIntentBits } = require("discord.js");
const { Sern } = require("@sern/handler");
const dotenv = require("dotenv").config();
@@ -7,7 +9,22 @@ const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMembers, GatewayIntentBits.MessageContent]
});
Sern.init({client,sernPrefix,commands : './commands'});
Sern.init({client,
sernPrefix,
commands : './commands',
sernEmitter : new SernEmitter(),
events : [
{
absPath: process.cwd(),
mod: eventModule({
type: EventType.Sern,
name : 'error',
execute(err) {
console.log(err);
}
})
}
]});
client.on('ready', () => {
console.log("logged on!")

View File

@@ -0,0 +1,29 @@
const { commandModule, CommandType } = require('@sern/handler');
const { ActionRowBuilder, ButtonBuilder, ButtonStyle, ModalBuilder, EmbedBuilder, TextInputBuilder, TextInputStyle, InteractionType } = require('discord.js');
import { publish } from "../src/plugins/publish";
import { ownerOnly } from "../src/plugins/ownerOnly"
import { ApplicationCommandType } from "discord.js";
const langChooser = new EmbedBuilder()
.setColor('#00ff00')
.setTitle('Language chooser')
.setDescription('Choose the language to show')
.addFields({name: ':flag_es: Spanish', value: 'click the flag', inline: true}, {name: ':flag_gb: English', value: 'click the flag', inline: true})
.setFooter({text: 'shoutout to tormentarosa who found the english flag'});
export default commandModule({
name: 'ban',
type: CommandType.Both,
plugins: [publish(['1000400148289036298']), ownerOnly()],
description: 'ADMIN: Banea usuarios.',
options: [{name: 'usuario', required: true,description: 'menciona al usuario al que banear.',type: ApplicationCommandType.User}],
//alias : [],
execute: async (ctx, args, interaction, options, member) => {
const user = options[1]
if (ctx.message.member.roles.highest.position < member.roles.highest.position)
return ctx.reply({
content: `❌ | No puedes banear a una persona superior a tí.`
});
}
});

View File

@@ -10,18 +10,7 @@ export default commandModule({
//alias : [],
async execute (modal) {
const value = modal.fields.getTextInputValue('mcUsernameInput');
const tlvalue = modal.fields.getTextInputValue('tlauncherInput');
if (tlvalue === 'Si' || tlvalue === 'Si'.toLowerCase() || tlvalue === 'S' || tlvalue === 'S'.toLowerCase()){
// si dice que sí está permitido, no se envía el formulario y se dice que no se puede usar TLauncher porque patatín patatán
await modal.reply({content: '**Hola! No se ha enviado el formulario porque has respondido que sí.**\nTLauncher no se puede utilizar en el servidor oficial de Minecraft debido a la gran vulnerabilidad que nos supone tenerlo no premium.\nAhora que tienes en cuenta esto, si estás en no premium, no puedes hacer nada. Si tienes MC comprado, corre de nuevo el comando respondiendo que no.\nGracias', ephemeral: true})
} else if (tlvalue === 'No' || tlvalue === 'No'.toLowerCase() || tlvalue === 'N' || tlvalue === 'N'.toLowerCase()){
// si dice que no está permitido, se envía el formulario
await modal.reply({content: 'Enviado!, Gracias por utilizar tu Mona Lisa de confianza\n~Sr Izan, 2022', ephemeral: true})
modal.client.guilds.cache.get("928018226330337280").channels.cache.get("998195363376803850").send(`Solicitud enviada por ${modal.user}.\nUsername de Minecraft: ${value}`);
} else {
// 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

@@ -2,6 +2,12 @@ const { commandModule, CommandType } = require('@sern/handler');
const { ActionRowBuilder, ButtonBuilder, ButtonStyle, ModalBuilder, EmbedBuilder, TextInputBuilder, TextInputStyle, InteractionType } = require('discord.js');
import { publish } from "../src/plugins/publish";
import { ownerOnly } from "../src/plugins/ownerOnly"
const langChooser = new EmbedBuilder()
.setColor('#00ff00')
.setTitle('Language chooser')
.setDescription('Choose the language to show')
.addFields({name: ':flag_es: Spanish', value: 'click the flag', inline: true}, {name: ':flag_gb: English', value: 'click the flag', inline: true})
.setFooter({text: 'shoutout to tormentarosa who found the english flag'});
export default commandModule({
@@ -17,25 +23,18 @@ export default commandModule({
// Create the text input components
const input = new TextInputBuilder()
.setCustomId('mcUsernameInput')
// The label is the prompt the user sees for this input
.setLabel("Cuál es tu nombre de usuario de Minecraft?")
// Short means only a single line of text
.setStyle(TextInputStyle.Short);
const tlinput = new TextInputBuilder()
.setCustomId('tlauncherInput')
.setCustomId('mcUsernameInput')
// The label is the prompt the user sees for this input
.setLabel("TLauncher está permitido en el servidor? Di (S)i o (N)o.")
.setLabel("Cuál es tu nombre de usuario de Minecraft?")
// Short means only a single line of text
.setStyle(TextInputStyle.Short);
// An action row only holds one text input,
// so you need one action row per text input.
const usernameActionRow = new ActionRowBuilder().addComponents(input);
const tlActionRow = new ActionRowBuilder().addComponents(tlinput);
// Add inputs to the modal
modal.addComponents(usernameActionRow, tlActionRow);
modal.addComponents([usernameActionRow]);
await ctx.interaction.showModal(modal);
}
});

View File

@@ -24,7 +24,7 @@ export function ownerOnly(): EventPlugin<CommandType.Both> {
const [ctx] = event;
if (ownerIDs.includes(ctx.user.id)) return controller.next();
//* If you want to reply when the command fails due to user not being owner, you can use following
// await ctx.reply("Only owner can run it!!!");
await ctx.reply("❌: Sólo los administradores pueden correr este comando.");
return controller.stop(); //! Important: It stops the execution of command!
},
};