├── .babelrc.json ├── index.js ├── .gitignore ├── src ├── Config │ ├── developers.json │ └── options.js ├── Database │ ├── Models.js │ └── Schemas │ │ ├── guilds.js │ │ ├── client.js │ │ └── users.js ├── main.js ├── Handlers │ ├── events.js │ ├── commands.js │ └── client.js ├── Events │ ├── Client │ │ └── ready.js │ └── Interactions │ │ └── interactionCreate.js ├── Utils │ ├── functions.js │ └── CLI │ │ ├── prettierrc.js │ │ ├── eslintrc.js │ │ └── beautify.js └── Commands │ └── Info │ └── ping.js ├── .prettierignore ├── .prettierrc.json ├── package.json ├── .eslintrc.json ├── README.md └── LICENSE /.babelrc.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | require("./src/main"); 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .upm/ 3 | .config/ 4 | .cache/ 5 | .package-lock.json 6 | -------------------------------------------------------------------------------- /src/Config/developers.json: -------------------------------------------------------------------------------- 1 | { 2 | "developers": [ 3 | "828677274659586068", 4 | "518207099302576160" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .upm/ 3 | .config/ 4 | .cache/ 5 | package.json 6 | package-lock.json 7 | .eslintrc.json 8 | .prettierrc.json 9 | -------------------------------------------------------------------------------- /src/Database/Models.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | guilds: require('./Schemas/guilds.js'), 3 | users: require('./Schemas/users.js'), 4 | client: require('./Schemas/client.js'), 5 | }; 6 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 2, 3 | "semi": true, 4 | "singleQuote": true, 5 | "trailingComma": "es5", 6 | "bracketSpacing": true, 7 | "printWidth": 100, 8 | "parser": "babel" 9 | } 10 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | const Client = require('./Handlers/client'); 2 | 3 | require('dotenv').config() 4 | 5 | const options = require('./Config/options'); 6 | const client = new Client(options); 7 | 8 | client.login(process.env.TOKEN); 9 | -------------------------------------------------------------------------------- /src/Handlers/events.js: -------------------------------------------------------------------------------- 1 | class Event { 2 | constructor(client, options) { 3 | this.client = client; 4 | this.name = options.name; 5 | this.once = options.once || false; 6 | } 7 | } 8 | 9 | module.exports = Event; 10 | -------------------------------------------------------------------------------- /src/Database/Schemas/guilds.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const Schema = mongoose.Schema; 3 | 4 | const guildSchema = new Schema({ 5 | _gId: { 6 | type: String, 7 | }, 8 | }); 9 | 10 | const Guild = mongoose.model('Guilds', guildSchema); 11 | module.exports = Guild; 12 | -------------------------------------------------------------------------------- /src/Events/Client/ready.js: -------------------------------------------------------------------------------- 1 | const Events = require('../../Handlers/events'); 2 | 3 | module.exports = class extends Events { 4 | constructor(client) { 5 | super(client, { 6 | name: 'ready', 7 | once: true, 8 | }); 9 | } 10 | run = async () => { 11 | await this.client.registerCommands(); 12 | }; 13 | }; 14 | -------------------------------------------------------------------------------- /src/Database/Schemas/client.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const Schema = mongoose.Schema; 3 | 4 | const clientSchema = new Schema({ 5 | _cId: { 6 | type: String, 7 | }, 8 | developers: { 9 | type: String, 10 | default: '', // client id 11 | }, 12 | }); 13 | 14 | const Client = mongoose.model('Client', clientSchema); 15 | module.exports = Client; 16 | -------------------------------------------------------------------------------- /src/Handlers/commands.js: -------------------------------------------------------------------------------- 1 | class Command { 2 | constructor(client, options) { 3 | this.client = client; 4 | this.name = options.name || options.data.name; 5 | this.description = options.description || options.data.description; 6 | this.options = options.options || options.data?.options; 7 | this.permissions = options.permissions; 8 | this.onlyDevs = options.onlyDevs; 9 | this.defer = options.defer || false; 10 | this.dm_permission = false; 11 | this.name_localizations = options.name_localizations; 12 | } 13 | 14 | toJSON() { 15 | const { client, ...data } = this; 16 | return data; 17 | } 18 | } 19 | 20 | module.exports = Command; 21 | -------------------------------------------------------------------------------- /src/Utils/functions.js: -------------------------------------------------------------------------------- 1 | const types = ['error', 'system', 'commands', 'firebase', 'mongoose', 'success', 'client']; 2 | 3 | module.exports = { 4 | logger(message, type) { 5 | if (!type || types.indexOf(type) < 0) type = types[0]; 6 | console.log( 7 | `(${ 8 | types[types.indexOf(type)].charAt(0).toUpperCase() + types[types.indexOf(type)].slice(1) 9 | }) ${message}` 10 | ); 11 | }, 12 | 13 | msToDate(ms) { 14 | ms = Math.round(ms / 1000); 15 | const s = ms % 60, 16 | m = ~~((ms / 60) % 60), 17 | h = ~~((ms / 60 / 60) % 24), 18 | d = ~~(ms / 60 / 60 / 24); 19 | 20 | return `${d}d:${h}h:${m}m:${s}s`; 21 | }, 22 | }; 23 | -------------------------------------------------------------------------------- /src/Database/Schemas/users.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const Schema = mongoose.Schema; 3 | 4 | const userSchema = new Schema({ 5 | _uId: { 6 | type: String, 7 | required: true, 8 | }, 9 | _gId: { 10 | type: String, 11 | }, 12 | warn: { 13 | warns: { 14 | type: Array, 15 | }, 16 | count: { 17 | type: Number, 18 | default: 0, 19 | }, 20 | }, 21 | banClient: { 22 | data: { 23 | type: String, 24 | }, 25 | banned: { 26 | type: Boolean, 27 | default: false, 28 | }, 29 | reason: { 30 | type: String, 31 | }, 32 | }, 33 | }); 34 | 35 | const User = mongoose.model('Users', userSchema); 36 | module.exports = User; 37 | -------------------------------------------------------------------------------- /src/Commands/Info/ping.js: -------------------------------------------------------------------------------- 1 | const Commands = require('../../Handlers/commands'); 2 | 3 | module.exports = class extends Commands { 4 | constructor(client) { 5 | super(client, { 6 | name: 'ping', 7 | description: 'Veja o ping do bot', 8 | defer: true, 9 | onlyDevs: false, 10 | }); 11 | } 12 | run(interaction) { 13 | interaction 14 | .editReply({ 15 | content: 'Calculando sa bosta', 16 | fetchReply: true, 17 | }) 18 | .then((message) => { 19 | const textPing = `Latência da minha WS: \`${this.client.ws.ping}ms\`\nLatência da API: \`${ 20 | message.createdTimestamp - interaction.createdTimestamp 21 | }ms\``; 22 | 23 | interaction.editReply({ 24 | content: textPing, 25 | }); 26 | }); 27 | }; 28 | }; 29 | -------------------------------------------------------------------------------- /src/Utils/CLI/prettierrc.js: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | 3 | const { glob } = require('glob'); 4 | const { promisify } = require('util'); 5 | const proGlob = promisify(glob); 6 | const inquirer = require('inquirer'); 7 | const shell = require('shelljs'); 8 | 9 | const prompt = inquirer 10 | .prompt([ 11 | { 12 | message: 'Você quer iniciar o prettier?', 13 | type: 'confirm', 14 | name: 'prettier', 15 | }, 16 | ]) 17 | .then((confirm) => { 18 | if (!confirm.prettier) return; 19 | 20 | const prettier = async () => { 21 | const filepush = await proGlob(`${process.cwd().replace(/\\/g, '/')}/src/**/**/*.js`); 22 | 23 | let i = 0; 24 | filepush.forEach((file, i) => { 25 | let arquivo = file.substring(file.lastIndexOf('/') + 1); 26 | setTimeout(() => { 27 | shell.exec(`prettier --write ${file}`); 28 | }, 4000 * i); 29 | }); 30 | }; 31 | prettier(); 32 | }); 33 | -------------------------------------------------------------------------------- /src/Config/options.js: -------------------------------------------------------------------------------- 1 | const { GatewayIntentBits, Partials } = require('discord.js'); 2 | 3 | const options = { 4 | intents: [ 5 | GatewayIntentBits.GuildBans, 6 | GatewayIntentBits.GuildEmojisAndStickers, 7 | GatewayIntentBits.GuildIntegrations, 8 | GatewayIntentBits.GuildInvites, 9 | GatewayIntentBits.GuildMembers, 10 | GatewayIntentBits.GuildMessageReactions, 11 | GatewayIntentBits.GuildMessageTyping, 12 | GatewayIntentBits.GuildMessages, 13 | GatewayIntentBits.GuildPresences, 14 | GatewayIntentBits.GuildScheduledEvents, 15 | GatewayIntentBits.GuildVoiceStates, 16 | GatewayIntentBits.GuildWebhooks, 17 | GatewayIntentBits.Guilds, 18 | GatewayIntentBits.MessageContent, 19 | ], 20 | partials: [ 21 | Partials.Channel, 22 | Partials.GuildMember, 23 | Partials.GuildScheduledEvent, 24 | Partials.Message, 25 | Partials.Reaction, 26 | Partials.ThreadMember, 27 | Partials.User, 28 | ], 29 | }; 30 | 31 | module.exports = options; 32 | -------------------------------------------------------------------------------- /src/Utils/CLI/eslintrc.js: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | 3 | const { glob } = require('glob'); 4 | const { promisify } = require('util'); 5 | const proGlob = promisify(glob); 6 | const colors = require('colors'); 7 | const inquirer = require('inquirer'); 8 | const shell = require('shelljs'); 9 | 10 | const prompt = inquirer 11 | .prompt([ 12 | { 13 | message: 'Você quer iniciar o eslint?', 14 | type: 'confirm', 15 | name: 'eslint', 16 | }, 17 | ]) 18 | .then((confirm) => { 19 | if (!confirm.eslint) return; 20 | 21 | const eslint = async () => { 22 | const filepush = await proGlob(`${process.cwd().replace(/\\/g, '/')}/src/**/**/*.js`, { 23 | ignore: '**/CLI/**', 24 | }); 25 | const i = 0; 26 | filepush.forEach((file, i) => { 27 | let arquivo = file.substring(file.lastIndexOf('/') + 1); 28 | setTimeout(() => { 29 | shell.exec(`eslint ${file} --fix`); 30 | console.log(`[Check] Arquivo ${arquivo} aprimorado com sucesso!`.blue.dim); 31 | }, 4000 * i); 32 | }); 33 | }; 34 | eslint(); 35 | }); 36 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CommunityStructure", 3 | "version": "1.0.0", 4 | "description": "Organizational structure for using the discord.js framework", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "dev": "nodemon index.js" 9 | }, 10 | "bin": { 11 | "beautify": "./src/Utils/CLI/beautify.js", 12 | "eslintrc": "./src/Utils/CLI/eslintrc.js", 13 | "prettierrc": "./src/Utils/CLI/prettierrc.js" 14 | }, 15 | "keywords": [], 16 | "author": [ 17 | "Juaum • 愛#4009", 18 | "ঔৣ☬✞𝓓𝖔𝖓✞☬ঔৣ#0552" 19 | ], 20 | "license": "ISC", 21 | "dependencies": { 22 | "chalk": "^4.1.2", 23 | "colors": "^1.4.0", 24 | "discord.js": "^14.7.1", 25 | "dotenv": "^16.0.3", 26 | "glob": "^8.1.0", 27 | "js-beautify": "^1.14.7", 28 | "moment": "^2.29.4", 29 | "mongoose": "^6.9.1" 30 | }, 31 | "devDependencies": { 32 | "@babel/core": "^7.20.12", 33 | "@babel/eslint-parser": "^7.19.1", 34 | "eslint": "^8.20.0", 35 | "eslint-config-prettier": "^8.6.0", 36 | "eslint-plugin-n": "^15.6.1", 37 | "eslint-plugin-node": "^11.1.0", 38 | "inquirer": "^8.2.5", 39 | "nodemon": "^2.0.20", 40 | "prettier": "2.8.4", 41 | "shelljs": "^0.8.5" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Utils/CLI/beautify.js: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | 3 | const { glob } = require('glob'); 4 | const { promisify } = require('util'); 5 | const proGlob = promisify(glob); 6 | const colors = require('colors'); 7 | const inquirer = require('inquirer'); 8 | const beautify = require('js-beautify').js; 9 | const fs = require('fs'); 10 | 11 | const prompt = inquirer 12 | .prompt([ 13 | { 14 | message: 'Você quer iniciar o beautify?', 15 | type: 'confirm', 16 | name: 'beautify', 17 | }, 18 | ]) 19 | .then((confirm) => { 20 | if (!confirm.beautify) return; 21 | 22 | const beautifier = async () => { 23 | const filepush = await proGlob(`${process.cwd().replace(/\\/g, '/')}/src/**/**/*.js`); 24 | const i = 0; 25 | filepush.forEach((print, i) => { 26 | setTimeout(() => { 27 | fs.readFile(print, (err, data) => { 28 | const beaut = beautify(Buffer?.from(data).toString()); 29 | const arquivo = print.substring(print.lastIndexOf('/') + 1); 30 | fs.writeFile(print, beaut, (err) => { 31 | if (err) { 32 | console.log(`[Error] Arquivo ${arquivo} falhou ao ser embelezado.`.red.dim); 33 | throw err; 34 | } 35 | console.log(`[Check] Arquivo ${arquivo} editado com sucesso!`.green.dim); 36 | }); 37 | }); 38 | }, 4000 * i); 39 | }); 40 | }; 41 | beautifier(); 42 | }); 43 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "@babel/eslint-parser", 3 | "env": { 4 | "browser": true, 5 | "commonjs": true, 6 | "es2021": true, 7 | "node": true 8 | }, 9 | "extends": [ 10 | "eslint:recommended", 11 | "prettier" 12 | ], 13 | "parserOptions": { 14 | "ecmaVersion": 2020, 15 | "sourceType": "module", 16 | "ecmaFeatures": { 17 | "classes": true 18 | } 19 | }, 20 | "plugins": ["n", "node"], 21 | "rules": { 22 | "node/no-unsupported-features/es-syntax": "off", 23 | "node/no-missing-import": "error", 24 | "node/no-extraneous-import": "error", 25 | "node/no-unpublished-require": "error", 26 | "class-methods-use-this": "off", 27 | "no-undef": "off", 28 | "n/shebang": "error", 29 | "unicode-bom": ["error", "never"], 30 | "indent": ["error", 4], 31 | "linebreak-style": ["error", "windows"], 32 | "quotes": ["error", "single"], 33 | "semi": ["error", "always"], 34 | "require-await": ["error"], 35 | "no-lone-blocks": ["error"], 36 | "block-spacing": ["error", "always"], 37 | "eol-last": ["error", "always"], 38 | "brace-style": ["error", "stroustrup"], 39 | "prefer-const": [ 40 | "error", 41 | { 42 | "destructuring": "any", 43 | "ignoreReadBeforeAssign": false 44 | } 45 | ], 46 | "object-curly-spacing": [ 47 | "error", 48 | "always", 49 | { 50 | "arraysInObjects": true 51 | } 52 | ], 53 | "comma-spacing": [ 54 | "error", 55 | { 56 | "before": false, 57 | "after": true 58 | } 59 | ] 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/Events/Interactions/interactionCreate.js: -------------------------------------------------------------------------------- 1 | const Events = require('../../Handlers/events'); 2 | const { developers } = require('../../Config/developers.json'); 3 | 4 | module.exports = class extends Events { 5 | constructor(client) { 6 | super(client, { 7 | name: 'interactionCreate', 8 | }); 9 | } 10 | run = async (interaction) => { 11 | 12 | if (!interaction.isChatInputCommand()) return; 13 | 14 | const commandName = interaction.commandName; 15 | const command = this.client.commandSlash.find((c) => c.name === commandName); 16 | 17 | if (command.onlyDevs && !developers.includes(interaction.user.id)) 18 | return interaction.editReply({ 19 | content: `${interaction.user} **|** este comando é privado apenas para desenvolvedores desta aplicação!`, 20 | ephemeral: true, 21 | }); 22 | 23 | if (command.permissions) { 24 | if (!interaction.member.permissions.has(command.permissions)) { 25 | return interaction.reply({ content: 'Você não tem perm' }); 26 | } 27 | else if (!interaction.guild.members.me.permissions.has(command.permissions)) { 28 | return interaction.reply({ content: 'Eu não tenho perm bro' }); 29 | } 30 | } 31 | 32 | if (!this.client.cooldown.has(interaction.user.id)) { 33 | if (!command) { 34 | return interaction.reply({ 35 | content: 'Ocorreu um erro ao executar este comando...', 36 | ephemeral: true, 37 | }); 38 | } 39 | if (command.defer) await interaction.deferReply(); 40 | command.run(interaction); 41 | } else { 42 | return interaction.reply({ 43 | content: 'Você está em cooldown, aguarde 5 segundos para usar os comandos novamente.', 44 | ephemeral: true, 45 | }); 46 | } 47 | 48 | await this.client.cooldown.add(interaction.user.id); 49 | setTimeout(async () => { 50 | await this.client.cooldown.delete(interaction.user.id); 51 | }, 5000); 52 | }; 53 | }; 54 | -------------------------------------------------------------------------------- /src/Handlers/client.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const utils = { functions: require('../Utils/functions') }; 3 | const { join } = require('path'); 4 | const { Client } = require('discord.js'); 5 | 6 | module.exports = class extends Client { 7 | constructor(options) { 8 | super(options); 9 | 10 | this.commandSlash = []; 11 | this.loadCommands(); 12 | this.loadEvents(); 13 | this.cooldown = new Set(); 14 | this.moment = require('moment'); 15 | this.utils = utils.functions; 16 | } 17 | 18 | registerCommands() { 19 | this.utils.logger('Carregando os comandos (/) da aplicação', 'commands'); 20 | this.application?.commands 21 | .set(this.commandSlash) 22 | .then(() => { 23 | this.utils.logger('Os comandos (/) da aplicação foram carregados com sucesso.', 'commands'); 24 | }) 25 | .catch((err) => { 26 | this.utils.logger(err, 'error'); 27 | }); 28 | } 29 | 30 | loadCommands(path = 'src/Commands') { 31 | const categories = fs.readdirSync(path); 32 | for (const category of categories) { 33 | const commands = fs.readdirSync(`${path}/${category}`); 34 | 35 | for (const command of commands) { 36 | const commandClass = require(join(process.cwd(), `${path}/${category}/${command}`)); 37 | const cmd = new commandClass(this); 38 | 39 | this.commandSlash.push(cmd); 40 | } 41 | } 42 | } 43 | 44 | loadEvents(path = 'src/Events') { 45 | const eventsFolders = fs.readdirSync(path); 46 | for (const folders of eventsFolders) { 47 | const eventsFiles = fs.readdirSync(`${path}/${folders}`); 48 | for (const files of eventsFiles) { 49 | if (!files.endsWith('.js')) return; 50 | const eventClass = require(join(process.cwd(), `${path}/${folders}/${files}`)); 51 | 52 | const evnt = new eventClass(this); 53 | if (!evnt.once) { 54 | this.on(evnt.name, evnt.run); 55 | } else { 56 | this.once(evnt.name, evnt.run); 57 | } 58 | } 59 | } 60 | } 61 | 62 | async connectToDatabase() { 63 | try { 64 | const { connect } = require('mongoose'); 65 | const mongoose = require('mongoose'); 66 | const Models = require('../Database/Models'); 67 | 68 | mongoose.set('strictQuery', true); 69 | 70 | await this.utils.logger('Conectando com a database...', 'mongoose'); 71 | const connection = connect(process.env.MONGODB_URL, { 72 | useNewUrlParser: true, 73 | useUnifiedTopology: true, 74 | }); 75 | 76 | this.db = { 77 | connection, 78 | ...Models, 79 | }; 80 | 81 | await this.utils.logger('Database carregada com sucesso', 'mongoose'); 82 | } catch (error) { 83 | await this.utils.logger( 84 | 'Ocorreu um erro ao tentar conectar com a database\n' + error, 85 | 'mongoose' 86 | ); 87 | } 88 | } 89 | }; 90 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 🔐 CommunityStructure. 3 |

4 |

5 | GitHub language count 6 | 7 | Repository issues 8 | 9 | 10 | Made by ঔৣ☬✞𝓓𝖔𝖓✞☬ঔৣ#0552 11 | 12 | 13 | 14 | GitHub last commit 15 | 16 | 17 | 18 | Repository issues 19 | 20 |

21 | 22 | 23 |

24 | Projeto   |    25 | Como usar   |    26 | Licença 27 |

28 | 29 | ## 📋 Projeto 30 | 31 | * 🔐 A estrutura do discord.js permite criar bots e interagir com o Discord, com objetos que representam servidores, canais, mensagens, entre outros. Há métodos e eventos disponíveis para manipular esses objetos e responder a ações do usuário. Conhecer bem a estrutura é importante para aproveitar ao máximo as capacidades do discord.js e criar soluções personalizadas.
32 | 33 | ## 💻 Como usar 34 | 35 | Para clonar e rodar essa aplicação você precisará do [Git](https://git-scm.com) e [Node.js](https://nodejs.org/en/download/). 36 |
37 | Na sua linha de comando: 38 | 39 | ```bash 40 | # Clone esse repositório 41 | $ git clone https://github.com/whoisdon/CommunityStructure.git 42 | ``` 43 | ```bash 44 | # Vá para o repositório Back-end 45 | $ cd CommunityStructure 46 | ``` 47 | ```bash 48 | # Instale as dependencias 49 | $ npm install 50 | ``` 51 | ```bash 52 | # Instale as dependencias globalmente 53 | $ npm install -g 54 | ``` 55 | 56 | ## ⚙️ Configuração 57 | 58 | Utilizando shell para criação e manipulação de variáveis de ambiente: 59 | ```shell 60 | # Criando arquivo .env 61 | touch .env 62 | ``` 63 | Dentro do arquivo `.env` iremos armazenar algumas variáveis: 64 | ``` 65 | TOKEN= 66 | MONGODB_URL= 67 | ``` 68 | 69 | ## ✰ Iniciar Projeto 70 | 71 | Você pode dar início ao projeto com facilidade, utilizando diretamente o comando: 72 | ``` 73 | node . 74 | ``` 75 | Você pode dar início ao projeto usando o nodemon, garantindo assim uma atualização em tempo real dos seus avanços. 76 | ```bash 77 | npm run dev 78 | ``` 79 | 80 | ## 📦 CLI 81 | 82 | Alguns comandos CLI foram pré definidos para ajudar e auxiliar na estilização do código. 83 | ### CLI pré definidos: 84 | 85 | | Command | Result | 86 | | ------------------- | -------------------- | 87 | | `$ beautify` | **padroniza o código fonte, tornando-o mais legível e fácil de manter.** | 88 | | `$ prettierrc` | **formatação de código, para padronizar e aprimorar a aparência do seu código.** | 89 | | `$ eslintrc` | **verifica e corrigi problemas de padrão e estilo no seu código de maneira automatizada.** | 90 | 91 | ### 92 | 93 | ## 🏗️ Estrutura 94 |
95 | Exemplo de implementação de comandos slash (/) no Discord, usando a base padrão do repositório. 96 | 97 | ```js 98 | const Commands = require('../../Handlers/commands'); 99 | 100 | module.exports = class extends Commands { 101 | constructor(client) { 102 | super(client, { 103 | name: 'nome', 104 | description: 'descrição', 105 | }); 106 | } 107 | 108 | run(interaction) { 109 | 110 | } 111 | } 112 | ``` 113 |
114 |
115 | Exemplo de implementação de comandos slash (/) no Discord, usando a classe SlashCommandBuilder como base. 116 | 117 | ```js 118 | const Commands = require('../../Handlers/commands'); 119 | const { SlashCommandBuilder } = require('discord.js') 120 | 121 | module.exports = class extends Commands { 122 | constructor(client) { 123 | super(client, { 124 | data: new SlashCommandBuilder() 125 | .setName('nome') 126 | .setDescription('descrição'), 127 | }); 128 | } 129 | 130 | run(interaction) { 131 | 132 | } 133 | } 134 | ``` 135 |
136 | 137 | ## 📝 License 138 | 139 | Este projeto está sob a licença Apache. Consulte o [LICENSE](LICENSE) para obter detalhes. 140 | 141 | --- 142 | 143 | Feito por Who Am I#0001 e Juaum • 愛#4009 :wave: 144 | 145 | Discord Don: [Entre em contato comigo!](https://discord.com/users/828677274659586068) 146 | Github Don: [github.com/whoisdon](https://github.com/whoisdon)   147 | 148 | Discord Juaum: [Entre em contato com Juaum!](https://discord.com/users/518207099302576160) 149 | Github Juaum: [github.com/joaolumertz](https://github.com/joaolumertz)   150 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------