V14 update

This commit is contained in:
Supositware 2022-08-28 17:04:11 +02:00
parent 6272cde878
commit 7e186a07a9
5 changed files with 4861 additions and 467 deletions

View file

@ -1,6 +1,6 @@
import db from '../../models/index.js';
const guildBlacklist = db.guildBlacklist;
import { MessageEmbed } from 'discord.js';
import { EmbedBuilder } from 'discord.js';
import dotenv from 'dotenv';
dotenv.config();
@ -25,16 +25,18 @@ export default {
const channel = client.channels.resolve(statusChannel);
const botCount = guild.members.cache.filter(member => member.user.bot).size;
console.log(guild.memberCount);
const addEmbed = new MessageEmbed()
const addEmbed = new EmbedBuilder()
.setColor('#52e80d')
.setTitle('New boiz in town')
.setURL('https://www.youtube.com/watch?v=6n3pFFPSlW4')
.setThumbnail(guild.iconURL())
.addField('Guild', `${guild.name} (${guild.id})`)
.addField('Total number of members', guild.memberCount.toString(), true)
.addField('Number of users', (guild.memberCount - botCount).toString(), true)
.addField('Number of bots', botCount.toString(), true)
.addField('Owner', `${guildOwner.username} (${guild.ownerId})`, true)
.addFields(
{ name: 'Guild', value: `${guild.name} (${guild.id})` },
{ name: 'Total number of members', value: guild.memberCount.toString(), inline: true },
{ name: 'Number of users', value: (guild.memberCount - botCount).toString(), inline: true },
{ name: 'Number of bots', value: botCount.toString(), inline: true },
{ name: 'Owner', value: `${guildOwner.username} (${guild.ownerId})`, inline: true },
)
.setFooter({ text: `I'm now in ${client.guilds.cache.size} servers!` })
.setTimestamp();

View file

@ -1,6 +1,6 @@
import db from '../../models/index.js';
const guildBlacklist = db.guildBlacklist;
import { MessageEmbed } from 'discord.js';
import { EmbedBuilder } from 'discord.js';
import dotenv from 'dotenv';
dotenv.config();
@ -21,16 +21,18 @@ export default {
const channel = client.channels.resolve(statusChannel);
const botCount = guild.members.cache.filter(member => member.user.bot).size;
console.log(guild.memberCount);
const kickEmbed = new MessageEmbed()
const kickEmbed = new EmbedBuilder()
.setColor('#FF0000')
.setTitle('Some mofo just removed me from there guild :(')
.setURL('https://www.youtube.com/watch?v=6n3pFFPSlW4')
.setThumbnail(guild.iconURL())
.addField('Guild', `${guild.name} (${guild.id})`)
.addField('Total number of members', guild.memberCount.toString(), true)
.addField('Number of users', (guild.memberCount - botCount).toString(), true)
.addField('Number of bots', botCount.toString(), true)
.addField('Owner', `${guildOwner.username} (${guild.ownerId})`, true)
.addFields(
{ name: 'Guild', value: `${guild.name} (${guild.id})` },
{ name: 'Total number of members', value: guild.memberCount.toString(), inline: true },
{ name: 'Number of users', value: (guild.memberCount - botCount).toString(), inline: true },
{ name: 'Number of bots', value: botCount.toString(), inline: true },
{ name: 'Owner', value: `${guildOwner.username} (${guild.ownerId})`, inline: true },
)
.setFooter({ text: `I'm now in ${client.guilds.cache.size} servers!` })
.setTimestamp();

View file

@ -1,4 +1,4 @@
import { Permissions } from 'discord.js';
import { PermissionFlagsBits, InteractionType } from 'discord.js';
import db from '../../models/index.js';
const ratelimit = {};
@ -10,7 +10,7 @@ export default {
name: 'interactionCreate',
async execute(interaction) {
const client = interaction.client;
if (!interaction.isCommand()) return;
if (interaction.type !== InteractionType.ApplicationCommand) return;
const globalBlacklist = await db.Blacklists.findOne({ where: { type:'global', uid:interaction.user.id } });
const commandBlacklist = await db.Blacklists.findOne({ where: { type:interaction.commandName, uid:interaction.user.id } });
@ -40,14 +40,14 @@ export default {
if (command.clientPermissions) {
const clientMember = await interaction.guild.members.fetch(client.user.id);
if (!clientMember.permissions.has(command.clientPermissions)) {
return interaction.reply({ content: `❌ I am missing one of the following permission(s): \`${new Permissions(command.clientPermissions).toArray()}\``, ephemeral: true });
return interaction.reply({ content: `❌ I am missing one of the following permission(s): \`${new PermissionFlagsBits(command.clientPermissions).toArray()}\``, ephemeral: true });
}
}
// Check if the user has the needed permissions
if (command.userPermissions) {
if (!interaction.member.permissions.has(command.userPermissions)) {
return interaction.reply({ content: `❌ You are missing one of the following permission(s): \`${new Permissions(command.userPermissions).toArray()}\``, ephemeral: true });
return interaction.reply({ content: `❌ You are missing one of the following permission(s): \`${new PermissionFlagsBits(command.userPermissions).toArray()}\``, ephemeral: true });
}
}
@ -74,7 +74,20 @@ export default {
ratelimit[userID] = { command: commandName, limit: ratelimit[userID].limit, cooldown: date };
}
}
await command.execute(interaction);
const args = [];
interaction.options.data.forEach(arg => {
console.log(arg);
if (arg.type === 'MENTIONABLE') {
return args.push(arg.member);
}
else if (arg.type === 'ATTACHMENT') {
return args.push(arg.attachment);
}
args.push(arg.value);
});
await command.execute(interaction, args, client);
}
catch (error) {
console.error(error);

5267
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -17,14 +17,14 @@
"homepage": "https://libtar.de",
"license": "AGPL",
"dependencies": {
"@discordjs/builders": "^0.13.0",
"@discordjs/rest": "^0.4.1",
"discord-api-types": "^0.33.1",
"discord.js": "^13.7.0",
"discord-api-types": "^0.33.5",
"discord.js": "^14.3.0",
"dotenv": "^16.0.1",
"mariadb": "^3.0.1",
"mysql2": "^2.3.3",
"node-fetch": "^3.2.6",
"safe-regex": "github:davisjam/safe-regex",
"sequelize": "^6.21.3",
"turndown": "^7.1.1",
"twit": "^2.2.11"