V14 update, added category and made it work with message event

pull/1/head
Supositware 2 years ago
parent bb49cfd490
commit ef61db520b

@ -1,5 +1,5 @@
import { SlashCommandBuilder } from '@discordjs/builders'; import { SlashCommandBuilder } from 'discord.js';
import { MessageEmbed } from 'discord.js'; import { EmbedBuilder } from 'discord.js';
import TurndownService from 'turndown'; import TurndownService from 'turndown';
const turndown = new TurndownService(); const turndown = new TurndownService();
import fetch from 'node-fetch'; import fetch from 'node-fetch';
@ -14,8 +14,9 @@ export default {
option.setName('board') option.setName('board')
.setDescription('The board you wish to see') .setDescription('The board you wish to see')
.setRequired(true)), .setRequired(true)),
async execute(interaction) { category: 'fun',
let board = interaction.options.getString('board'); async execute(interaction, args) {
let board = args[0];
if (fourChan[board] == undefined) { if (fourChan[board] == undefined) {
return interaction.reply({ content: 'Uh oh! The board you are looking for does not exist? You think this is a mistake? Please send a feedback telling me so!', ephemeral: true }); return interaction.reply({ content: 'Uh oh! The board you are looking for does not exist? You think this is a mistake? Please send a feedback telling me so!', ephemeral: true });
@ -65,7 +66,7 @@ export default {
title = 'No title'; title = 'No title';
} }
const FourchanEmbed = new MessageEmbed() const FourchanEmbed = new EmbedBuilder()
.setColor(interaction.member ? interaction.member.displayHexColor : 'NAVY') .setColor(interaction.member ? interaction.member.displayHexColor : 'NAVY')
.setTitle(turndown.turndown(title)) .setTitle(turndown.turndown(title))
.setDescription(turndown.turndown(description)) .setDescription(turndown.turndown(description))

@ -1,5 +1,5 @@
import { SlashCommandBuilder } from '@discordjs/builders'; import { SlashCommandBuilder } from 'discord.js';
import { Permissions } from 'discord.js'; import { PermissionFlagsBits } from 'discord.js';
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('fakeuser') .setName('fakeuser')
@ -16,12 +16,14 @@ export default {
option.setName('image') option.setName('image')
.setDescription('Optional attachment.') .setDescription('Optional attachment.')
.setRequired(false)), .setRequired(false)),
clientPermissions: [ Permissions.FLAGS.MANAGE_WEBHOOKS ], category: 'fun',
async execute(interaction) { clientPermissions: [ PermissionFlagsBits.ManageWebhooks ],
async execute(interaction, args) {
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ ephemeral: true });
const attachment = interaction.options.getAttachment('image'); const member = args[0];
const message = interaction.options.getString('message'); const message = args[1];
const member = interaction.options.getMentionable('user'); const attachment = args[2];
const webhook = await interaction.channel.createWebhook(member.user.username, { const webhook = await interaction.channel.createWebhook(member.user.username, {
avatar: member.user.displayAvatarURL(), avatar: member.user.displayAvatarURL(),

@ -1,10 +1,11 @@
import { SlashCommandBuilder } from '@discordjs/builders'; import { SlashCommandBuilder } from 'discord.js';
import fetch from 'node-fetch'; import fetch from 'node-fetch';
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('inspirobot') .setName('inspirobot')
.setDescription('Get an image from inspirobot'), .setDescription('Get an image from inspirobot'),
category: 'fun',
async execute(interaction) { async execute(interaction) {
fetch('http://inspirobot.me/api?generate=true') fetch('http://inspirobot.me/api?generate=true')
.then(res => res.text()) .then(res => res.text())

@ -1,5 +1,5 @@
import { SlashCommandBuilder } from '@discordjs/builders'; import { SlashCommandBuilder } from 'discord.js';
import { MessageEmbed } from 'discord.js'; import { EmbedBuilder } from 'discord.js';
import fetch from 'node-fetch'; import fetch from 'node-fetch';
export default { export default {
@ -10,10 +10,11 @@ export default {
option.setName('subreddit') option.setName('subreddit')
.setDescription('The subreddit you wish to see') .setDescription('The subreddit you wish to see')
.setRequired(true)), .setRequired(true)),
async execute(interaction) { category: 'fun',
async execute(interaction, args) {
await interaction.deferReply({ ephemeral: false }); await interaction.deferReply({ ephemeral: false });
const subreddit = args[0];
fetch('https://www.reddit.com/r/' + interaction.options.getString('subreddit') + '.json?limit=100').then((response) => { fetch('https://www.reddit.com/r/' + subreddit + '.json?limit=100').then((response) => {
return response.json(); return response.json();
}).then((response) => { }).then((response) => {
if (response.error == 404) { if (response.error == 404) {
@ -27,7 +28,7 @@ export default {
if (response.data.children[i].data.over_18 == true && !interaction.channel.nsfw) { if (response.data.children[i].data.over_18 == true && !interaction.channel.nsfw) {
return interaction.editReply('No nsfw'); return interaction.editReply('No nsfw');
} }
const redditEmbed = new MessageEmbed() const redditEmbed = new EmbedBuilder()
.setColor(interaction.member ? interaction.member.displayHexColor : 'NAVY') .setColor(interaction.member ? interaction.member.displayHexColor : 'NAVY')
.setTitle(response.data.children[i].data.title) .setTitle(response.data.children[i].data.title)
.setDescription(response.data.children[i].data.selftext) .setDescription(response.data.children[i].data.selftext)

@ -1,4 +1,4 @@
import { SlashCommandBuilder } from '@discordjs/builders'; import { SlashCommandBuilder } from 'discord.js';
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
@ -8,8 +8,9 @@ export default {
option.setName('something') option.setName('something')
.setDescription('🤫') .setDescription('🤫')
.setRequired(true)), .setRequired(true)),
async execute(interaction) { category: 'fun',
const command = interaction.options.getString('something'); async execute(interaction, args) {
const command = args[0];
if (command === 'levertowned') { if (command === 'levertowned') {
interaction.reply('Hello buddy bro <:youngtroll:488559163832795136> <@434762632004894746>'); interaction.reply('Hello buddy bro <:youngtroll:488559163832795136> <@434762632004894746>');

@ -1,5 +1,5 @@
import { SlashCommandBuilder } from '@discordjs/builders'; import { SlashCommandBuilder } from 'discord.js';
import { MessageEmbed } from 'discord.js'; import { EmbedBuilder } from 'discord.js';
import Twit from 'twit'; import Twit from 'twit';
import fetch from 'node-fetch'; import fetch from 'node-fetch';
import os from 'node:os'; import os from 'node:os';
@ -25,16 +25,19 @@ export default {
option.setName('image') option.setName('image')
.setDescription('Optional attachment (Image only.)') .setDescription('Optional attachment (Image only.)')
.setRequired(false)), .setRequired(false)),
category: 'fun',
ratelimit: 3, ratelimit: 3,
cooldown: 3600, cooldown: 3600,
async execute(interaction) { async execute(interaction, args, client) {
if (!interaction.options.getString('content') && !interaction.options.getAttachment('image')) { const content = args[0];
const attachment = args[1];
if (!content && !attachment) {
return interaction.reply({ content: 'Uh oh! You are missing any content for me to tweet!', ephemeral: true }); return interaction.reply({ content: 'Uh oh! You are missing any content for me to tweet!', ephemeral: true });
} }
await interaction.deferReply({ ephemeral: false }); await interaction.deferReply({ ephemeral: false });
let tweet = interaction.options.getString('content'); let tweet = content;
const attachment = interaction.options.getAttachment('image');
const date = new Date(); const date = new Date();
// If account is less than 6 months old don't accept the tweet ( alt prevention ) // If account is less than 6 months old don't accept the tweet ( alt prevention )
if (interaction.user.createdAt > date.setMonth(date.getMonth() - 6)) { if (interaction.user.createdAt > date.setMonth(date.getMonth() - 6)) {
@ -170,30 +173,34 @@ export default {
const TweetLink = `https://twitter.com/${FunnyWords[Math.floor((Math.random() * FunnyWords.length))]}/status/${tweetid}`; const TweetLink = `https://twitter.com/${FunnyWords[Math.floor((Math.random() * FunnyWords.length))]}/status/${tweetid}`;
// Im too lazy for now to make an entry in config.json // Im too lazy for now to make an entry in config.json
let channel = interaction.client.channels.resolve(twiChannel); let channel = client.channels.resolve(twiChannel);
channel.send(TweetLink); channel.send(TweetLink);
const Embed = new MessageEmbed() const Embed = new EmbedBuilder()
.setAuthor({ name: interaction.user.username, iconURL: interaction.user.displayAvatarURL() }) .setAuthor({ name: interaction.user.username, iconURL: interaction.user.displayAvatarURL() })
.setDescription(tweet) .setDescription(tweet)
.addField('Link', TweetLink, true) .addFields(
.addField('Tweet ID', tweetid, true) { name: 'Link', value: TweetLink, inline: true },
.addField('Channel ID', interaction.channel.id, true) { name: 'Tweet ID', value: tweetid, inline: true },
.addField('Messsage ID', interaction.id, true) { name: 'Channel ID', value: interaction.channel.id, inline: true },
.addField('Author', `${interaction.user.username} (${interaction.user.id})`, true) { name: 'Message ID', value: interaction.id, inline: true },
{ name: 'Author', value: `${interaction.user.username} (${interaction.user.id})`, inline: true },
)
.setTimestamp(); .setTimestamp();
if (interaction.guild) { if (interaction.guild) {
Embed.addField('Guild', `${interaction.guild.name} (${interaction.guild.id})`, true); Embed.addFields(
Embed.addField('message link', `https://discord.com/channels/${interaction.guild.id}/${interaction.channel.id}/${interaction.id}`); { name: 'Guild', value: `${interaction.guild.name} (${interaction.guild.id})`, inline: true },
{ name: 'message link', value: `https://discord.com/channels/${interaction.guild.id}/${interaction.channel.id}/${interaction.id}`, inline: true },
);
} }
else { else {
Embed.addField('message link', `https://discord.com/channels/@me/${interaction.channel.id}/${interaction.id}`); Embed.addFields({ name: 'message link', value: `https://discord.com/channels/@me/${interaction.channel.id}/${interaction.id}` });
} }
if (attachment) Embed.setImage(attachment.url); if (attachment) Embed.setImage(attachment.url);
channel = interaction.client.channels.resolve(twiLogChannel); channel = client.channels.resolve(twiLogChannel);
channel.send({ embeds: [Embed] }); channel.send({ embeds: [Embed] });
return interaction.editReply({ content: `Go see ur epic tweet ${TweetLink}` }); return interaction.editReply({ content: `Go see ur epic tweet ${TweetLink}` });
}); });

@ -1,4 +1,4 @@
import { SlashCommandBuilder } from '@discordjs/builders'; import { SlashCommandBuilder } from 'discord.js';
import Twit from 'twit'; import Twit from 'twit';
import dotenv from 'dotenv'; import dotenv from 'dotenv';
@ -13,6 +13,7 @@ export default {
option.setName('tweetid') option.setName('tweetid')
.setDescription('The id of the tweet you wish to delete.') .setDescription('The id of the tweet you wish to delete.')
.setRequired(true)), .setRequired(true)),
category: 'owner',
ownerOnly: true, ownerOnly: true,
async execute(interaction) { async execute(interaction) {
await interaction.deferReply(); await interaction.deferReply();

@ -1,9 +1,10 @@
import { SlashCommandBuilder } from '@discordjs/builders'; import { SlashCommandBuilder } from 'discord.js';
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('die') .setName('die')
.setDescription('Kill the bot'), .setDescription('Kill the bot'),
category: 'owner',
ownerOnly: true, ownerOnly: true,
async execute(interaction) { async execute(interaction) {
console.log('\x1b[31m\x1b[47m\x1b[5mSHUTING DOWN!!!!!\x1b[0m'); console.log('\x1b[31m\x1b[47m\x1b[5mSHUTING DOWN!!!!!\x1b[0m');

@ -1,5 +1,4 @@
import { SlashCommandBuilder } from '@discordjs/builders'; import { ButtonStyle, SlashCommandBuilder, ButtonBuilder, ActionRowBuilder } from 'discord.js';
import { MessageButton, MessageActionRow } from 'discord.js';
import db from '../../models/index.js'; import db from '../../models/index.js';
const Blacklists = db.Blacklists; const Blacklists = db.Blacklists;
@ -19,6 +18,7 @@ export default {
option.setName('reason') option.setName('reason')
.setDescription('The reason of the blacklist.') .setDescription('The reason of the blacklist.')
.setRequired(false)), .setRequired(false)),
category: 'owner',
ownerOnly: true, ownerOnly: true,
async execute(interaction) { async execute(interaction) {
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ ephemeral: true });
@ -38,18 +38,18 @@ export default {
return interaction.editReply(`${user} has been blacklisted from ${command} with the following reason ${reason}`); return interaction.editReply(`${user} has been blacklisted from ${command} with the following reason ${reason}`);
} }
else { else {
const row = new MessageActionRow() const row = new ActionRowBuilder()
.addComponents( .addComponents(
new MessageButton() new ButtonBuilder()
.setCustomId('yes') .setCustomId('yes')
.setLabel('Yes') .setLabel('Yes')
.setStyle('PRIMARY'), .setStyle(ButtonStyle.Primary),
) )
.addComponents( .addComponents(
new MessageButton() new ButtonBuilder()
.setCustomId('no') .setCustomId('no')
.setLabel('No') .setLabel('No')
.setStyle('DANGER'), .setStyle(ButtonStyle.Danger),
); );
await interaction.editReply({ content: 'This user is already blacklisted, do you want to unblacklist him?', ephemeral: true, components: [row] }); await interaction.editReply({ content: 'This user is already blacklisted, do you want to unblacklist him?', ephemeral: true, components: [row] });

@ -1,5 +1,5 @@
import { SlashCommandBuilder } from '@discordjs/builders'; import { SlashCommandBuilder } from 'discord.js';
import { MessageEmbed } from 'discord.js'; import { EmbedBuilder } from 'discord.js';
import { exec } from 'node:child_process'; import { exec } from 'node:child_process';
import db from '../../models/index.js'; import db from '../../models/index.js';
const donator = db.donator; const donator = db.donator;
@ -12,6 +12,7 @@ export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('about') .setName('about')
.setDescription('About me (The bot)'), .setDescription('About me (The bot)'),
category: 'utility',
async execute(interaction) { async execute(interaction) {
const Donator = await donator.findAll({ order: ['id'] }); const Donator = await donator.findAll({ order: ['id'] });
const client = interaction.client; const client = interaction.client;
@ -39,16 +40,19 @@ export default {
// description += '\nThanks to Jetbrains for providing their IDE!'; // description += '\nThanks to Jetbrains for providing their IDE!';
exec('git rev-parse --short HEAD', (err, stdout) => { exec('git rev-parse --short HEAD', (err, stdout) => {
const aboutEmbed = new MessageEmbed() const aboutEmbed = new EmbedBuilder()
.setColor(interaction.member ? interaction.member.displayHexColor : 'NAVY') .setColor(interaction.member ? interaction.member.displayHexColor : 'NAVY')
.setAuthor({ name: client.user.tag, iconURL: client.user.displayAvatarURL(), url: 'https://libtar.de' }) .setAuthor({ name: client.user.tag, iconURL: client.user.displayAvatarURL(), url: 'https://libtar.de' })
.setTitle('About me') .setTitle('About me')
.setDescription(description) .setDescription(description)
.addField('Current commit', stdout) .addFields(
.addField('Current maintainer: ', `${maintainer.tag} (${ownerId})`) { name: 'Current commit', value: stdout },
.addField('Gitea (Main)', 'https://git.namejeff.xyz/Supositware/Haha-Yes', true) { name: 'Current maintainer', value: `${maintainer.tag} (${ownerId})` },
.addField('Github (Mirror)', 'https://github.com/Supositware/Haha-yes', true) { name: 'Gitea (Main)', value: 'https://git.namejeff.xyz/Supositware/Haha-Yes', inline: true },
.addField('Privacy Policy', 'https://libtar.de/discordprivacy.txt') { name: 'Github (Mirror)', value: 'https://github.com/Supositware/Haha-yes', inline: true },
{ name: 'Privacy Policy', value: 'https://libtar.de/discordprivacy.txt' },
)
.setFooter({ text: `Original bot made by ${owner.tag} (267065637183029248)` }); .setFooter({ text: `Original bot made by ${owner.tag} (267065637183029248)` });
interaction.reply({ embeds: [aboutEmbed] }); interaction.reply({ embeds: [aboutEmbed] });

@ -1,18 +1,19 @@
import { SlashCommandBuilder } from '@discordjs/builders'; import { SlashCommandBuilder } from 'discord.js';
import { MessageEmbed } from 'discord.js'; import { EmbedBuilder } from 'discord.js';
import donations from '../../json/donations.json' assert {type: 'json'}; import donations from '../../json/donations.json' assert {type: 'json'};
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('donate') .setName('donate')
.setDescription('Show donation link for the bot.'), .setDescription('Show donation link for the bot.'),
category: 'utility',
async execute(interaction) { async execute(interaction) {
let desc = 'If you decide to donate, please do /feedback to let the owner know about it so he can put you in the about and donator command.'; let desc = 'If you decide to donate, please do /feedback to let the owner know about it so he can put you in the about and donator command.';
donations.forEach(m => { donations.forEach(m => {
desc += `\n${m}`; desc += `\n${m}`;
}); });
const Embed = new MessageEmbed() const Embed = new EmbedBuilder()
.setColor(interaction.member ? interaction.member.displayHexColor : 'NAVY') .setColor(interaction.member ? interaction.member.displayHexColor : 'NAVY')
.setTitle('Donation link') .setTitle('Donation link')
.setDescription(desc); .setDescription(desc);

@ -1,4 +1,4 @@
import { SlashCommandBuilder } from '@discordjs/builders'; import { SlashCommandBuilder } from 'discord.js';
import db from '../../models/index.js'; import db from '../../models/index.js';
const donator = db.donator; const donator = db.donator;
@ -6,6 +6,7 @@ export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('donator') .setName('donator')
.setDescription('All the people who donated for this bot <3'), .setDescription('All the people who donated for this bot <3'),
category: 'utility',
async execute(interaction) { async execute(interaction) {
await interaction.deferReply(); await interaction.deferReply();
const client = interaction.client; const client = interaction.client;

@ -1,10 +1,12 @@
import { SlashCommandBuilder } from '@discordjs/builders'; import { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, SelectMenuBuilder } from 'discord.js';
import { MessageEmbed, MessageActionRow, MessageSelectMenu } from 'discord.js';
import { exec } from 'node:child_process'; import { exec } from 'node:child_process';
import fs from 'node:fs'; import fs from 'node:fs';
import os from 'node:os'; import os from 'node:os';
import utils from '../../utils/videos.js'; import utils from '../../utils/videos.js';
let client;
let cleanUp;
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('download') .setName('download')
@ -21,17 +23,29 @@ export default {
option.setName('compress') option.setName('compress')
.setDescription('Compress the video?') .setDescription('Compress the video?')
.setRequired(false)), .setRequired(false)),
category: 'utility',
async execute(interaction, args, c) {
client = c;
const url = args[0];
const format = args[1];
interaction.doCompress = args[2];
if (interaction.cleanUp) {
cleanUp = interaction.cleanUp;
}
async execute(interaction) {
await interaction.deferReply({ ephemeral: false }); await interaction.deferReply({ ephemeral: false });
const url = interaction.options.getString('url');
if (interaction.isMessage) {
interaction.delete();
}
if (!await utils.stringIsAValidurl(url)) { if (!await utils.stringIsAValidurl(url)) {
console.error(`Not a url!!! ${url}`); console.error(`Not a url!!! ${url}`);
return interaction.editReply({ content: '❌ This does not look like a valid url!', ephemeral: true }); return interaction.editReply({ content: '❌ This does not look like a valid url!', ephemeral: true });
} }
if (interaction.options.getBoolean('format')) { if (format) {
let qualitys = await new Promise((resolve, reject) => { let qualitys = await new Promise((resolve, reject) => {
exec(`./bin/yt-dlp "${url}" --print "%()j"`, (err, stdout, stderr) => { exec(`./bin/yt-dlp "${url}" --print "%()j"`, (err, stdout, stderr) => {
if (err) { if (err) {
@ -71,9 +85,9 @@ export default {
options.reverse(); options.reverse();
} }
const row = new MessageActionRow() const row = new ActionRowBuilder()
.addComponents( .addComponents(
new MessageSelectMenu() new SelectMenuBuilder()
.setCustomId('downloadQuality') .setCustomId('downloadQuality')
.setPlaceholder('Nothing selected') .setPlaceholder('Nothing selected')
.setMinValues(1) .setMinValues(1)
@ -84,7 +98,7 @@ export default {
await interaction.deleteReply(); await interaction.deleteReply();
await interaction.followUp({ content: 'Which quality do you want?', ephemeral: true, components: [row] }); await interaction.followUp({ content: 'Which quality do you want?', ephemeral: true, components: [row] });
interaction.client.once('interactionCreate', async (interactionMenu) => { client.once('interactionCreate', async (interactionMenu) => {
if (!interactionMenu.isSelectMenu()) return; if (!interactionMenu.isSelectMenu()) return;
if (interactionMenu.customId === 'downloadQuality') { if (interactionMenu.customId === 'downloadQuality') {
await interactionMenu.deferReply({ ephemeral: false }); await interactionMenu.deferReply({ ephemeral: false });
@ -99,7 +113,7 @@ export default {
async function download(url, interaction, originalInteraction) { async function download(url, interaction, originalInteraction) {
let format = 'bestvideo*+bestaudio/best'; let format = 'bestvideo*+bestaudio/best';
const Embed = new MessageEmbed() const Embed = new EmbedBuilder()
.setColor(interaction.member ? interaction.member.displayHexColor : 'NAVY') .setColor(interaction.member ? interaction.member.displayHexColor : 'NAVY')
.setAuthor({ name: `Downloaded by ${interaction.user.tag}`, iconURL: interaction.user.displayAvatarURL(), url: url }) .setAuthor({ name: `Downloaded by ${interaction.user.tag}`, iconURL: interaction.user.displayAvatarURL(), url: url })
.setFooter({ text: `You can get the original video by clicking on the "Downloaded by ${interaction.user.tag}" message!` }); .setFooter({ text: `You can get the original video by clicking on the "Downloaded by ${interaction.user.tag}" message!` });
@ -117,7 +131,7 @@ async function download(url, interaction, originalInteraction) {
const fileStat = fs.statSync(output); const fileStat = fs.statSync(output);
const fileSize = fileStat.size / 1000000.0; const fileSize = fileStat.size / 1000000.0;
const compressInteraction = originalInteraction ? originalInteraction : interaction; const compressInteraction = originalInteraction ? originalInteraction : interaction;
if (compressInteraction.options.getBoolean('compress')) { if (compressInteraction.doCompress) {
const presets = [ 'Discord Tiny 5 Minutes 240p30', 'Discord Small 2 Minutes 360p30', 'Discord Nitro Small 10-20 Minutes 480p30', 'Discord Nitro Medium 5-10 Minutes 720p30', 'Discord Nitro Large 3-6 Minutes 1080p30' ]; const presets = [ 'Discord Tiny 5 Minutes 240p30', 'Discord Small 2 Minutes 360p30', 'Discord Nitro Small 10-20 Minutes 480p30', 'Discord Nitro Medium 5-10 Minutes 720p30', 'Discord Nitro Large 3-6 Minutes 1080p30' ];
const options = []; const options = [];
@ -128,9 +142,9 @@ async function download(url, interaction, originalInteraction) {
}); });
}); });
const row = new MessageActionRow() const row = new ActionRowBuilder()
.addComponents( .addComponents(
new MessageSelectMenu() new SelectMenuBuilder()
.setCustomId('preset') .setCustomId('preset')
.setPlaceholder('Nothing selected') .setPlaceholder('Nothing selected')
.addOptions(options), .addOptions(options),
@ -138,11 +152,12 @@ async function download(url, interaction, originalInteraction) {
await interaction.deleteReply(); await interaction.deleteReply();
await interaction.followUp({ content: 'Which compression preset do you want?', ephemeral: true, components: [row] }); await interaction.followUp({ content: 'Which compression preset do you want?', ephemeral: true, components: [row] });
interaction.client.once('interactionCreate', async (interactionMenu) => { client.once('interactionCreate', async (interactionMenu) => {
if (!interactionMenu.isSelectMenu()) return; if (!interactionMenu.isSelectMenu()) return;
if (interactionMenu.customId === 'preset') { if (interactionMenu.customId === 'preset') {
await interactionMenu.deferReply({ ephemeral: false }); await interactionMenu.deferReply({ ephemeral: false });
compress(file, interactionMenu, Embed); compress(file, interactionMenu, Embed);
cleanUp();
} }
}); });
return; return;
@ -163,6 +178,7 @@ async function download(url, interaction, originalInteraction) {
else { else {
await interaction.editReply({ embeds: [Embed], files: [output], ephemeral: false }); await interaction.editReply({ embeds: [Embed], files: [output], ephemeral: false });
} }
cleanUp();
}) })
.catch(async err => { .catch(async err => {
console.error(err); console.error(err);

@ -1,5 +1,5 @@
import { SlashCommandBuilder } from '@discordjs/builders'; import { SlashCommandBuilder } from 'discord.js';
import { MessageEmbed } from 'discord.js'; import { EmbedBuilder } from 'discord.js';
const { feedbackChannelId } = process.env; const { feedbackChannelId } = process.env;
@ -11,13 +11,14 @@ export default {
option.setName('feedback') option.setName('feedback')
.setDescription('The message you want to send me.') .setDescription('The message you want to send me.')
.setRequired(true)), .setRequired(true)),
async execute(interaction) { category: 'utility',
const Embed = new MessageEmbed() async execute(interaction, args) {
const Embed = new EmbedBuilder()
.setAuthor({ name: `${interaction.user.tag} (${interaction.user.id})`, iconURL: interaction.user.avatarURL() }) .setAuthor({ name: `${interaction.user.tag} (${interaction.user.id})`, iconURL: interaction.user.avatarURL() })
.setTimestamp(); .setTimestamp();
if (interaction.guild) Embed.addField('Guild', `${interaction.guild.name} (${interaction.guild.id})`, true); if (interaction.guild) Embed.addFields({ name: 'Guild', value: `${interaction.guild.name} (${interaction.guild.id})`, inline: true });
Embed.addField('Feedback', interaction.options.getString('feedback')); Embed.addFields({ name: 'Feedback', value: args[0], inline: true });
// Don't let new account use this command to prevent spam // Don't let new account use this command to prevent spam
const date = new Date(); const date = new Date();

@ -1,9 +1,10 @@
import { SlashCommandBuilder } from '@discordjs/builders'; import { SlashCommandBuilder } from 'discord.js';
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('ping') .setName('ping')
.setDescription('Replies with Pong!'), .setDescription('Replies with Pong!'),
category: 'utility',
async execute(interaction) { async execute(interaction) {
await interaction.reply(`Pong! \`${Math.round(interaction.client.ws.ping)} ms\``); await interaction.reply(`Pong! \`${Math.round(interaction.client.ws.ping)} ms\``);
}, },

@ -1,11 +1,12 @@
import { SlashCommandBuilder } from '@discordjs/builders'; import { SlashCommandBuilder } from 'discord.js';
import { MessageEmbed, version } from 'discord.js'; import { EmbedBuilder, version } from 'discord.js';
import os from 'node:os'; import os from 'node:os';
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('stats') .setName('stats')
.setDescription('Show some stats about the bot'), .setDescription('Show some stats about the bot'),
category: 'utility',
async execute(interaction) { async execute(interaction) {
const client = interaction.client; const client = interaction.client;
const uptime = process.uptime(); const uptime = process.uptime();
@ -32,19 +33,21 @@ export default {
return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i]; return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i];
}; };
const statsEmbed = new MessageEmbed() const statsEmbed = new EmbedBuilder()
.setColor(interaction.member ? interaction.member.displayHexColor : 'NAVY') .setColor(interaction.member ? interaction.member.displayHexColor : 'NAVY')
.setTitle('Bot stats') .setTitle('Bot stats')
.setAuthor({ name: client.user.tag, iconURL: client.user.displayAvatarURL(), url: 'https://libtar.de' }) .setAuthor({ name: client.user.tag, iconURL: client.user.displayAvatarURL(), url: 'https://libtar.de' })
.addField('Servers', client.guilds.cache.size.toString(), true) .addFields(
.addField('Channels', client.channels.cache.size.toString(), true) { name: 'Servers', value: client.guilds.cache.size.toString(), inline: true },
.addField('Users', client.users.cache.size.toString(), true) { name: 'Channels', value: client.channels.cache.size.toString(), inline: true },
.addField('Ram usage', `${bytesToSize(process.memoryUsage().heapUsed)}/${bytesToSize(os.totalmem)}`, true) { name: 'Users', value: client.users.cache.size.toString(), inline: true },
.addField('CPU', `${os.cpus()[0].model} (${os.cpus().length} core)`, true) { name: 'Ram usage', value: `${bytesToSize(process.memoryUsage().heapUsed)}/${bytesToSize(os.totalmem)}`, inline: true },
.addField('OS', `${os.platform()} ${os.release()}`, true) { name: 'CPU', value: `${os.cpus()[0].model} (${os.cpus().length} core)`, inline: true },
.addField('Nodejs version', process.version, true) { name: 'OS', value: `${os.platform()} ${os.release()}`, inline: true },
.addField('Discord.js version', version, true) { name: 'Nodejs version', value: process.version, inline: true },
.addField('Uptime', dateString, true) { name: 'Discord.js version', value: version, inline: true },
{ name: 'Uptime', value: dateString, inline: true },
)
.setTimestamp(); .setTimestamp();
return interaction.reply({ embeds: [statsEmbed] }); return interaction.reply({ embeds: [statsEmbed] });

@ -1,4 +1,4 @@
import { SlashCommandBuilder } from '@discordjs/builders'; import { SlashCommandBuilder } from 'discord.js';
import utils from '../../utils/videos.js'; import utils from '../../utils/videos.js';
import fs from 'node:fs'; import fs from 'node:fs';
import os from 'node:os'; import os from 'node:os';
@ -14,9 +14,10 @@ export default {
option.setName('url') option.setName('url')
.setDescription('URL of the video you want to convert') .setDescription('URL of the video you want to convert')
.setRequired(true)), .setRequired(true)),
async execute(interaction) { category: 'utility',
async execute(interaction, args) {
await interaction.deferReply({ ephemeral: false }); await interaction.deferReply({ ephemeral: false });
const url = interaction.options.getString('url'); const url = args[0];
if (!await utils.stringIsAValidurl(url)) { if (!await utils.stringIsAValidurl(url)) {
console.error(`Not a url!!! ${url}`); console.error(`Not a url!!! ${url}`);

Loading…
Cancel
Save