Compare commits

..

No commits in common. "c4574e47f6b7bbe7f44b1a452c3d7d40f496e94b" and "138ddb261cbbd3fea0d7e9687537977b27217ccc" have entirely different histories.

17 changed files with 27 additions and 233 deletions

View file

@ -32,8 +32,7 @@ export default {
await interaction.reply({ content: 'Autoresponse is already enabled, do you wish to disable it?', components: [row], ephemeral: true });
client.on('interactionCreate', async (interactionMenu) => {
if (interaction.user !== interactionMenu.user) return;
client.once('interactionCreate', async (interactionMenu) => {
if (!interactionMenu.isButton) return;
interactionMenu.update({ components: [] });
if (interactionMenu.customId === 'yes') {

View file

@ -44,8 +44,7 @@ export default {
await interaction.reply({ content: 'The server already has a message set, do you want to edit it or remove it?', components: [row], ephemeral: true });
client.on('interactionCreate', async (interactionMenu) => {
if (interaction.user !== interactionMenu.user) return;
client.once('interactionCreate', async (interactionMenu) => {
if (!interactionMenu.isButton) return;
interactionMenu.update({ components: [] });
if (interactionMenu.customId === 'edit') {

View file

@ -8,11 +8,11 @@ export default {
.setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages),
category: 'admin',
async execute(interaction, args, client) {
const quotationstat = await db.quotationStat.findOne({ where: { serverID: interaction.guild.id } });
const quotationstat = await db.quotationstat.findOne({ where: { serverID: interaction.guild.id } });
if (quotationstat.stat !== 'enable') {
const body = { serverID: interaction.guild.id, stat: 'enable' };
await db.quotationStat.create(body);
await db.quotationstat.create(body);
return await interaction.reply({ content: 'Quotation has been enabled.', ephemeral: true });
}
@ -32,13 +32,12 @@ export default {
await interaction.reply({ content: 'Quotation is already enabled, do you wish to disable it?', components: [row], ephemeral: true });
client.on('interactionCreate', async (interactionMenu) => {
if (interaction.user !== interactionMenu.user) return;
client.once('interactionCreate', async (interactionMenu) => {
if (!interactionMenu.isButton) return;
interactionMenu.update({ components: [] });
if (interactionMenu.customId === 'yes') {
const body = { serverID: interaction.guild.id, stat: 'disable' };
await db.quotationStat.update(body, { where: { serverID: interaction.guild.id } });
await db.quotationstat.update(body, { where: { serverID: interaction.guild.id } });
return interaction.editReply({ content: 'Quotation has been disabled.', ephemeral: true });
}
else {

View file

@ -1,38 +0,0 @@
import { SlashCommandBuilder, PermissionFlagsBits } from 'discord.js';
import fs from 'node:fs';
export default {
data: new SlashCommandBuilder()
.setName('shameboard')
.setDescription('Set shameboard to the current channel.')
.addStringOption(option =>
option.setName('emote')
.setDescription('The emote that should be used to enter the shameboard.'))
.addStringOption(option =>
option.setName('count')
.setDescription('How many react for it to enter shameboard.'))
.addBooleanOption(option =>
option.setName('remove')
.setDescription('Remove the shameboard')
.setRequired(false)),
category: 'admin',
userPermissions: [PermissionFlagsBits.ManageChannels],
async execute(interaction, args) {
if (args.remove) {
fs.unlink(`./json/board/shame${interaction.guild.id}.json`, (err) => {
if (err) {return interaction.reply('There is no shameboard');}
return interaction.reply('Deleted the shameboard');
});
}
else {
if (!args.emote || !args.count) return interaction.reply('You are missing the emote or the count arg!');
fs.writeFile(`./json/board/shame${interaction.guild.id}.json`, `{"shameboard": "${interaction.channel.id}", "emote": "${args.emote}", "count": "${args.count}"}`, (err) => {
if (err) {
console.log(err);
}
});
return interaction.reply(`This channel have been set as the shameboard with ${args.emote} with the minimum of ${args.count}`);
}
},
};

View file

@ -1,38 +0,0 @@
import { SlashCommandBuilder, PermissionFlagsBits } from 'discord.js';
import fs from 'node:fs';
export default {
data: new SlashCommandBuilder()
.setName('starboard')
.setDescription('Set starboard to the current channel.')
.addStringOption(option =>
option.setName('emote')
.setDescription('The emote that should be used to enter the starboard.'))
.addStringOption(option =>
option.setName('count')
.setDescription('How many react for it to enter starboard.'))
.addBooleanOption(option =>
option.setName('remove')
.setDescription('Remove the starboard')
.setRequired(false)),
category: 'admin',
userPermissions: [PermissionFlagsBits.ManageChannels],
async execute(interaction, args) {
if (args.remove) {
fs.unlink(`./json/board/star${interaction.guild.id}.json`, (err) => {
if (err) {return interaction.reply('There is no starboard');}
return interaction.reply('Deleted the starboard');
});
}
else {
if (!args.emote || !args.count) return interaction.reply('You are missing the emote or the count arg!');
fs.writeFile(`./json/board/star${interaction.guild.id}.json`, `{"starboard": "${interaction.channel.id}", "emote": "${args.emote}", "count": "${args.count}"}`, (err) => {
if (err) {
console.log(err);
}
});
return interaction.reply(`This channel have been set as the starboard with ${args.emote} with the minimum of ${args.count}`);
}
},
};

View file

@ -45,8 +45,7 @@ export default {
await interaction.reply({ content: 'The server already has a message set, do you want to edit it or remove it?', components: [row], ephemeral: true });
client.on('interactionCreate', async (interactionMenu) => {
if (interaction.user !== interactionMenu.user) return;
client.once('interactionCreate', async (interactionMenu) => {
if (!interactionMenu.isButton) return;
interactionMenu.update({ components: [] });
if (interactionMenu.customId === 'edit') {

View file

@ -1,93 +0,0 @@
// Tried something to make it work purely with slash commands but it did not work.
// The interaction created from a modal lack the showModal function so I can't just call another modal on top
// A "solution" for this that I could see is creating a button between each response asking the player to continue or stop which would create a new interaction and (maybe) allow to display a new modal
import { SlashCommandBuilder, ActionRowBuilder, TextInputBuilder, SelectMenuBuilder, ModalBuilder, TextInputStyle, InteractionType } from 'discord.js';
export default {
data: new SlashCommandBuilder()
.setName('guess')
.setDescription('Guess the number'),
category: 'fun',
async execute(interaction, args, client) {
const row = new ActionRowBuilder()
.addComponents(
new SelectMenuBuilder()
.setCustomId('difficulty')
.setPlaceholder('Nothing selected')
.addOptions([
{ label: 'Easy', value: '100' },
{ label: 'Normal', value: '1000' },
{ label: 'Hard', value: '10000' },
]),
);
await interaction.reply({ content: 'Which difficulty do you want to play?', ephemeral: true, components: [row] });
let numberTry = 0;
let secretnumber = 0;
client.on('interactionCreate', async (interactionMenu) => {
if (interaction.user !== interactionMenu.user) return;
const modal = new ModalBuilder()
.setCustomId('guessModal')
.setTitle('Your guess');
const textRow = new ActionRowBuilder()
.addComponents(
new TextInputBuilder()
.setCustomId('input')
.setLabel('What is the number?')
.setStyle(TextInputStyle.Short),
);
modal.addComponents(textRow);
async function tryAgain(input) {
if (input != secretnumber) {
if (input > secretnumber) {
modal.setTitle('Its less!\nWhat is the number?');
}
else if (input < secretnumber) {
modal.setTitle('Its more!\nWhat is the number?');
}
}
await interactionMenu.showModal(modal);
}
async function checkNumber(input) {
numberTry++;
if (input.toLowerCase() === 'stop') {
return interaction.reply('Ok, let\'s stop playing :(');
}
else if (input != secretnumber) {
console.log('trying again');
tryAgain(input);
}
else if (numberTry > 1) {
return interaction.reply(`Congratulations! You won! It took you ${numberTry} turns!`);
}
else {
return interaction.reply('Congratulations! You won! It took you 1 Turn!');
}
}
if (interactionMenu.type === InteractionType.ModalSubmit) {
if (interactionMenu.customId === 'guessModal') {
const input = interactionMenu.fields.getTextInputValue('input');
checkNumber(input);
}
}
else if (interactionMenu.isSelectMenu()) {
if (interactionMenu.customId === 'difficulty') {
secretnumber = Math.floor((Math.random() * parseInt(interactionMenu.values[0])) + 1);
console.log(secretnumber);
// await interaction.followUp({ content: 'What is the number?', ephemeral: true });
await interactionMenu.showModal(modal);
}
}
});
},
};

View file

@ -59,7 +59,7 @@ export default {
if (tweet) {
// Detect banned word (Blacklist the user directly)
if (wordToCensor.includes(tweet) || wordToCensor.includes(tweet.substring(0, tweet.length - 1)) || wordToCensor.includes(tweet.substring(1, tweet.length))) {
if (wordToCensor.includes(tweet) || wordToCensor.includes(tweet.substr(0, tweet.length - 1)) || wordToCensor.includes(tweet.substr(1, tweet.length))) {
const body = { type:'tweet', uid: interaction.user.id, reason: 'Automatic ban from banned word.' };
Blacklists.create(body);

View file

@ -54,8 +54,7 @@ export default {
await interaction.editReply({ content: 'This user is already blacklisted, do you want to unblacklist him?', ephemeral: true, components: [row] });
interaction.client.on('interactionCreate', async (interactionMenu) => {
if (interaction.user !== interactionMenu.user) return;
interaction.client.once('interactionCreate', async (interactionMenu) => {
if (!interactionMenu.isButton) return;
interactionMenu.update({ components: [] });
if (interactionMenu.customId === 'yes') {

View file

@ -24,9 +24,8 @@ export default {
const epicMessage = ['You cheated not ONLY the GAME, BUT yourself. You didn\'t GROW. You didn\'t IMPROVE. You TOOK a SHORTCUT and gained NOTHING. You EXPERIENCED a HOLLOW victory. NOTHING WAS risked and NOTHING WAS gained. It\'s SAD that you don\'t KNOW the DIFFERENCE.', 'TROLOLOLO OWNED EPIC STYLE', 'Owned noob', 'HAHA BRO YOU JUST GOT OOOOOOOOWNED HAHAHAHAHHAHA NOOOB NOOOOB NOOOB OWNED NOOB <:youngtroll:488559163832795136>', '<a:op:516341492982218756> op op op owned epic style <a:op:516341492982218756>', 'HAHAHA BRO YOU HAVE BEEN OWNED TROLL BRO STYLE', 'OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED YOU JUST GOT OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED YOU JUST GOT OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED YOU JUST GOT OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED OWNED YOU JUST GOT OWNED', 'OWNED\nFUCKING OWNED', 'OWNED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!', 'You just got owned <a:troll:525724709833277442>', 'you just been....epicly trolled <:trole:241942993022615552>', 'I hope you have a nice day, just a simple reminder that I love you and I think you\'re pretty epic!!!!'];
const ownedMessage = epicMessage[Math.floor(Math.random() * epicMessage.length)];
await interaction.guild.members.fetch();
let owned = args.somethingelse ? interaction.guild.members.cache.find(u => u.user.username.toLowerCase().includes(args.somethingelse.toLowerCase())) : null;
if (interaction.isMessage) {
if (interaction.mentions.members.first()) {
console.log('test');
@ -34,6 +33,8 @@ export default {
}
}
await interaction.guild.members.fetch();
if (args.somethingelse) {
if (owned.id === client.user.id) {

View file

@ -63,7 +63,6 @@ export default {
const options = [];
qualitys.formats.forEach(f => {
if (f.format.includes('storyboard')) return;
options.push({
label: f.resolution ? f.resolution : 'Unknown format',
description: `${f.format} V: ${f.vcodec} A: ${f.acodec}`,
@ -100,8 +99,7 @@ export default {
await interaction.deleteReply();
await interaction.followUp({ content: 'Which quality do you want?', ephemeral: true, components: [row] });
client.on('interactionCreate', async (interactionMenu) => {
if (interaction.user !== interactionMenu.user) return;
client.once('interactionCreate', async (interactionMenu) => {
if (!interactionMenu.isSelectMenu()) return;
if (interactionMenu.customId === 'downloadQuality') {
await interactionMenu.deferReply({ ephemeral: false });
@ -155,13 +153,12 @@ async function download(url, interaction, originalInteraction) {
await interaction.deleteReply();
await interaction.followUp({ content: 'Which compression preset do you want?', ephemeral: true, components: [row] });
client.on('interactionCreate', async (interactionMenu) => {
if (interaction.user !== interactionMenu.user) return;
client.once('interactionCreate', async (interactionMenu) => {
if (!interactionMenu.isSelectMenu()) return;
if (interactionMenu.customId === 'preset') {
await interactionMenu.deferReply({ ephemeral: false });
compress(file, interactionMenu, Embed);
if (interaction.isMessage) cleanUp();
cleanUp();
}
});
return;
@ -182,7 +179,7 @@ async function download(url, interaction, originalInteraction) {
else {
await interaction.editReply({ embeds: [Embed], files: [output], ephemeral: false });
}
if (interaction.isMessage) cleanUp();
cleanUp();
})
.catch(async err => {
console.error(err);

View file

@ -31,8 +31,7 @@ export default {
await interaction.reply({ content: 'You are already opt out, do you wish to opt in?', components: [row] });
client.on('interactionCreate', async (interactionMenu) => {
if (interaction.user !== interactionMenu.user) return;
client.once('interactionCreate', async (interactionMenu) => {
if (!interactionMenu.isButton) return;
interactionMenu.update({ components: [] });
if (interactionMenu.customId === 'yes') {

View file

@ -381,11 +381,14 @@ export default {
else if (type.includes('attachment')) {
payload = message.attachments.first();
}
if (payload.startsWith('--')) {
arg.name = payload.substring(2);
else if (type.includes('boolean')) {
if (messageArgs[i].toLowerCase() === `--${arg.name.toLowerCase()}`) {
payload = true;
}
else {
payload = false;
}
}
args[arg.name] = payload;
}

View file

@ -13,16 +13,14 @@ export default {
});
}
/* I don't really know why this is causing issues.
if (reaction.message.partial) {
await reaction.message.fetch()
.catch(err => {
return console.error(err);
});
}
*/
const isOptOut = await db.optout.findOne({ where: { userID: reaction.message.author.id } });
const isOptOut = await db.optout.findOne({ where: { userID: reaction.message.author } });
if (isOptOut) return;
let starboardChannel, shameboardChannel;

View file

@ -13,16 +13,14 @@ export default {
});
}
/* I don't really know why this is causing issues.
if (reaction.message.partial) {
await reaction.message.fetch()
.catch(err => {
return console.error(err);
});
}
*/
const isOptOut = await db.optout.findOne({ where: { userID: reaction.message.author.id } });
const isOptOut = await db.optout.findOne({ where: { userID: reaction.message.author } });
if (isOptOut) return;
let starboardChannel, shameboardChannel;

View file

@ -193,34 +193,6 @@ const commands = [
.addStringOption(option =>
option.setName('command')
.setDescription('The command you want more details about.')),
new SlashCommandBuilder()
.setName('shameboard')
.setDescription('Set shameboard to the current channel.')
.addStringOption(option =>
option.setName('emote')
.setDescription('The emote that should be used to enter the shameboard.'))
.addStringOption(option =>
option.setName('count')
.setDescription('How many react for it to enter shameboard.'))
.addBooleanOption(option =>
option.setName('remove')
.setDescription('Remove the shameboard')
.setRequired(false)),
new SlashCommandBuilder()
.setName('starboard')
.setDescription('Set starboard to the current channel.')
.addStringOption(option =>
option.setName('emote')
.setDescription('The emote that should be used to enter the starboard.'))
.addStringOption(option =>
option.setName('count')
.setDescription('How many react for it to enter starboard.'))
.addBooleanOption(option =>
option.setName('remove')
.setDescription('Remove the starboard')
.setRequired(false)),
]
.map(command => command.toJSON());

View file

@ -10,7 +10,7 @@ export default {
};
async function downloadVideo(urlArg, output, format = 'bestvideo*+bestaudio/best') {
await new Promise((resolve, reject) => {
exec(`./bin/yt-dlp -f ${format} "${urlArg}" -o "${os.tmpdir()}/${output}.%(ext)s" --force-overwrites --no-playlist --merge-output-format=mp4/webm/mov`, (err, stdout, stderr) => {
exec(`./bin/yt-dlp -f ${format} "${urlArg}" -o "${os.tmpdir()}/${output}.%(ext)s" --force-overwrites --no-playlist`, (err, stdout, stderr) => {
if (err) {
reject(stderr);
}