├── LICENSE ├── README.md ├── TXT ├── TXTSend │ └── test.txt.txt ├── eval │ └── test.txt.txt └── lyrics │ └── test.txt.txt ├── commands ├── information │ ├── information.js │ └── ping.js └── owner │ └── eval.js ├── config.js ├── events ├── messageCreate_main.js └── ready_main.js ├── handlers ├── BaseClient.js ├── commandHandler.js └── eventHandler.js ├── main.mjs ├── multiFunction ├── multiFunction.js └── permLevel.js ├── package.json └── schemas └── commandSchema.js /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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Welcome to ESModuleTemplate ! 2 | 3 | Hi, I'm leaving you a little present. **Discord.JS for v13**, I have developed an infrastructure with **class function** and **ESModules(MJS)** that will provide you with complete convenience. I would like to share it. Use it on good days. Stay healthy. 4 | 5 | # Installation 6 | Download or import this template, then open a folder called **TXT**, and then open 3 subfolders called **eval - lyrics - TXTSend** into the **TXT** folder. Then type 7 | > Note: Dillinger requires [Node.js](https://nodejs.org/) v16+ to run. 8 | ```j 9 | npm i @latest 10 | ``` 11 | or (module name) 12 | ```j 13 | npm i modulename@latest 14 | ``` 15 | into the terminal and run it. 16 | After the installation of the modules is complete, the installation is complete. 17 | 18 | - If you get an error downloading the module "quick.db", you can delete the module "quick.db". 19 | 20 | ## Run Template 21 | 22 | **config.js** token entering the token of the short bot will make the bot work. You can also change the prefix, developer, and owners. 23 | 24 | ## Apache 25 | ### Apache 2.0 License 26 | [![License](https://img.shields.io/badge/License-Apache%202.0-yellowgreen.svg)](https://opensource.org/licenses/Apache-2.0) 27 | 28 | # Support and Help 29 | 30 | [![M|MayFe](https://cdn.discordapp.com/attachments/817825141051752498/870319476342661200/Layer_5_copy_2.png)](https://discord.com/users/402047297963294730) 31 | 32 | https://discord.gg/TuRcFwKgux 🚨 https://discord.gg/vE9ukmKCKH 33 | -------------------------------------------------------------------------------- /TXT/TXTSend/test.txt.txt: -------------------------------------------------------------------------------- 1 | Just Text -------------------------------------------------------------------------------- /TXT/eval/test.txt.txt: -------------------------------------------------------------------------------- 1 | Just Text -------------------------------------------------------------------------------- /TXT/lyrics/test.txt.txt: -------------------------------------------------------------------------------- 1 | Just Text -------------------------------------------------------------------------------- /commands/information/information.js: -------------------------------------------------------------------------------- 1 | import Discord from "discord.js"; 2 | import os from "os"; 3 | import { getMilliseconds, getReadableTime } from "quick-ms"; 4 | 5 | import Command from "../../schemas/commandSchema.js"; 6 | export default class InformationCommand extends Command { 7 | constructor() { 8 | super({ 9 | name: "istatistic", 10 | aliases: ["i", "istatistik"], 11 | usage: "ping", 12 | category: "information", 13 | description: "Show ping bot.", 14 | enabled: true, 15 | nsfw: false, 16 | permLevel: 0, 17 | 18 | async execute(MultiFunction) { 19 | const uptimeTime = getReadableTime(MultiFunction.client.uptime, { 20 | compact: true, 21 | }) 22 | .replace("d", "Gün") 23 | .replace("sec", "Saniye") 24 | .replace("min", "Dakika") 25 | .replace("hrs", "Saat") 26 | .replace("mo", "Ay") 27 | .replace("yrs", "Yıl"); 28 | 29 | const FREEmemoriesKB = os.freemem / 1024; 30 | const TOTALmemoriesKB = os.totalmem / 1024; 31 | const FREEmemoriesMB = FREEmemoriesKB / 1024; 32 | const TOTALmemoriesMB = TOTALmemoriesKB / 1024; 33 | const FREEmemoriesGB = FREEmemoriesMB / 1024; 34 | const TOTALmemoriesGB = TOTALmemoriesMB / 1024; 35 | const userMemories = process.memoryUsage().heapUsed / 1024 / 1024 / 1024; 36 | const memories = `Used => ${userMemories 37 | .toString() 38 | .slice(0, 4)} / Free => ${FREEmemoriesGB.toString().slice( 39 | 0, 40 | 4, 41 | )} / Total => ${TOTALmemoriesGB.toString().slice(0, 5)}`; 42 | 43 | let bymayfe = await MultiFunction.client.users.fetch( 44 | "402047297963294730", 45 | ); 46 | let seyfttn = await MultiFunction.client.users.fetch( 47 | "373493092881530887", 48 | ); 49 | 50 | const annencilermaldır = new Discord.MessageEmbed() 51 | .setColor("RANDOM") 52 | .setFooter( 53 | "GuardMayFe 'Buyur benim istatistiklerim", 54 | MultiFunction.client.user.avatarURL({ 55 | format: "png", 56 | dynamic: true, 57 | size: 1024, 58 | }), 59 | ) 60 | .addField( 61 | "<:ovner:742898481127096351> <:mayfe:742898571505827990> **Botun Sahibi**", 62 | bymayfe.tag, 63 | true, 64 | ) 65 | .addField( 66 | "<:botdev:715178721816084540> **Geliştirici** ", 67 | seyfttn.tag, 68 | true, 69 | ) 70 | .addField( 71 | "<:3028_discord_outage:742904729545343056> Botun Genel Özellikleri", 72 | `\`\`\`|Memories: ${memories}\n|Uptime: ${uptimeTime}\n|Users: ${MultiFunction.client.guilds.cache.reduce( 73 | (a, b) => a + b.memberCount, 74 | 0, 75 | )} |Servers: ${MultiFunction.client.guilds.cache.size.toLocaleString()} |Channels: ${MultiFunction.client.channels.cache.size.toLocaleString()}\`\`\``, 76 | ) 77 | .addField( 78 | "<:3434_Discord_js_logo:742904728098439230> **Discord.JS sürüm**", 79 | "v" + Discord.version, 80 | true, 81 | ) 82 | .addField( 83 | "<:node_js:742904730291929119> **Node.JS sürüm**", 84 | `${process.version}`, 85 | true, 86 | ) 87 | .addField( 88 | " **Ping**", 89 | MultiFunction.client.ws.ping + " ms", 90 | true, 91 | ) 92 | .addField( 93 | "<:1604_certified_green:742904728979112057> **CPU**", 94 | `\`\`\`md\n${os.cpus().map((i) => `${i.model}`)[0]} => ${ 95 | os.cpus().map((i) => `${i.speed}`)[0] 96 | }\`\`\``, 97 | ) 98 | .addField( 99 | "<:3334_windows10:742902593738637423> **Bit**", 100 | `\`${os.arch()}\``, 101 | true, 102 | ) 103 | .addField( 104 | "<:3334_windows10:742902593738637423> **İşletim Sistemi**", 105 | `\`\`${os.platform().replace("win32", "Windows")}\`\``, 106 | true, 107 | ) 108 | .addField( 109 | "**<:9195_upvote:742900154381893672> Voteleme sayfası**", 110 | " [OYLAR MISIN?](https://top.gg/bot/596071936799277116/vote)", 111 | ) 112 | .addField( 113 | "** Bot Davet**", 114 | " [Davet Et](https://discordapp.com/oauth2/authorize?client_id=596071936799277116&scope=bot&permissions=2146958847)", 115 | true, 116 | ) 117 | .addField( 118 | "** <:Support:742900531579584572> Destek Sunucusu**", 119 | " [Sunucumuza Katıl](https://discord.gg/DSc8uFp)", 120 | true, 121 | ); 122 | 123 | return MultiFunction.message.channel.send({ 124 | embeds: [annencilermaldır], 125 | }); 126 | }, 127 | }); 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /commands/information/ping.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | import Command from "../../schemas/commandSchema.js"; 3 | export default class PingCommand extends Command { 4 | constructor() { 5 | super({ 6 | name: "ping", 7 | aliases: ["ms", "delay", "timeout"], 8 | usage: "ping", 9 | category: "information", 10 | description: "Show ping bot.", 11 | 12 | async execute(MultiFunction) { 13 | const ping = MultiFunction.client.ws.ping; 14 | 15 | return MultiFunction.message.channel.send(`Pong! **${ping}**`); 16 | }, 17 | }); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /commands/owner/eval.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | import util from "util"; 3 | 4 | import Command from "../../schemas/commandSchema.js"; 5 | export default class EvalCommand extends Command { 6 | constructor() { 7 | super({ 8 | name: "eval", 9 | usage: "eval code", 10 | category: "owner", 11 | description: "Trying code to be executed.", 12 | ownerOnly: true, 13 | 14 | async execute(MultiFunction) { 15 | try { 16 | var code = MultiFunction.args.join(" "); 17 | var evaled = eval(code); 18 | 19 | if (typeof evaled !== "string") evaled = util.inspect(evaled); 20 | 21 | return MultiFunction.message.channel 22 | .send("```\n" + (await clean(evaled)) + "```") 23 | .catch((error) => { 24 | if (error.code === 50035) { 25 | return brain.TXTSend( 26 | MultiFunction.message.channel.id, 27 | "EVAL 2000", 28 | `${clean(evaled)}`, 29 | true, 30 | "eval", 31 | ); 32 | } else { 33 | console.log(error); 34 | } 35 | }); 36 | } catch (err) { 37 | return MultiFunction.message.channel 38 | .send(`\`HATA\` \`\`\`xl\n${clean(err)}\n\`\`\``) 39 | .catch((error) => { 40 | if (error.code === 50035) { 41 | return brain.TXTSend( 42 | MultiFunction.message.channel.id, 43 | "HATA EVAL 2000", 44 | `\`HATA\` \`\`\`xl\n${clean(err)}\n\`\`\``, 45 | true, 46 | "eval", 47 | ); 48 | } else { 49 | console.log(error); 50 | } 51 | }); 52 | } 53 | function clean(text) { 54 | if (typeof text === "string") { 55 | return text 56 | .replace(/`/g, "`" + String.fromCharCode(8203)) 57 | .replace(/@/g, "@" + String.fromCharCode(8203)); //.replace(ayarlar.token, "TOKEN(SECRET)").replace(ayarlar.token2, "TOKEN(SECRET)"); 58 | } else { 59 | return text; 60 | } 61 | } 62 | }, 63 | }); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /config.js: -------------------------------------------------------------------------------- 1 | export default 2 | { 3 | "token": "BOT_TOKEN", 4 | "prefix": "BOT_PREFIX", 5 | "owners": [ 6 | "402047297963294730" 7 | ], 8 | "developers": [ 9 | "373493092881530887" 10 | ], 11 | 12 | "youtube-api": "", 13 | "secret": "" 14 | } -------------------------------------------------------------------------------- /events/messageCreate_main.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | import ctx from '../multiFunction/multiFunction.js'; 3 | import ms from 'ms'; 4 | import { MessageEmbed } from "discord.js"; 5 | const CooldownArry = new Set(); 6 | 7 | export default class { 8 | constructor(){ 9 | } 10 | 11 | async execute(message) { 12 | const MultiFunction = new ctx(message, message.client); 13 | 14 | const prefix = MultiFunction.prefix 15 | const originalPrefix = MultiFunction.originalPrefix; 16 | const language = MultiFunction.lang; 17 | const args = MultiFunction.args; 18 | const command = MultiFunction.command; 19 | const permLevel = MultiFunction.permLevel; 20 | const client = MultiFunction.client; 21 | const userPermErrorArry = [], clientPermErrorArry = []; 22 | 23 | const mention = [`<@${client.user.id}>`, `<@!${client.user.id}>`]; 24 | if (!mention.some(word => message.content.startsWith(word) || message.content.startsWith(prefix) || message.content.startsWith(originalPrefix))) return; 25 | 26 | if(client.commands.has(command) || client.aliases.has(command)) { 27 | if(CooldownArry.has(message.author.id)) return message.reply(`You must wait ${ms(MultiFunction.cmd.conf.cooldown)} second.`); 28 | else Cooldown(message.author.id, CooldownArry, MultiFunction.cmd.conf.cooldown, false) 29 | var cmd = MultiFunction.cmd; 30 | } else return //message.reply(`Botta **\`${command}\`** komutu bulunmamaktadır.`) 31 | 32 | if (cmd.conf.maintenance === true) return message.reply(`This command has maintenance`); 33 | if (cmd.conf.enabled === false) return message.reply(`This command has disable from Bot Developers`); 34 | if (cmd.conf.developerOnly === true) if(!permLevel.botDeveloper) return message.reply(`To use this command, You must be "**Bot Developer**".`); 35 | if (cmd.conf.ownerOnly === true) if(!permLevel.botOwner) return message.reply(`To use this command, You must be "**Bot Owner**".`); 36 | 37 | if (cmd.conf.requiredUserPermissions[0]) { 38 | cmd.conf.requiredUserPermissions.forEach(perm => { 39 | if(!message.member.permissionsIn(message.channel).has(perm)) { 40 | userPermErrorArry.push(perm); 41 | }; 42 | }); 43 | }; 44 | 45 | if (cmd.conf.requiredClientPermissions[0]) { 46 | cmd.conf.requiredClientPermissions.forEach(perm => { 47 | if(!message.guild.me.permissionsIn(message.channel).has(perm)) { 48 | clientPermErrorArry.push(perm); 49 | }; 50 | }); 51 | }; 52 | 53 | 54 | if(userPermErrorArry[0] || clientPermErrorArry[0]) { 55 | let permErrorEmbed = new MessageEmbed() 56 | .setAuthor("Missing Permission/s", message.author.displayAvatarURL({ dynamic: true, format: "png", size: 1024})) 57 | .setColor("RED") 58 | .setTimestamp() 59 | if(userPermErrorArry[0]) permErrorEmbed.addField(`User Permissions`, `\`\`\`diff\n${userPermErrorArry.map((p) => `- ${p}`).join("\n")}\`\`\``) 60 | if(clientPermErrorArry[0]) permErrorEmbed.addField(`Client Permissions`, `\`\`\`diff\n${clientPermErrorArry.map((p) => `- ${p}`).join("\n")}\`\`\``) 61 | return MultiFunction.templateButtonMessage(message.channel.id,{ embeds: [permErrorEmbed]}) 62 | } 63 | 64 | cmd.execute(MultiFunction); 65 | 66 | function Cooldown(author, arry, time, owner) { 67 | if(owner === true) arry.add(author); 68 | else if(!permLevel.botOwner) arry.add(author); 69 | 70 | setTimeout(() => { 71 | if(arry.has(author)) { 72 | arry.delete(author); 73 | } 74 | }, time); 75 | }; 76 | } 77 | }; 78 | 79 | -------------------------------------------------------------------------------- /events/ready_main.js: -------------------------------------------------------------------------------- 1 | import chalk from 'chalk'; 2 | import moment from 'moment'; 3 | import config from '../config.js' 4 | 5 | export default class { 6 | constructor(client) { 7 | this.client = client 8 | }; 9 | async execute(client) { 10 | 11 | var game = [ 12 | "Thans for ByMayFe", 13 | "Thans for Seyfettin Budak", 14 | "This Template is V13" 15 | ]; 16 | 17 | setInterval(function() { 18 | var random = Math.floor(Math.random()*(game.length-0+1)+0); 19 | client.user.setActivity(game[random], { type: 'STREAMING', url: "https://twitch.tv/bymayfe", name: "ByMayFe"}); 20 | }, 2 * 30000); 21 | 22 | console.log(chalk.red(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] ${client.user.tag}: Aktif, Komutlar yüklendi!`)); 23 | console.log(chalk.red(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] ${client.user.tag}: ${client.user.username} ismi ile giriş yapıldı!`)); 24 | client.user.setStatus("online"); 25 | client.user.setActivity(`${config.prefix}yardım + ${client.guilds.cache.size} sunucu + ${client.users.cache.size} kullanıcı`, { type: 'STREAMING', url: "https://www.twitch.tv/bymayfe", name: "ByMayFe"}); 26 | console.log(chalk.red(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] ${client.user.tag}: Status Ayarlandı!`)); 27 | console.log(chalk.red(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] ${client.user.tag}: Şu an ${client.channels.cache.size} adet kanala, ${client.guilds.cache.size} adet sunucuya ve ${client.guilds.cache.reduce((a, b) => a + b.memberCount, 0).toLocaleString()} kullanıcıya hizmet veriliyor`)); 28 | }; 29 | }; -------------------------------------------------------------------------------- /handlers/BaseClient.js: -------------------------------------------------------------------------------- 1 | import { Client, Collection} from 'discord.js'; 2 | import config from '../config.js'; 3 | import commandHandler from "../handlers/commandHandler.js"; 4 | import eventHandler from "../handlers/eventHandler.js"; 5 | 6 | export default class Start extends Client { 7 | constructor() { 8 | super({ 9 | intents: 32767, //Tüm intentleri import ettik 10 | restTimeOffset: 100, // Bunu düşürmeyin (eğer bilgisayarınız kasıyorsa arttırabilirsiniz) default: 1000 11 | partials: ['MESSAGE', 'CHANNEL', 'REACTION'] //Bu ise bot reset yediğinde mesaj verilerini sildirtmiyor cacheyi devam ettiriyor (ellemeyin kalsın bu) 12 | }); 13 | this.commands = new Collection(); 14 | this.aliases = new Collection(); 15 | } 16 | 17 | async loader() { 18 | new commandHandler(this).load(); 19 | new eventHandler(this).load(); 20 | 21 | await this.login(config.token) 22 | } 23 | } -------------------------------------------------------------------------------- /handlers/commandHandler.js: -------------------------------------------------------------------------------- 1 | import { Collection } from 'discord.js'; 2 | import { readdirSync } from 'fs'; 3 | import chalk from 'chalk'; 4 | //import AsciiTable from 'ascii-table'; 5 | //const commandtable = new AsciiTable('MayFe Command Table'); 6 | 7 | export default class commandHandler { 8 | constructor(client) { 9 | this.client = client 10 | } 11 | 12 | load() { 13 | //commandtable.setHeading("Language","Command", 'Status', "Maintenance", "Perm LVL", "Category", "Aliases") 14 | readdirSync('./commands').forEach(dir => { 15 | const commandFiles = readdirSync(`./commands/${dir}/`).filter(file => file.endsWith('.js')); 16 | commandFiles.forEach(async file => { 17 | const command = new (await import(`../commands/${dir}/${file}`)).default(); 18 | /*const Import = await import(`../commands/${dir}/${file}`); 19 | const command = await new Import.default();*/ // kafanıza göre kullanın işte 20 | this.client.commands.set(command.help.name, command); 21 | console.log(chalk.magenta(`${command.help.name} => ${command.help.aliases} ✔️`)); 22 | //commandtable.addRow("languages", command.help.name, command.conf.enabled, command.conf.maintenance, "permLvl", dir, command.conf.aliases) 23 | command.help.aliases.forEach(aliase => this.client.aliases.set(aliase, command.help.name)); 24 | }); 25 | }); 26 | //console.log(chalk.magenta(commandtable.toString())); 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /handlers/eventHandler.js: -------------------------------------------------------------------------------- 1 | import { readdirSync } from 'fs'; 2 | 3 | export default class eventHandler { 4 | constructor(client) { 5 | this.client = client; 6 | } 7 | 8 | load() { 9 | readdirSync('./events/').forEach(async dir => { 10 | //console.log(dir) 11 | const eventName = dir.split("_")[0]; 12 | const event = new (await import(`../events/${dir}`)).default(); 13 | /*const Import = await import(`../events/${dir}`); 14 | const event = await new Import.default();*/ // kafanıza göre kullanın işte 15 | this.client.on(eventName, (...args) => event.execute(...args)); 16 | }); 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /main.mjs: -------------------------------------------------------------------------------- 1 | import Start from "./handlers/BaseClient.js"; 2 | new Start().loader() -------------------------------------------------------------------------------- /multiFunction/multiFunction.js: -------------------------------------------------------------------------------- 1 | import config from "../config.js"; 2 | import qdb from 'quick.db'; 3 | import fs from "fs"; 4 | import { MessageActionRow, Message, MessageAttachment, MessageButton } from "discord.js" 5 | import Start from "../handlers/BaseClient.js"; 6 | import permLevel from "./permLevel.js"; 7 | 8 | export default class MultiFunction { 9 | 10 | /** 11 | * @param {Message} message 12 | * @param { Start } client 13 | * @memberof MultiFunction 14 | */ 15 | constructor(message, client) { 16 | this.message = message; 17 | this.guild = message.guild; 18 | this.client = client 19 | this.user = message.member; 20 | this.permLevel = new permLevel(message.member, message.guild); 21 | this.config = config; 22 | this.date = new Date().toLocaleString("tr-TR", { timeZone: "Asia/Istanbul"}); 23 | /* -- Prefix -- */ 24 | this.originalPrefix = config.prefix; 25 | if (qdb.has(`prefix_${message.guild.id}`) === false) this.prefix = config.prefix; 26 | else this.prefix = qdb.fetch(`prefix_${message.guild.id}`); 27 | 28 | /* -- Argumans -- */ 29 | if (message.content.startsWith(this.prefix)) { 30 | this.args = message.content.split(' ').slice(1) 31 | this.command = message.content.split(' ')[0].slice(this.prefix.length); 32 | } else if (message.content.startsWith(this.originalPrefix)) { 33 | this.args = message.content.split(' ').slice(1) 34 | this.command = message.content.split(' ')[0].slice(this.originalPrefix.length); 35 | } else { 36 | this.args = message.content.split(' ').slice(2) 37 | this.command = message.content.split(' ')[1] 38 | } 39 | this.cmd = this.client.commands.has(this.command) ? this.client.commands.get(this.command) : this.client.commands.get(this.client.aliases.get(this.command)) 40 | /* -- THIS -- */ 41 | global.brain = this; 42 | this.brainList = Object.getOwnPropertyNames(this); 43 | } 44 | 45 | 46 | /** 47 | * 48 | * 49 | * @param {*} channel 50 | * @param {*} title 51 | * @param {*} content 52 | * @param {*} deleteTXT 53 | * @param {*} type 54 | * @return {*} 55 | * @memberof MultiFunction 56 | */ 57 | async TXTSend(channel, title, content, deleteTXT, type) { 58 | var kanal = this.message.client.channels.cache.get(channel); 59 | var FileNames = `${kanal.id}_${this.message.id}`; 60 | var fileName; 61 | 62 | if(type === "lyrics") fileName = './TXT/lyrics/'+ FileNames + '.txt'; 63 | else if(type === "eval") fileName = './TXT/eval/'+ FileNames + '.txt'; 64 | else if(type === "normal") fileName = './TXT/TXTSend/'+ FileNames + '.txt'; 65 | await fs.promises.appendFile(fileName, `${title}\n\n${content}`); 66 | const attachment = new MessageAttachment(fileName, `${title}.txt`); 67 | 68 | if(deleteTXT === true) { 69 | return kanal.send({files: [attachment]}).then(() => { 70 | fs.unlinkSync(fileName); 71 | }).catch(err => { 72 | console.error(err); 73 | }) 74 | } else { 75 | return kanal.send({files: [attachment]}); 76 | } 77 | } 78 | 79 | /** 80 | * 81 | * 82 | * @param {*} channel 83 | * @param {*} content 84 | * @return {*} 85 | * @memberof MultiFunction 86 | */ 87 | templateButtonMessage(channel, content) { 88 | if(!channel) throw new Error('Channel value is required.'); 89 | if(!content) throw new Error("Content values are required."); 90 | if(typeof content !== "object") throw new TypeError('Content must be an object'); 91 | const kanal = this.message.client.channels.cache.get(channel); 92 | const rowMenu = new MessageActionRow(); 93 | const row = new MessageActionRow(); 94 | row.addComponents( 95 | new MessageButton() 96 | .setCustomId('deleteCommandMessage') 97 | .setEmoji('🗑️') 98 | .setStyle('DANGER'), 99 | ); 100 | if(!content.components) content.components = [] 101 | var arryRow = []; 102 | if(content.components.length > 1) { 103 | var buttonSayi = 0; 104 | var menuSayi = 0; 105 | content.components.map(components => { 106 | components.components.map(com => { 107 | if(com.type === 'BUTTON') { 108 | if(buttonSayi < 1) { 109 | if(components.components.length > 4) throw new Error('First components MAX 4 add component'); 110 | row.components.push(com) 111 | arryRow.push(row) 112 | buttonSayi += 1 113 | } else { 114 | if(components.components.length > 5) throw new Error('Other components MAX 5 add component'); 115 | row[buttonSayi] = new MessageActionRow() 116 | .addComponents(); 117 | row[buttonSayi].components.push(com); 118 | arryRow.push(row[buttonSayi]) 119 | buttonSayi += 1 120 | } 121 | } else if (com.type === "SELECT_MENU") { 122 | // rowMenu[menuSayi] = new MessageActionRow() 123 | // .addComponents(); 124 | rowMenu.components.push(com); 125 | arryRow.push(rowMenu) 126 | } 127 | 128 | }) 129 | }); 130 | } else { 131 | content.components.map(components => { 132 | components.components.map(com => { 133 | if(com.type === 'BUTTON') { 134 | if(components.components.length > 4) return; 135 | row.components.push(com); 136 | } else if(com.type === "SELECT_MENU") { 137 | 138 | rowMenu.components.push(com); 139 | arryRow.push(rowMenu, row) 140 | } 141 | }) 142 | 143 | 144 | }) 145 | 146 | } 147 | var row2 = arryRow[0] ? arryRow : Array(row); 148 | 149 | const componentFilter = i => i.customId === "deleteCommandMessage" && i.user.id === this.message.member.id; 150 | 151 | const componentCollector = this.message.channel.createMessageComponentCollector({ componentFilter, max: 1}); 152 | 153 | componentCollector.on('collect', async c => { 154 | if (c.customId === 'deleteCommandMessage') { 155 | await c.message.delete({timeout: 2000}).catch(err => { 156 | if (err.code !== 10008) console.error(err) 157 | }); 158 | if(this.message) return this.message.delete({timeout: 3000}).catch(err => { 159 | if (err.code !== 10008) console.error(err) 160 | }); 161 | } 162 | }); 163 | return kanal.send({...content, components: [...row2]}) 164 | }; 165 | } 166 | -------------------------------------------------------------------------------- /multiFunction/permLevel.js: -------------------------------------------------------------------------------- 1 | import config from "../config.js"; 2 | import { Permissions } from "discord.js"; 3 | 4 | export default class permLevel { 5 | constructor (user, guild) { 6 | this.botOwner = config.owners.includes(user.user.id) 7 | this.botDeveloper = config.developers.includes(user.user.id) || this.botOwner; 8 | 9 | 10 | } 11 | 12 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mayfe-template", 3 | "version": "0.1.0", 4 | "description": "Gazamız mübarek ola", 5 | "main": "main.mjs", 6 | "scripts": { 7 | "test": "node main.mjs", 8 | "start": "node main.mjs", 9 | "jsonStart": "node --experimental-json-modules main.mjs # works" 10 | }, 11 | "keywords": [ 12 | "bymayfe", 13 | "mayfe", 14 | "discord.js", 15 | "V13", 16 | "Class", 17 | "ES6", 18 | "ESModules" 19 | ], 20 | "author": "ByMayFe", 21 | "license": "Apache-2.0", 22 | "type": "module", 23 | "dependencies": { 24 | "ascii-table": "^0.0.9", 25 | "chalk": "^4.1.2", 26 | "discord.js": "^13.1.0", 27 | "fs": "^0.0.1-security", 28 | "moment": "^2.29.1", 29 | "ms": "^2.1.3", 30 | "quick-ms": "^1.2.5", 31 | "quick.db": "^7.1.3" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /schemas/commandSchema.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | import Discord from "discord.js"; 3 | import Context from "../multiFunction/multiFunction.js"; 4 | export default class Schema { 5 | /** 6 | * @param {{ 7 | * execute: (ctx: Context) => Promise | unknown, 8 | * name: string; 9 | * aliases?: string[] 10 | * usage?: string, 11 | * category?: string, 12 | * enabled?: boolean;, 13 | * maintenance?: boolean, 14 | * ownerOnly?: boolean, 15 | * developerOnly?: boolean, 16 | * nsfw?: boolean, 17 | * requiredUserPermissions?: Discord.PermissionResolvable[] 18 | * requiredClientPermissions?: Discord.PermissionResolvable[] 19 | * cooldown: number; 20 | * }} 21 | */ 22 | constructor({ 23 | name = null, 24 | aliases = [], 25 | usage = null, 26 | category = null, 27 | description = null, 28 | enabled = true, 29 | maintenance = false, 30 | ownerOnly = false, 31 | developerOnly = false, 32 | nsfw = false, 33 | requiredUserPermissions = [], 34 | requiredClientPermissions = [], 35 | cooldown = 3000, 36 | execute, 37 | }) { 38 | this.conf = { 39 | enabled, 40 | maintenance, 41 | cooldown, 42 | nsfw, 43 | requiredUserPermissions, 44 | requiredClientPermissions, 45 | ownerOnly, 46 | developerOnly 47 | }; 48 | 49 | this.help = { name, aliases, usage, category, description }; 50 | this.execute = execute; 51 | } 52 | } 53 | --------------------------------------------------------------------------------