Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { Command, Emojis, ClientEmbed } = require("../..");
- class Sst extends Command {
- constructor(client) {
- super(client, {
- name: "Sst",
- description: "Sistema de bloquear invites de outros discords no seu servidor!",
- usage: { args: true, argsNeed: true, argsTxt: "<antinvite>", need: "{antinvite} {cmd} {args}" },
- category: "sv",
- cooldown: 3000,
- aliases: ["sv"],
- Permissions: [],
- UserPermissions: ["MANAGE_GUILD"],
- needGuild: true
- });
- }
- async run({ channel, message, guild, author, args, prefix }, t) {
- if (args[0] === 'remover') {
- const guild = await this.client.database.guilds.findOne({ _id: message.guild.id }),
- total = message.guild.channels.get(guild.statuscanais.total),
- users = message.guild.channels.get(guild.statuscanais.users),
- bots = message.guild.channels.get(guild.statuscanais.bots)
- console.log(total);
- if (Number(guild.statuscanais.total) !== 0)
- return total.delete();
- else if (Number(guild.statuscanais.users) !== 0)
- return users.delete();
- else if (Number(guild.statuscanais.bots) !== 0)
- return bots.delete();
- await this.client.database.guilds.update(message.guild.id, { $set: { statuscanais: { total: '0', users: '0', bots: '0' } } })
- return;
- }
- let doc = await this.client.database.guilds.findOne(message.guild.id);
- if (Number(doc.statuscanais.total) !== 0)
- return message.channel.send(`Total users já está ativado`);
- if (Number(doc.statuscanais.users) !== 0)
- return message.channel.send(`Users já está ativado`);
- if (Number(doc.statuscanais.bots) !== 0)
- return message.channel.send(`Bots já está ativado`);
- const categ = message.guild.channels.find("name", "📓 Status Servidor 📓");
- if (!categ) {
- message.guild.createChannel(`📓 Status Servidor 📓`, {
- type: 'category',
- position: '1',
- permissionOverwrites: [{
- id: guild.id,
- deny: ['CONNECT'],
- allow: ['VIEW_CHANNEL']
- }]
- })
- }
- if (categ || !categ) {
- channel.send(`Criando os canais...`).then(msg =>
- setTimeout(() => {
- const category = message.guild.channels.find("name", "📓 Status Servidor 📓")
- message.guild.createChannel(`Total de Usuários: ${message.guild.members.size}`, "voice").then((createdChan) => {
- createdChan.setParent(category).then((settedParent) => {
- settedParent.overwritePermissions(message.guild.roles.find('name', "@everyone"), { "CONNECT": false, "VIEW_CHANNEL:": true });
- }).catch(err => {
- message.channel.send("Algo deu errado!");
- });
- console.log(createdChan.id)
- return this.client.database.guilds.update({ _id: message.guild.id }, { 'statuscanais.total': `${createdChan.id}` })
- }).catch(err => {
- message.channel.send("Algo deu errado!");
- });
- message.guild.createChannel(`Membros: ${message.guild.members.filter(a => !a.user.bot).size}`, "voice").then((createdChan2) => {
- createdChan2.setParent(category).then((settedParent) => {
- settedParent.overwritePermissions(message.guild.roles.find('name', "@everyone"), { "CONNECT": false, "VIEW_CHANNEL:": true });
- }).catch(err => {
- message.channel.send("Algo deu errado!");
- });
- return this.client.database.guilds.update({ _id: message.guild.id }, { 'statuscanais.users': `${createdChan2.id}` })
- }).catch(err => {
- message.channel.send("Algo deu errado!");
- });
- message.guild.createChannel(`Bots: ${message.guild.members.filter(a => a.user.bot).size}`, "voice").then((createdChan3) => {
- createdChan3.setParent(category).then((settedParent) => {
- settedParent.overwritePermissions(message.guild.roles.find('name', "@everyone"), { "CONNECT": false, "VIEW_CHANNEL:": true });
- }).catch(err => {
- message.channel.send("Algo deu errado!");
- });
- return this.client.database.guilds.update({ _id: message.guild.id }, { 'statuscanais.bots': `${createdChan3.id}` })
- }).catch(err => {
- message.channel.send("Algo deu errado!");
- });
- }, 3 * 1000)).then(msg =>
- setTimeout(() => {
- channel.send(`${Emojis.Certo} - ${message.author}, canais criados com sucesso!`)
- }, 3 * 2000))
- }
- }
- }
- module.exports = Sst;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement