├── util └── Loader.js ├── commands ├── ping.js └── special.js ├── config.js ├── events ├── ready.js └── message.js ├── package.json ├── README.md ├── server.js ├── LICENSE └── .gitignore /util/Loader.js: -------------------------------------------------------------------------------- 1 | const reqEvent = event => require(`../events/${event}`); 2 | module.exports = client => { 3 | client.on('ready', () => reqEvent('ready')(client)); 4 | client.on('message', reqEvent('message')); 5 | }; 6 | -------------------------------------------------------------------------------- /commands/ping.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"), 2 | client = new Discord.Client(); 3 | 4 | module.exports.run = async (client, message, args) => { 5 | message.channel.send('Pong!') 6 | }; 7 | 8 | exports.config = { 9 | name: "ping", 10 | guildOnly: true, 11 | aliases: [], 12 | }; -------------------------------------------------------------------------------- /config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "token": "Your bot token", 3 | "developer": ["Your discord id"], 4 | "prefix": "Your bot prefix." 5 | }; 6 | 7 | 8 | /* 9 | Example: 10 | "token": "Your bot token", 11 | "developer": ["539874816820379648"], 12 | "prefix": "!" 13 | 14 | */ 15 | 16 | // if you understood this part , delete the comment -------------------------------------------------------------------------------- /commands/special.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"), 2 | client = new Discord.Client(); 3 | 4 | module.exports.run = async (client, message, args) => { 5 | 6 | message.channel.send('Hello World! I`m Special.') 7 | }; 8 | 9 | exports.config = { 10 | name: "special", 11 | guildOnly: true, 12 | aliases: ["hi","hello","helloworld"], 13 | }; -------------------------------------------------------------------------------- /events/ready.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const config = require('../config.js'); 3 | module.exports = async client => { 4 | client.user.setPresence({ activity: { type: "PLAYING", name: `Developer By Special`}, status: 'dnd' }) 5 | }; 6 | 7 | /* 8 | name kısmına istediğiniz durumu yazabilirsiniz. 9 | 10 | WATCHING = İZLİYOR 11 | PLAYING = OYNUYOR 12 | LISTENING = DİNLİYOR 13 | 14 | Status kısımları: 15 | online = çevrimiçi 16 | idle = boşta 17 | dnd = rahatsız etmeyin 18 | 19 | */ 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "discord-v12-infrastructure", 3 | "version": "0.0.1", 4 | "description": "Discord.js V12 infrastructure", 5 | "main": "server.js", 6 | "scripts": { 7 | "start": "node server.js" 8 | }, 9 | "dependencies": { 10 | "discord.js": "^12.2.0" 11 | }, 12 | "engines": { 13 | "node": "12.x" 14 | }, 15 | 16 | "license": "MIT", 17 | "keywords": [ 18 | "node", 19 | "glitch", 20 | "express", 21 | "Special", 22 | "Discord", 23 | "V12" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Discord.JS V12 İnfrastructure! 2 | 3 | If you need a bot infrastructure, you can do all the work with it. 4 | 5 | 6 | ### Files you need to edit : 7 | 8 | > config.js 9 | - [Discord Geliştirici Portalı](https://discordapp.com/developers/application) you enter the token of the bot you have created into the string in front of the token part. 10 | 11 | - In the Developers section, enter your own discord user id. If there are more than one developer, extend it by placing commas. 12 | 13 | Example: ["1.id","2.id","3.id"] 14 | 15 | > events/ready.js 16 |
17 | - You can change the situation here. 18 | 19 | ### Permlevels 20 | 21 | - Permlevels are automatic, whichever authority you write. 22 | - BOT_OWNER only bot developer permission 23 | 24 | ### Here are some documents that might be of use to you: 25 | https://discord.js.org/
26 | https://discordjs.guide/ 27 | -------------------------------------------------------------------------------- /server.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js") 2 | const client = new Discord.Client(); 3 | const config = require("./config.js") 4 | const fs = require("fs"); 5 | require('./util/Loader.js')(client); 6 | 7 | client.commands = new Discord.Collection(); 8 | client.aliases = new Discord.Collection(); 9 | fs.readdir('./commands/', (err, files) => { 10 | if (err) console.error(err); 11 | console.log(`${files.length} command will be loaded.`); 12 | files.forEach(f => { 13 | let props = require(`./commands/${f}`); 14 | console.log(`${props.config.name} command installed.`); 15 | console.log(`successfully entered`) 16 | client.commands.set(props.config.name, props); 17 | props.config.aliases.forEach(alias => { 18 | client.aliases.set(alias, props.config.name); 19 | }); 20 | }); 21 | }) 22 | 23 | client.login(config.token) 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Special 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /events/message.js: -------------------------------------------------------------------------------- 1 | const config = require('../config.js'); 2 | module.exports = message => { 3 | let client = message.client; 4 | if (message.author.bot) return; 5 | if (!message.content.startsWith(config.prefix)) return; 6 | let command = message.content.split(' ')[0].slice(config.prefix.length); 7 | let params = message.content.split(' ').slice(1); 8 | let cmd; 9 | if (client.commands.has(command)) { 10 | cmd = client.commands.get(command); 11 | } else if (client.aliases.has(command)) { 12 | cmd = client.commands.get(client.aliases.get(command)); 13 | }; 14 | if (cmd) { 15 | if(!message.guild) { 16 | if(cmd.config.guildOnly === true) { 17 | return; 18 | }; 19 | }; 20 | if (cmd.config.permLevel) { 21 | if(cmd.config.permLevel === "BOT_OWNER") { 22 | if(!config.developer.includes(message.author.id)) { 23 | message.channel.send(`Being able to use this command must have authority for the \`${cmd.config.permLevel}\``).then(msg => msg.delete({timeout: 3000})); 24 | return; 25 | } 26 | } 27 | if(!message.member.hasPermission(cmd.config.permLevel)) { 28 | message.channel.send(`Being able to use this command must have authority for the \`${cmd.config.permLevel}\``).then(msg => msg.delete({timeout: 3000})); 29 | return; 30 | }; 31 | }; 32 | cmd.run(client, message, params); 33 | }; 34 | }; -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Microbundle cache 57 | .rpt2_cache/ 58 | .rts2_cache_cjs/ 59 | .rts2_cache_es/ 60 | .rts2_cache_umd/ 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | .env 73 | .env.test 74 | 75 | # parcel-bundler cache (https://parceljs.org/) 76 | .cache 77 | 78 | # Next.js build output 79 | .next 80 | 81 | # Nuxt.js build / generate output 82 | .nuxt 83 | dist 84 | 85 | # Gatsby files 86 | .cache/ 87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js 88 | # https://nextjs.org/blog/next-9-1#public-directory-support 89 | # public 90 | 91 | # vuepress build output 92 | .vuepress/dist 93 | 94 | # Serverless directories 95 | .serverless/ 96 | 97 | # FuseBox cache 98 | .fusebox/ 99 | 100 | # DynamoDB Local files 101 | .dynamodb/ 102 | 103 | # TernJS port file 104 | .tern-port 105 | --------------------------------------------------------------------------------