├── .github └── FUNDING.yml ├── LICENSE ├── README.md ├── botconfig ├── config.json ├── embed.json └── settings.json ├── commands ├── Administration │ ├── embed.js │ └── say.js ├── Information │ ├── avatar.js │ ├── commandcount.js │ ├── emojiinfo.js │ ├── help.js │ ├── invite.js │ ├── membercount.js │ ├── permissions.js │ ├── ping.js │ ├── roleinfo.js │ ├── serveravatar.js │ ├── serverinfo.js │ ├── support.js │ ├── uptime.js │ └── userinfo.js └── Owner │ ├── changeavatar.js │ ├── changename.js │ ├── cmdreload.js │ ├── detailedeval.js │ ├── eval.js │ └── reloadbot.js ├── events ├── client │ ├── debug.js │ ├── disconnect.js │ ├── error.js │ ├── rateLimit.js │ ├── ready.js │ ├── reconnecting.js │ ├── shardDisconnect.js │ ├── shardError.js │ ├── shardReady.js │ ├── shardReconnecting.js │ ├── shardResume.js │ └── warn.js └── guild │ ├── guildMemberAdd.js │ ├── interactionCreate.js │ ├── messageCreate.js │ ├── messageReactionAdd.js │ ├── messageReactionRemove.js │ ├── threadCreate.js │ └── voiceStateUpdate.js ├── handlers ├── antiCrash.js ├── commands.js ├── events.js ├── functions.js └── slashCommands.js ├── index.js ├── package.json └── slashCommands ├── Admin ├── embed.js └── say.js └── Info ├── ping.js └── userinfo.js /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: ['milrato.eu', 'dc.milrato.eu', 'bero.milrato.eu', 'bittmax.milrato.eu' ] 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Discord-Js-Handler-Template 2 | 3 | 4 | *** 5 | 6 | # [new Version - Discord.js v14 - Slash command only - but very effective](https://github.com/Tomato6966/discord-js-v14-handler) 7 | 8 | *** 9 | 10 | ### [**DISCORD SUPPORT SERVER INVITE**](https://support.milrato.eu) 11 | 12 | *** 13 | 14 | ## Installation Guide 15 | 16 |
17 | - have **node.js v16.6 or higher** 18 | 19 | - in `./botconfig/config.json` Adjust the BOT TOKEN and PREFIX 20 | 21 | - in `./botconfig/settings.json` Adjust the DEFAULT MESSAGES AND OTHER SETTINGS 22 | 23 | - in `./botconfig/embed.json` Adjust the EMBED SETTINGS 24 | 25 | - `npm install` to Install the depedences 26 | 27 | - `node .` to start the Bot 28 | 29 |
30 |
31 | 32 | *** 33 | 34 |
35 | 36 | ## Slash Commands Information 37 | 38 | > To add a Subcommand create a Folder in `./slashCommands` 39 | 40 | > Make sure to add it's Settings in `./botconfig/config.json` 41 | 42 | > You can't have more folder then 1 Layer 43 | 44 | > If u want to create "normal" Slash commands create the files just in `./slashCommands` 45 | 46 |
47 | 48 |
49 | 50 | *** 51 | 52 | ## [Discord Server 😎](https://discord.gg/milrato) | [Website](https://milrato.dev) 53 | 54 | 55 | *** 56 | 57 | ## SUPPORT ME AND MILRATO DEVELOPMENT 58 | 59 | > You can always Support me by inviting one of my **own Discord Bots** 60 | 61 | [![2021's best Music Bot | Lava Music](https://cdn.discordapp.com/attachments/748533465972080670/817088638780440579/test3.png)](https://lava.milrato.dev) 62 | [![Musicium Music Bot](https://cdn.discordapp.com/attachments/742446682381221938/770055673965707264/test1.png)](https://musicium.musicium.dev) 63 | [![Milrato Multi Bot](https://cdn.discordapp.com/attachments/742446682381221938/770056826724679680/test1.png)](https://milrato.milrato.dev) 64 | 65 | # Credits 66 | 67 | > If consider using this Bot, make sure to credit me! 68 | -------------------------------------------------------------------------------- /botconfig/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "token": "DISCORD BOT TOKEN", 3 | "prefix": "!", 4 | "loadSlashsGlobal": false, "_COMMENT_": "Set it to true, when your Slash Commands are ready, false loads instant true loads slow but stable! (GLOBAL/GUILD COMMANDS, DISCORD DOCS!)", 5 | "slashCommandsDirs": [ 6 | { 7 | "Folder": "Info", 8 | "CmdName": "info", 9 | "CmdDescription": "Grant specific Information about something!" 10 | }, 11 | { 12 | "Folder": "Admin", 13 | "CmdName": "admin", 14 | "CmdDescription": "Administrate the Server!" 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /botconfig/embed.json: -------------------------------------------------------------------------------- 1 | { 2 | "color": "#3498db", 3 | "wrongcolor": "#e01e01", 4 | "footertext": "Your Bot Name | powered by milrato.eu", 5 | "footericon": "https://img.icons8.com/color/452/discord-logo.png" 6 | } 7 | -------------------------------------------------------------------------------- /botconfig/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ownerIDS": ["442355791412854784"], 3 | "default_cooldown_in_sec" : 1.5, 4 | "antiCrash": true, 5 | "ping_message": true, 6 | "delete_commands": true, 7 | "somethingwentwrong_cmd": true, 8 | 9 | "messages": { 10 | "ping_message": "To see all Commands type: `%{prefix}%help`", 11 | "cooldown": "❌ Please wait %{timeleft}% more Second(s) before reusing the `%{commandname}%` command.", 12 | "notallowed_to_exec_cmd": { 13 | "title": "❌ You are not allowed to run this command!", 14 | "description": { 15 | "memberpermissions": "You need these Permissions:\n> %{commandmemberpermissions}%", 16 | "alloweduserids": "You need to be one of the Following Users:\n> %{commandalloweduserids}%", 17 | "requiredroles": "You need to have one of the Following Roles:\n> %{commandrequiredroles}%", 18 | "default": "Please make sure, to get the needed Permissions!" 19 | } 20 | }, 21 | "somethingwentwrong_cmd": { 22 | "title": "❌ Something went wrong while, running the: `%{commandname}%` command", 23 | "description": "```%{errormessage}%```" 24 | }, 25 | "unknown_cmd": "❌ Unkown command, try: **`%{prefix}%help`**", 26 | "error_occur": "❌ An error occurred", 27 | "error_occur_desc": "````%{errorstack}%````" 28 | }, 29 | "timeout": { 30 | "notallowed_to_exec_cmd": { 31 | "memberpermissions": 4500, 32 | "alloweduserids": 3500, 33 | "requiredroles": 3500 34 | }, 35 | "minargs": 3000, 36 | "maxargs": 3000, 37 | "minplusargs": 3000, 38 | "maxplusargs": 3000 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /commands/Administration/embed.js: -------------------------------------------------------------------------------- 1 | const { MessageEmbed } = require("discord.js"); 2 | const config = require("../../botconfig/config.json"); 3 | const ee = require("../../botconfig/embed.json"); 4 | module.exports = { //if [OPTIONAL] it means, you don't need to type it! 5 | name: "embed", //the Command Name [REQUIRED] 6 | category: "Administration", //the Command Category [OPTIONAL] 7 | aliases: [], //the command aliases [OPTIONAL] 8 | cooldown: 2, //the Command Cooldown (Default in /botconfig/settings.json) [OPTIONAL] 9 | usage: "embed ++ <Description>", //the Command usage [OPTIONAL] 10 | description: "Resends your Text in an embed", //the command description [OPTIONAL] 11 | memberpermissions: ["ADMINISTRATION"], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 12 | requiredroles: ["818267553637597224"], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 13 | alloweduserids: [], //Only allow specific Users to execute a Command [OPTIONAL] 14 | minargs: 0, // minimum args for the message, 0 == none [OPTIONAL] 15 | maxargs: 0, // maximum args for the message, 0 == none [OPTIONAL] 16 | minplusargs: 1, // minimum args for the message, splitted with "++" , 0 == none [OPTIONAL] 17 | maxplusargs: 0, // maximum args for the message, splitted with "++" , 0 == none [OPTIONAL] 18 | argsmissing_message: "", //Message if the user has not enough args / not enough plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 19 | argstoomany_message: "", //Message if the user has too many / not enough args / too many plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 20 | run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { 21 | try{ 22 | let title = plusArgs[0]; 23 | let desc = plusArgs.slice(1).join(" ") 24 | message.reply({embeds: [new MessageEmbed() 25 | .setColor(ee.color) 26 | .setFooter(ee.footertext, ee.footericon) 27 | .setTitle(title && desc ? title.substr(0, 256) : "") 28 | .setDescription(desc ? desc : title ? title.substr(0, 2048) : "")] 29 | }) 30 | } catch (e) { 31 | console.log(String(e.stack).bgRed) 32 | return message.reply({embeds: [new MessageEmbed() 33 | .setColor(ee.wrongcolor) 34 | .setFooter(ee.footertext, ee.footericon) 35 | .setTitle(`❌ ERROR | An error occurred`) 36 | .setDescription(`\`\`\`${e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000)}\`\`\``) 37 | ]}); 38 | } 39 | } 40 | } 41 | /** 42 | * @INFO 43 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template 44 | * @INFO 45 | * Work for Milrato Development | https://milrato.eu 46 | * @INFO 47 | * Please mention Him / Milrato Development, when using this Code! 48 | * @INFO 49 | */ 50 | -------------------------------------------------------------------------------- /commands/Administration/say.js: -------------------------------------------------------------------------------- 1 | const { MessageEmbed } = require("discord.js"); 2 | const config = require("../../botconfig/config.json"); 3 | const ee = require("../../botconfig/embed.json"); 4 | module.exports = { 5 | name: "say", //the Command Name 6 | category: "Administration", //the Command Category [OPTIONAL] 7 | aliases: [], //the command aliases [OPTIONAL] 8 | cooldown: 2, //the Command Cooldown (Default in /botconfig/settings.json) [OPTIONAL] 9 | usage: "say <TEXT>", //the Command usage [OPTIONAL] 10 | description: "Resends your Text", //the command description [OPTIONAL] 11 | memberpermissions: ["MANAGE_SERVER"], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 12 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 13 | alloweduserids: ["442355791412854784"], //Only allow specific Users to execute a Command [OPTIONAL] 14 | minargs: 1, // minimum args for the message, 0 == none [OPTIONAL] 15 | maxargs: 0, // maximum args for the message, 0 == none [OPTIONAL] 16 | minplusargs: 0, // minimum args for the message, splitted with "++" , 0 == none [OPTIONAL] 17 | maxplusargs: 0, // maximum args for the message, splitted with "++" , 0 == none [OPTIONAL] 18 | argsmissing_message: "You are missing the text you wanna add to the message!", //Message if the user has not enough args / not enough plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 19 | argstoomany_message: "You are having too many arguments for this Command!", //Message if the user has too many / not enough args / too many plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 20 | run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { 21 | try{ 22 | if(!args[0]) 23 | return message.reply({embeds: [new MessageEmbed() 24 | .setColor(ee.wrongcolor) 25 | .setFooter(ee.footertext, ee.footericon) 26 | .setTitle(`❌ ERROR | You didn't provided a Text`) 27 | .setDescription(`Usage: \`${prefix}say <Your Text>\``)] 28 | }); 29 | message.reply(text.substr(0, 2000)); 30 | } catch (e) { 31 | console.log(String(e.stack).bgRed) 32 | return message.reply({embeds: [new MessageEmbed() 33 | .setColor(ee.wrongcolor) 34 | .setFooter(ee.footertext, ee.footericon) 35 | .setTitle(`❌ ERROR | An error occurred`) 36 | .setDescription(`\`\`\`${e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000)}\`\`\``) 37 | ]}); 38 | } 39 | } 40 | } 41 | /** 42 | * @INFO 43 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template 44 | * @INFO 45 | * Work for Milrato Development | https://milrato.eu 46 | * @INFO 47 | * Please mention Him / Milrato Development, when using this Code! 48 | * @INFO 49 | */ 50 | -------------------------------------------------------------------------------- /commands/Information/avatar.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const {MessageEmbed} = require("discord.js"); 3 | const config = require("../../botconfig/config.json"); 4 | var ee = require("../../botconfig/embed.json"); 5 | const { GetUser, GetGlobalUser } = require("../../handlers/functions") 6 | const settings = require("../../botconfig/settings.json"); 7 | module.exports = { 8 | name: "avatar", //the command name for execution & for helpcmd [OPTIONAL] 9 | category: "Information", //the command category for helpcmd [OPTIONAL] 10 | aliases: ["useravatar", "logo"], //the command aliases for helpcmd [OPTIONAL] 11 | cooldown: 5, //the command cooldown for execution & for helpcmd [OPTIONAL] 12 | usage: "avatar [@USER] [global]", //the command usage for helpcmd [OPTIONAL] 13 | description: "Shows the Avatar of a User", //the command description for helpcmd [OPTIONAL] 14 | memberpermissions: [], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 15 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 16 | alloweduserids: [], //Only allow specific Users to execute a Command [OPTIONAL] 17 | minargs: 0, // minimum args for the message, 0 == none [OPTIONAL] 18 | maxargs: 0, // maximum args for the message, 0 == none [OPTIONAL] 19 | minplusargs: 0, // minimum args for the message, splitted with "++" , 0 == none [OPTIONAL] 20 | maxplusargs: 0, // maximum args for the message, splitted with "++" , 0 == none [OPTIONAL] 21 | argsmissing_message: "", //Message if the user has not enough args / not enough plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 22 | argstoomany_message: "", //Message if the user has too many / not enough args / too many plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 23 | run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { 24 | try { 25 | 26 | var user; 27 | try{ 28 | if(args[1] && args[1].toLowerCase() == "global"){ 29 | args.pop() 30 | user = await GetGlobalUser(message, args) 31 | }else { 32 | user = await GetUser(message, args) 33 | } 34 | }catch (e){ 35 | return message.reply(e) 36 | } 37 | message.reply({embeds: [new Discord.MessageEmbed() 38 | .setAuthor(`Avatar from: ${user.tag}`, user.displayAvatarURL({dynamic: true}), "https://discord.gg/FQGXbypRf8") 39 | .setColor(ee.color) 40 | .addField("❱ PNG",`[\`LINK\`](${user.displayAvatarURL({format: "png"})})`, true) 41 | .addField("❱ JPEG",`[\`LINK\`](${user.displayAvatarURL({format: "jpg"})})`, true) 42 | .addField("❱ WEBP",`[\`LINK\`](${user.displayAvatarURL({format: "webp"})})`, true) 43 | .setURL(user.displayAvatarURL({ 44 | dynamic: true 45 | })) 46 | .setFooter(ee.footertext, ee.footericon) 47 | .setImage(user.displayAvatarURL({ 48 | dynamic: true, size: 512, 49 | })) 50 | ]}); 51 | } catch (e) { 52 | console.log(String(e.stack).bgRed) 53 | return message.reply({embeds: [new MessageEmbed() 54 | .setColor(ee.wrongcolor) 55 | .setFooter(ee.footertext, ee.footericon) 56 | .setTitle(`❌ ERROR | An error occurred`) 57 | .setDescription(`\`\`\`${e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000)}\`\`\``) 58 | ]}); 59 | } 60 | } 61 | } 62 | /** 63 | * @INFO 64 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/discord-js-lavalink-Music-Bot-erela-js 65 | * @INFO 66 | * Work for Milrato Development | https://milrato.eu 67 | * @INFO 68 | * Please mention Him / Milrato Development, when using this Code! 69 | * @INFO 70 | */ 71 | -------------------------------------------------------------------------------- /commands/Information/commandcount.js: -------------------------------------------------------------------------------- 1 | const { 2 | MessageEmbed 3 | } = require("discord.js"); 4 | const config = require("../../botconfig/config.json"); 5 | var ee = require("../../botconfig/embed.json"); 6 | const settings = require("../../botconfig/settings.json"); 7 | module.exports = { 8 | name: "commandcount", //the command name for execution & for helpcmd [OPTIONAL] 9 | category: "Information", //the command category for helpcmd [OPTIONAL] 10 | aliases: ["cmdcount", "commandamount", "cmdamount"], //the command aliases for helpcmd [OPTIONAL] 11 | cooldown: 5, //the command cooldown for execution & for helpcmd [OPTIONAL] 12 | usage: "commandcount", //the command usage for helpcmd [OPTIONAL] 13 | description: "Shows the Amount of Commands an Categories", //the command description for helpcmd [OPTIONAL] 14 | memberpermissions: [], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 15 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 16 | alloweduserids: [], //Only allow specific Users to execute a Command [OPTIONAL] 17 | minargs: 0, // minimum args for the message, 0 == none [OPTIONAL] 18 | maxargs: 0, // maximum args for the message, 0 == none [OPTIONAL] 19 | minplusargs: 0, // minimum args for the message, splitted with "++" , 0 == none [OPTIONAL] 20 | maxplusargs: 0, // maximum args for the message, splitted with "++" , 0 == none [OPTIONAL] 21 | argsmissing_message: "", //Message if the user has not enough args / not enough plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 22 | argstoomany_message: "", //Message if the user has too many / not enough args / too many plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 23 | run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { 24 | try { 25 | message.reply({embeds: [new MessageEmbed() 26 | .setColor(ee.color) 27 | .setFooter(ee.footertext, ee.footericon) 28 | .setTitle(`:gear: **[${client.commands.size}] Commands**`) 29 | .setDescription(`:gear: **[${client.categories.length}] Categories**`) 30 | ]}); 31 | } catch (e) { 32 | console.log(String(e.stack).bgRed) 33 | return message.reply({embeds: [new MessageEmbed() 34 | .setColor(ee.wrongcolor) 35 | .setFooter(ee.footertext, ee.footericon) 36 | .setTitle(`❌ ERROR | An error occurred`) 37 | .setDescription(`\`\`\`${e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000)}\`\`\``) 38 | ]}); 39 | } 40 | } 41 | } 42 | /** 43 | * @INFO 44 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/discord-js-lavalink-Music-Bot-erela-js 45 | * @INFO 46 | * Work for Milrato Development | https://milrato.eu 47 | * @INFO 48 | * Please mention Him / Milrato Development, when using this Code! 49 | * @INFO 50 | */ 51 | -------------------------------------------------------------------------------- /commands/Information/emojiinfo.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const {MessageEmbed} = require("discord.js"); 3 | const config = require("../../botconfig/config.json"); 4 | var ee = require("../../botconfig/embed.json"); 5 | const moment = require("moment") 6 | const settings = require("../../botconfig/settings.json"); 7 | module.exports = { 8 | name: "emojiinfo", //the command name for execution & for helpcmd [OPTIONAL] 9 | category: "Information", //the command category for helpcmd [OPTIONAL] 10 | aliases: [], //the command aliases for helpcmd [OPTIONAL] 11 | cooldown: 5, //the command cooldown for execution & for helpcmd [OPTIONAL] 12 | usage: "emojiinfo <Emoji>", //the command usage for helpcmd [OPTIONAL] 13 | description: "Shows Information about an Emoji", //the command description for helpcmd [OPTIONAL] 14 | memberpermissions: [], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 15 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 16 | alloweduserids: [], //Only allow specific Users to execute a Command [OPTIONAL] 17 | minargs: 1, // minimum args for the message, 0 == none [OPTIONAL] 18 | maxargs: 0, // maximum args for the message, 0 == none [OPTIONAL] 19 | minplusargs: 0, // minimum args for the message, splitted with "++" , 0 == none [OPTIONAL] 20 | maxplusargs: 0, // maximum args for the message, splitted with "++" , 0 == none [OPTIONAL] 21 | argsmissing_message: "", //Message if the user has not enough args / not enough plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 22 | argstoomany_message: "", //Message if the user has too many / not enough args / too many plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 23 | run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { 24 | try { 25 | let hasEmoteRegex = /<a?:.+:\d+>/gm 26 | let emoteRegex = /<:.+:(\d+)>/gm 27 | let animatedEmoteRegex = /<a:.+:(\d+)>/gm 28 | 29 | if(!message.content.match(hasEmoteRegex)) 30 | return message.reply("❌ Your message does not include a VALID Emoji, please retry by adding a guild specific emoji!") 31 | 32 | if (emoji1 = emoteRegex.exec(message)) { 33 | let url = "https://cdn.discordapp.com/emojis/" + emoji1[1] + ".png?v=1" 34 | const emoji = message.guild.emojis.cache.find((emj) => emj.name === emoji1[1] || emj.id == emoji1[1]) 35 | if(!emoji) return message.reply("Please provide a custom Emoji from **THIS GUILD**") 36 | 37 | const authorFetch = await emoji.fetchAuthor(); 38 | const checkOrCross = (bool) => bool ? "✅" : "❌" ; 39 | const embed = new MessageEmbed() 40 | .setTitle(`**Emoji Information for: __\`${emoji.name.toLowerCase()}\`__**`) 41 | .setColor(ee.color) 42 | .setThumbnail(emoji.url) 43 | .addField("**General:**", [ 44 | `**ID:** \`${emoji.id}\``, 45 | `**URL:** [\`LINK\`](${emoji.url})`, 46 | `**AUTHOR:** ${authorFetch} (\`${authorFetch.id}\`)`, 47 | `**CREATED AT:** \`${moment(emoji.createdTimestamp).format("DD/MM/YYYY") + " | " + moment(emoji.createdTimestamp).format("hh:mm:ss")}\`` 48 | ]) 49 | .addField("**Others:**", [ 50 | `**Requires Colons:** \`${checkOrCross(emoji.requireColons)}\``, 51 | `**Animated:** \`${checkOrCross(emoji.animated)}\``, 52 | `**Deleteable:** \`${checkOrCross(emoji.deleteable)}\``, 53 | `**Managed:** \`${checkOrCross(emoji.managed)}\``, 54 | ]).setFooter(ee.footertext, ee.footericon) 55 | message.reply({embeds: [embed]}) 56 | } 57 | else if (emoji1 = animatedEmoteRegex.exec(message)) { 58 | let url2 = "https://cdn.discordapp.com/emojis/" + emoji1[1] + ".gif?v=1" 59 | let attachment2 = new Discord.MessageAttachment(url2, "emoji.gif") 60 | const emoji = message.guild.emojis.cache.find((emj) => emj.name === emoji1[1] || emj.id == emoji1[1]) 61 | if(!emoji) return message.reply("Please provide a custom Emoji from **THIS GUILD**") 62 | 63 | const authorFetch = await emoji.fetchAuthor(); 64 | const checkOrCross = (bool) => bool ? "✅" : "❌" ; 65 | const embed = new MessageEmbed() 66 | .setTitle(`**Emoji Information for: __\`${emoji.name.toLowerCase()}\`__**`) 67 | .setColor(ee.color) 68 | .setThumbnail(emoji.url) 69 | .addField("**General:**", [ 70 | `**ID:** \`${emoji.id}\``, 71 | `**URL:** [\`LINK\`](${emoji.url})`, 72 | `**AUTHOR:** ${authorFetch} (\`${authorFetch.id}\`)`, 73 | `**CREATED AT:** \`${moment(emoji.createdTimestamp).format("DD/MM/YYYY") + " | " + moment(emoji.createdTimestamp).format("hh:mm:ss")}\`` 74 | ]) 75 | .addField("**Others:**", [ 76 | `**Requires Colons:** \`${checkOrCross(emoji.requireColons)}\``, 77 | `**Animated:** \`${checkOrCross(emoji.animated)}\``, 78 | `**Deleteable:** \`${checkOrCross(emoji.deleteable)}\``, 79 | `**Managed:** \`${checkOrCross(emoji.managed)}\``, 80 | ]).setFooter(ee.footertext, ee.footericon) 81 | message.reply({embeds: [embed]}) 82 | } 83 | else { 84 | message.reply("Couldn't find an emoji to paste! if it's uniced(standard) and not a guild Emoji, it's not possible!") 85 | } 86 | } catch (e) { 87 | console.log(String(e.stack).bgRed) 88 | return message.reply({embeds: [new MessageEmbed() 89 | .setColor(ee.wrongcolor) 90 | .setFooter(ee.footertext, ee.footericon) 91 | .setTitle(`❌ ERROR | An error occurred`) 92 | .setDescription(`\`\`\`${e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000)}\`\`\``) 93 | ]}); 94 | } 95 | } 96 | } 97 | /** 98 | * @INFO 99 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/discord-js-lavalink-Music-Bot-erela-js 100 | * @INFO 101 | * Work for Milrato Development | https://milrato.eu 102 | * @INFO 103 | * Please mention Him / Milrato Development, when using this Code! 104 | * @INFO 105 | */ 106 | -------------------------------------------------------------------------------- /commands/Information/help.js: -------------------------------------------------------------------------------- 1 | const { MessageEmbed } = require("discord.js"); 2 | const config = require("../../botconfig/config.json"); 3 | const ee = require("../../botconfig/embed.json"); 4 | const settings = require("../../botconfig/settings.json"); 5 | module.exports = { 6 | name: "help", //the command name for execution & for helpcmd [OPTIONAL] 7 | category: "Information", //the command category for helpcmd [OPTIONAL] 8 | aliases: ["h", "commandinfo", "cmds", "cmd", "halp"], //the command aliases for helpcmd [OPTIONAL] 9 | cooldown: 3, //the command cooldown for execution & for helpcmd [OPTIONAL] 10 | usage: "help [Commandname]", //the command usage for helpcmd [OPTIONAL] 11 | description: "Returns all Commmands, or one specific command", //the command description for helpcmd [OPTIONAL] 12 | memberpermissions: [], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 13 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 14 | alloweduserids: [], //Only allow specific Users to execute a Command [OPTIONAL] 15 | minargs: 0, // minimum args for the message, 0 == none [OPTIONAL] 16 | maxargs: 0, // maximum args for the message, 0 == none [OPTIONAL] 17 | minplusargs: 0, // minimum args for the message, splitted with "++" , 0 == none [OPTIONAL] 18 | maxplusargs: 0, // maximum args for the message, splitted with "++" , 0 == none [OPTIONAL] 19 | argsmissing_message: "", //Message if the user has not enough args / not enough plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 20 | argstoomany_message: "", //Message if the user has too many / not enough args / too many plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 21 | run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { 22 | try{ 23 | if (args[0]) { 24 | const embed = new MessageEmbed(); 25 | const cmd = client.commands.get(args[0].toLowerCase()) || client.commands.get(client.aliases.get(args[0].toLowerCase())); 26 | if (!cmd) { 27 | return message.reply({embeds: [embed.setColor(ee.wrongcolor).setDescription(`No Information found for command **${args[0].toLowerCase()}**`)]}); 28 | } 29 | if (cmd.name) embed.addField("**Command name**", `\`${cmd.name}\``); 30 | if (cmd.name) embed.setTitle(`Detailed Information about:\`${cmd.name}\``); 31 | if (cmd.description) embed.addField("**Description**", `\`${cmd.description}\``); 32 | if (cmd.aliases) embed.addField("**Aliases**", `\`${cmd.aliases.map((a) => `${a}`).join("`, `")}\``); 33 | if (cmd.cooldown) embed.addField("**Cooldown**", `\`${cmd.cooldown} Seconds\``); 34 | else embed.addField("**Cooldown**", `\`${settings.default_cooldown_in_sec} Second\``); 35 | if (cmd.usage) { 36 | embed.addField("**Usage**", `\`${prefix}${cmd.usage}\``); 37 | embed.setFooter("Syntax: <> = required, [] = optional"); 38 | } 39 | return message.reply({embeds: [embed.setColor(ee.color)]}); 40 | } else { 41 | const embed = new MessageEmbed() 42 | .setColor(ee.color) 43 | .setThumbnail(client.user.displayAvatarURL()) 44 | .setTitle("HELP MENU 🔰 Commands") 45 | .setFooter(`To see command Descriptions and Information, type: ${prefix}help [CMD NAME]`, client.user.displayAvatarURL()); 46 | const commands = (category) => { 47 | return client.commands.filter((cmd) => cmd.category === category).map((cmd) => `\`${cmd.name}\``); 48 | }; 49 | try { 50 | for (let i = 0; i < client.categories.length; i += 1) { 51 | const current = client.categories[i]; 52 | const items = commands(current); 53 | embed.addField(`**${current.toUpperCase()} [${items.length}]**`, `> ${items.join(", ")}`); 54 | } 55 | } catch (e) { 56 | console.log(String(e.stack).red); 57 | } 58 | message.reply({embeds: [embed]}); 59 | } 60 | } catch (e) { 61 | console.log(String(e.stack).bgRed) 62 | return message.reply({embeds: [new MessageEmbed() 63 | .setColor(ee.wrongcolor) 64 | .setFooter(ee.footertext, ee.footericon) 65 | .setTitle(`❌ ERROR | An error occurred`) 66 | .setDescription(`\`\`\`${e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000)}\`\`\``) 67 | ]}); 68 | } 69 | } 70 | } 71 | /** 72 | * @INFO 73 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template 74 | * @INFO 75 | * Work for Milrato Development | https://milrato.eu 76 | * @INFO 77 | * Please mention Him / Milrato Development, when using this Code! 78 | * @INFO 79 | */ 80 | -------------------------------------------------------------------------------- /commands/Information/invite.js: -------------------------------------------------------------------------------- 1 | const { 2 | MessageEmbed 3 | } = require("discord.js"); 4 | const config = require("../../botconfig/config.json"); 5 | var ee = require("../../botconfig/embed.json"); 6 | const settings = require("../../botconfig/settings.json"); 7 | module.exports = { 8 | name: "invite", //the command name for execution & for helpcmd [OPTIONAL] 9 | category: "Information", //the command category for helpcmd [OPTIONAL] 10 | aliases: ["add"], //the command aliases for helpcmd [OPTIONAL] 11 | cooldown: 5, //the command cooldown for execution & for helpcmd [OPTIONAL] 12 | usage: "invite", //the command usage for helpcmd [OPTIONAL] 13 | description: "Sends you an invite link", //the command description for helpcmd [OPTIONAL] 14 | memberpermissions: [], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 15 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 16 | alloweduserids: [], //Only allow specific Users to execute a Command [OPTIONAL] 17 | minargs: 0, // minimum args for the message, 0 == none [OPTIONAL] 18 | maxargs: 0, // maximum args for the message, 0 == none [OPTIONAL] 19 | minplusargs: 0, // minimum args for the message, splitted with "++" , 0 == none [OPTIONAL] 20 | maxplusargs: 0, // maximum args for the message, splitted with "++" , 0 == none [OPTIONAL] 21 | argsmissing_message: "", //Message if the user has not enough args / not enough plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 22 | argstoomany_message: "", //Message if the user has too many / not enough args / too many plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 23 | run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { 24 | try { 25 | message.reply(`https://discord.com/api/oauth2/authorize?client_id=${client.user.id}&permissions=8&scope=bot`); 26 | } catch (e) { 27 | console.log(String(e.stack).bgRed) 28 | return message.reply({embeds: [new MessageEmbed() 29 | .setColor(ee.wrongcolor) 30 | .setFooter(ee.footertext, ee.footericon) 31 | .setTitle(`❌ ERROR | An error occurred`) 32 | .setDescription(`\`\`\`${e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000)}\`\`\``) 33 | ]}); 34 | } 35 | } 36 | } 37 | /** 38 | * @INFO 39 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/discord-js-lavalink-Music-Bot-erela-js 40 | * @INFO 41 | * Work for Milrato Development | https://milrato.eu 42 | * @INFO 43 | * Please mention Him / Milrato Development, when using this Code! 44 | * @INFO 45 | */ 46 | -------------------------------------------------------------------------------- /commands/Information/membercount.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const {MessageEmbed} = require("discord.js"); 3 | const config = require("../../botconfig/config.json") 4 | var ee = require("../../botconfig/embed.json") 5 | const settings = require("../../botconfig/settings.json"); 6 | module.exports = { 7 | name: "membercount", //the command name for execution & for helpcmd [OPTIONAL] 8 | category: "Information", //the command category for helpcmd [OPTIONAL] 9 | aliases: [], //the command aliases for helpcmd [OPTIONAL] 10 | cooldown: 5, //the command cooldown for execution & for helpcmd [OPTIONAL] 11 | usage: "membercount", //the command usage for helpcmd [OPTIONAL] 12 | description: "Shows the Amount of Members in DETAIL", //the command description for helpcmd [OPTIONAL] 13 | memberpermissions: [], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 14 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 15 | alloweduserids: [], //Only allow specific Users to execute a Command [OPTIONAL] 16 | minargs: 0, // minimum args for the message, 0 == none [OPTIONAL] 17 | maxargs: 0, // maximum args for the message, 0 == none [OPTIONAL] 18 | minplusargs: 0, // minimum args for the message, splitted with "++" , 0 == none [OPTIONAL] 19 | maxplusargs: 0, // maximum args for the message, splitted with "++" , 0 == none [OPTIONAL] 20 | argsmissing_message: "", //Message if the user has not enough args / not enough plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 21 | argstoomany_message: "", //Message if the user has too many / not enough args / too many plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 22 | run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { 23 | try { 24 | await message.guild.members.fetch(); 25 | message.reply({embeds: [new Discord.MessageEmbed() 26 | .setAuthor("Member-Count Information About: " + message.guild.name, message.guild.iconURL({ 27 | dynamic: true 28 | }), "https://clan.milrato.eu") 29 | .setColor(ee.color) 30 | .addField("❱ Total USERS", "😀 \`" + message.guild.memberCount + "\`", true) 31 | .addField("❱ Total HUMANS", "👤 \`" + message.guild.members.cache.filter(member => !member.user.bot).size + "\`", true) 32 | .addField("❱ Total BOTS", "🤖 \`" + message.guild.members.cache.filter(member => member.user.bot).size + "\`", true) 33 | 34 | .addField("❱ ONLINE", "🟢 \`" + message.guild.members.cache.filter(member => member.presence.status != "offline").size + "\`", true) 35 | .addField("❱ ONLINE", "🟢 \`" + message.guild.members.cache.filter(member => !member.user.bot && member.presence.status != "offline").size + "\`", true) 36 | .addField("❱ ONLINE", "🟢 \`" + message.guild.members.cache.filter(member => member.user.bot && member.presence.status != "offline").size + "\`", true) 37 | 38 | .addField("❱ IDLE", "🟠 \`" + message.guild.members.cache.filter(member => member.presence.status == "idle").size + "\`", true) 39 | .addField("❱ IDLE", "🟠 \`" + message.guild.members.cache.filter(member => !member.user.bot && member.presence.status == "idle").size + "\`", true) 40 | .addField("❱ IDLE", "🟠 \`" + message.guild.members.cache.filter(member => member.user.bot && member.presence.status == "idle").size + "\`", true) 41 | 42 | .addField("❱ DND", "🔴 \`" + message.guild.members.cache.filter(member => member.presence.status == "dnd").size + "\`", true) 43 | .addField("❱ DND", "🔴 \`" + message.guild.members.cache.filter(member => !member.user.bot && member.presence.status == "dnd").size + "\`", true) 44 | .addField("❱ DND", "🔴 \`" + message.guild.members.cache.filter(member => member.user.bot && member.presence.status == "dnd").size + "\`", true) 45 | 46 | .addField("❱ OFFLINE", ":black_circle:\`" + message.guild.members.cache.filter(member => member.presence.status == "offline").size + "\`", true) 47 | .addField("❱ OFFLINE", ":black_circle:\`" + message.guild.members.cache.filter(member => !member.user.bot && member.presence.status == "offline").size + "\`", true) 48 | .addField("❱ OFFLINE", ":black_circle:\`" + message.guild.members.cache.filter(member => member.user.bot && member.presence.status == "offline").size + "\`", true) 49 | .setTimestamp() 50 | ]}); 51 | } catch (e) { 52 | console.log(String(e.stack).bgRed) 53 | return message.reply({embeds: [new MessageEmbed() 54 | .setColor(ee.wrongcolor) 55 | .setFooter(ee.footertext, ee.footericon) 56 | .setTitle(`❌ ERROR | An error occurred`) 57 | .setDescription(`\`\`\`${e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000)}\`\`\``) 58 | ]}); 59 | } 60 | } 61 | } 62 | /** 63 | * @INFO 64 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/discord-js-lavalink-Music-Bot-erela-js 65 | * @INFO 66 | * Work for Milrato Development | https://milrato.eu 67 | * @INFO 68 | * Please mention Him / Milrato Development, when using this Code! 69 | * @INFO 70 | */ 71 | -------------------------------------------------------------------------------- /commands/Information/permissions.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const {MessageEmbed} = require("discord.js"); 3 | const config = require("../../botconfig/config.json"); 4 | var ee = require("../../botconfig/embed.json"); 5 | const { GetUser } = require("../../handlers/functions") 6 | const settings = require("../../botconfig/settings.json"); 7 | module.exports = { 8 | name: "permissions", //the command name for execution & for helpcmd [OPTIONAL] 9 | category: "Information", //the command category for helpcmd [OPTIONAL] 10 | aliases: ["perms"], //the command aliases for helpcmd [OPTIONAL] 11 | cooldown: 5, //the command cooldown for execution & for helpcmd [OPTIONAL] 12 | usage: "permissions [@USER]", //the command usage for helpcmd [OPTIONAL] 13 | description: "Shows the Permissions of a Member", //the command description for helpcmd [OPTIONAL] 14 | memberpermissions: [], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 15 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 16 | alloweduserids: [], //Only allow specific Users to execute a Command [OPTIONAL] 17 | minargs: 0, // minimum args for the message, 0 == none [OPTIONAL] 18 | maxargs: 0, // maximum args for the message, 0 == none [OPTIONAL] 19 | minplusargs: 0, // minimum args for the message, splitted with "++" , 0 == none [OPTIONAL] 20 | maxplusargs: 0, // maximum args for the message, splitted with "++" , 0 == none [OPTIONAL] 21 | argsmissing_message: "", //Message if the user has not enough args / not enough plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 22 | argstoomany_message: "", //Message if the user has too many / not enough args / too many plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 23 | run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { 24 | try { 25 | var user; 26 | if(args[0]){ 27 | try{ 28 | user = await GetUser(message, args) 29 | }catch (e){ 30 | if(!e) return message.reply("UNABLE TO FIND THE USER") 31 | return message.reply(e) 32 | } 33 | }else{ 34 | user = message.author; 35 | } 36 | if(!user || user == null || user.id == null || !user.id) message.reply("❌ Could not find the USER") 37 | try{ 38 | const member = message.guild.members.cache.get(user.id); 39 | //create the EMBED 40 | const embeduserinfo = new MessageEmbed() 41 | embeduserinfo.setThumbnail(member.user.displayAvatarURL({ dynamic: true, size: 512 })) 42 | embeduserinfo.setAuthor("Permissions from: " + member.user.username + "#" + member.user.discriminator, member.user.displayAvatarURL({ dynamic: true }), "https://clan.milrato.eu") 43 | embeduserinfo.addField('**❱ Permissions:**',`${message.member.permissions.toArray().map(p=>`\`${p}\``).join(", ")}`) 44 | embeduserinfo.setColor(ee.color) 45 | embeduserinfo.setFooter(ee.footertext, ee.footericon) 46 | //send the EMBED 47 | message.reply({embeds: [embeduserinfo]}) 48 | }catch (e){ 49 | console.log(e) 50 | //create the EMBED 51 | const embeduserinfo = new MessageEmbed() 52 | embeduserinfo.setThumbnail(user.displayAvatarURL({ dynamic: true, size: 512 })) 53 | embeduserinfo.setAuthor("Permissions from: " + user.username + "#" + user.discriminator, user.displayAvatarURL({ dynamic: true }), "https://clan.milrato.eu") 54 | embeduserinfo.addField('**❱ Permissions:**',`${message.member.permissions.toArray().map(p=>`\`${p}\``).join(", ")}`) 55 | embeduserinfo.setColor(ee.color) 56 | embeduserinfo.setFooter(ee.footertext, ee.footericon) 57 | //send the EMBED 58 | message.reply({embeds: [embeduserinfo]}) 59 | } 60 | 61 | } catch (e) { 62 | console.log(String(e.stack).bgRed) 63 | return message.reply({embeds: [new MessageEmbed() 64 | .setColor(ee.wrongcolor) 65 | .setFooter(ee.footertext, ee.footericon) 66 | .setTitle(`❌ ERROR | An error occurred`) 67 | .setDescription(`\`\`\`${e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000)}\`\`\``) 68 | ]}); 69 | } 70 | } 71 | } 72 | /** 73 | * @INFO 74 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/discord-js-lavalink-Music-Bot-erela-js 75 | * @INFO 76 | * Work for Milrato Development | https://milrato.eu 77 | * @INFO 78 | * Please mention Him / Milrato Development, when using this Code! 79 | * @INFO 80 | */ 81 | -------------------------------------------------------------------------------- /commands/Information/ping.js: -------------------------------------------------------------------------------- 1 | const { MessageEmbed } = require("discord.js"); 2 | const config = require("../../botconfig/config.json"); 3 | const ee = require("../../botconfig/embed.json"); 4 | const settings = require("../../botconfig/settings.json"); 5 | module.exports = { 6 | name: "ping", //the command name for execution & for helpcmd [OPTIONAL] 7 | category: "Information", //the command category for helpcmd [OPTIONAL] 8 | aliases: ["latency"], //the command aliases for helpcmd [OPTIONAL] 9 | cooldown: 5, //the command cooldown for execution & for helpcmd [OPTIONAL] 10 | usage: "ping", //the command usage for helpcmd [OPTIONAL] 11 | description: "Gives u information on how fast the Bot is", //the command description for helpcmd [OPTIONAL] 12 | memberpermissions: [], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 13 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 14 | alloweduserids: [], //Only allow specific Users to execute a Command [OPTIONAL] 15 | minargs: 0, // minimum args for the message, 0 == none [OPTIONAL] 16 | maxargs: 0, // maximum args for the message, 0 == none [OPTIONAL] 17 | minplusargs: 0, // minimum args for the message, splitted with "++" , 0 == none [OPTIONAL] 18 | maxplusargs: 0, // maximum args for the message, splitted with "++" , 0 == none [OPTIONAL] 19 | argsmissing_message: "", //Message if the user has not enough args / not enough plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 20 | argstoomany_message: "", //Message if the user has too many / not enough args / too many plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 21 | run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { 22 | try{ 23 | var date = Date.now() 24 | message.reply({ embeds: [new MessageEmbed() 25 | .setColor(ee.color) 26 | .setFooter(ee.footertext, ee.footericon) 27 | .setTitle(`🏓 Pinging....`) 28 | ]}).then(msg => { 29 | msg.edit({embeds: [new MessageEmbed() 30 | .setColor(ee.color) 31 | .setFooter(ee.footertext, ee.footericon) 32 | .setTitle(`🏓 Ping: \`${Math.round(Date.now() - date)}ms\`\n\n:robot: Api Latency: \`${Math.round(client.ws.ping)}ms\``) 33 | ]}); 34 | }) 35 | } catch (e) { 36 | console.log(String(e.stack).bgRed) 37 | return message.reply({embeds: [new MessageEmbed() 38 | .setColor(ee.wrongcolor) 39 | .setFooter(ee.footertext, ee.footericon) 40 | .setTitle(`❌ ERROR | An error occurred`) 41 | .setDescription(`\`\`\`${e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000)}\`\`\``) 42 | ]}); 43 | } 44 | } 45 | } 46 | /** 47 | * @INFO 48 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template 49 | * @INFO 50 | * Work for Milrato Development | https://milrato.eu 51 | * @INFO 52 | * Please mention Him / Milrato Development, when using this Code! 53 | * @INFO 54 | */ 55 | -------------------------------------------------------------------------------- /commands/Information/roleinfo.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const {MessageEmbed} = require("discord.js"); 3 | const config = require("../../botconfig/config.json"); 4 | var ee = require("../../botconfig/embed.json"); 5 | const moment = require('moment'); 6 | const { GetRole } = require("../../handlers/functions") 7 | const settings = require("../../botconfig/settings.json"); 8 | module.exports = { 9 | name: "roleinfo", //the command name for execution & for helpcmd [OPTIONAL] 10 | category: "Information", //the command category for helpcmd [OPTIONAL] 11 | aliases: ["rinfo"], //the command aliases for helpcmd [OPTIONAL] 12 | cooldown: 5, //the command cooldown for execution & for helpcmd [OPTIONAL] 13 | usage: "roleinfo <@ROLE>", //the command usage for helpcmd [OPTIONAL] 14 | description: "Shows Information about a role", //the command description for helpcmd [OPTIONAL] 15 | memberpermissions: [], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 16 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 17 | alloweduserids: [], //Only allow specific Users to execute a Command [OPTIONAL] 18 | minargs: 1, // minimum args for the message, 0 == none [OPTIONAL] 19 | maxargs: 0, // maximum args for the message, 0 == none [OPTIONAL] 20 | minplusargs: 0, // minimum args for the message, splitted with "++" , 0 == none [OPTIONAL] 21 | maxplusargs: 0, // maximum args for the message, splitted with "++" , 0 == none [OPTIONAL] 22 | argsmissing_message: "", //Message if the user has not enough args / not enough plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 23 | argstoomany_message: "", //Message if the user has too many / not enough args / too many plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 24 | run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { 25 | try { 26 | var role; 27 | if(args[0]){ 28 | try{ 29 | role = await GetRole(message, args) 30 | }catch (e){ 31 | if(!e) return message.reply("UNABLE TO FIND THE ROLE") 32 | return message.reply(e) 33 | } 34 | }else{ 35 | return message.reply("❌ Please retry but add a Role/Rolename/Roleid"); 36 | } 37 | if(!role || role == null || role.id == null || !role.id) message.reply("❌ Could not find the ROLE") 38 | //create the EMBED 39 | const embeduserinfo = new MessageEmbed() 40 | embeduserinfo.setThumbnail(message.guild.iconURL({ dynamic: true, size: 512 })) 41 | embeduserinfo.setAuthor("Information about: " + role.name, message.guild.iconURL({ dynamic: true }), "https://discord.gg/FQGXbypRf8") 42 | embeduserinfo.addField('**❱ Name:**',`\`${role.name}\``,true) 43 | embeduserinfo.addField('**❱ ID:**',`\`${role.id}\``,true) 44 | embeduserinfo.addField('**❱ Color:**',`\`${role.hexColor}\``,true) 45 | embeduserinfo.addField('**❱ Date Created:**', "\`"+moment(role.createdAt).format("DD/MM/YYYY") + "\`\n" + "`"+ moment(role.createdAt).format("hh:mm:ss") + "\`",true) 46 | embeduserinfo.addField('**❱ Position:**',`\`${role.rawPosition}\``,true) 47 | embeduserinfo.addField('**❱ MemberCount:**',`\`${role.members.size} Members have it\``,true) 48 | embeduserinfo.addField('**❱ Hoisted:**',`\`${role.hoist ? "✔️" : "❌"}\``,true) 49 | embeduserinfo.addField('**❱ Mentionable:**',`\`${role.mentionable ? "✔️" : "❌"}\``,true) 50 | embeduserinfo.addField('**❱ Permissions:**',`${role.permissions.toArray().map(p=>`\`${p}\``).join(", ")}`) 51 | embeduserinfo.setColor(role.hexColor) 52 | embeduserinfo.setFooter(ee.footertext, ee.footericon) 53 | //send the EMBED 54 | message.reply({embeds: [embeduserinfo]}) 55 | } catch (e) { 56 | console.log(String(e.stack).bgRed) 57 | return message.reply({embeds: [new MessageEmbed() 58 | .setColor(ee.wrongcolor) 59 | .setFooter(ee.footertext, ee.footericon) 60 | .setTitle(`❌ ERROR | An error occurred`) 61 | .setDescription(`\`\`\`${e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000)}\`\`\``) 62 | ]}); 63 | } 64 | } 65 | } 66 | /** 67 | * @INFO 68 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/discord-js-lavalink-Music-Bot-erela-js 69 | * @INFO 70 | * Work for Milrato Development | https://milrato.eu 71 | * @INFO 72 | * Please mention Him / Milrato Development, when using this Code! 73 | * @INFO 74 | */ 75 | -------------------------------------------------------------------------------- /commands/Information/serveravatar.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const {MessageEmbed} = require("discord.js"); 3 | const config = require("../../botconfig/config.json") 4 | var ee = require("../../botconfig/embed.json") 5 | const settings = require("../../botconfig/settings.json"); 6 | module.exports = { 7 | name: "serveravatar", //the command name for execution & for helpcmd [OPTIONAL] 8 | category: "Information", //the command category for helpcmd [OPTIONAL] 9 | aliases: ["savatar"], //the command aliases for helpcmd [OPTIONAL] 10 | cooldown: 5, //the command cooldown for execution & for helpcmd [OPTIONAL] 11 | usage: "serveravatar", //the command usage for helpcmd [OPTIONAL] 12 | description: "Shows the Server Avatar", //the command description for helpcmd [OPTIONAL] 13 | memberpermissions: [], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 14 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 15 | alloweduserids: [], //Only allow specific Users to execute a Command [OPTIONAL] 16 | minargs: 0, // minimum args for the message, 0 == none [OPTIONAL] 17 | maxargs: 0, // maximum args for the message, 0 == none [OPTIONAL] 18 | minplusargs: 0, // minimum args for the message, splitted with "++" , 0 == none [OPTIONAL] 19 | maxplusargs: 0, // maximum args for the message, splitted with "++" , 0 == none [OPTIONAL] 20 | argsmissing_message: "", //Message if the user has not enough args / not enough plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 21 | argstoomany_message: "", //Message if the user has too many / not enough args / too many plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 22 | run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { 23 | try { 24 | message.reply({embeds: [new Discord.MessageEmbed() 25 | .setAuthor(`Avatar from: ${message.guild.name}`, message.guild.iconURL({dynamic: true}), "https://discord.gg/FQGXbypRf8") 26 | .setColor(ee.color) 27 | .addField("❱ PNG",`[\`LINK\`](${message.guild.iconURL({format: "png"})})`, true) 28 | .addField("❱ JPEG",`[\`LINK\`](${message.guild.iconURL({format: "jpg"})})`, true) 29 | .addField("❱ WEBP",`[\`LINK\`](${message.guild.iconURL({format: "webp"})})`, true) 30 | .setURL(message.guild.iconURL({ 31 | dynamic: true 32 | })) 33 | .setFooter(ee.footertext, ee.footericon) 34 | .setImage(message.guild.iconURL({ 35 | dynamic: true, size: 256, 36 | })) 37 | ]}); 38 | } catch (e) { 39 | console.log(String(e.stack).bgRed) 40 | return message.reply({embeds: [new MessageEmbed() 41 | .setColor(ee.wrongcolor) 42 | .setFooter(ee.footertext, ee.footericon) 43 | .setTitle(`❌ ERROR | An error occurred`) 44 | .setDescription(`\`\`\`${e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000)}\`\`\``) 45 | ]}); 46 | } 47 | } 48 | } 49 | /** 50 | * @INFO 51 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/discord-js-lavalink-Music-Bot-erela-js 52 | * @INFO 53 | * Work for Milrato Development | https://milrato.eu 54 | * @INFO 55 | * Please mention Him / Milrato Development, when using this Code! 56 | * @INFO 57 | */ 58 | -------------------------------------------------------------------------------- /commands/Information/serverinfo.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const {MessageEmbed} = require("discord.js"); 3 | const config = require("../../botconfig/config.json") 4 | var ee = require("../../botconfig/embed.json") 5 | const moment = require("moment") 6 | const settings = require("../../botconfig/settings.json"); 7 | module.exports = { 8 | name: "serverinfo", //the command name for execution & for helpcmd [OPTIONAL] 9 | category: "Information", //the command category for helpcmd [OPTIONAL] 10 | aliases: ["sinfo"], //the command aliases for helpcmd [OPTIONAL] 11 | cooldown: 5, //the command cooldown for execution & for helpcmd [OPTIONAL] 12 | usage: "serverinfo", //the command usage for helpcmd [OPTIONAL] 13 | description: "Shows Information about the Server", //the command description for helpcmd [OPTIONAL] 14 | memberpermissions: [], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 15 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 16 | alloweduserids: [], //Only allow specific Users to execute a Command [OPTIONAL] 17 | minargs: 0, // minimum args for the message, 0 == none [OPTIONAL] 18 | maxargs: 0, // maximum args for the message, 0 == none [OPTIONAL] 19 | minplusargs: 0, // minimum args for the message, splitted with "++" , 0 == none [OPTIONAL] 20 | maxplusargs: 0, // maximum args for the message, splitted with "++" , 0 == none [OPTIONAL] 21 | argsmissing_message: "", //Message if the user has not enough args / not enough plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 22 | argstoomany_message: "", //Message if the user has too many / not enough args / too many plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 23 | run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { 24 | try { 25 | function trimArray(arr, maxLen = 25) { 26 | if (arr.array().length > maxLen) { 27 | const len = arr.array().length - maxLen; 28 | arr = arr.array().sort((a, b) => b.rawPosition - a.rawPosition).slice(0, maxLen); 29 | arr.map(role => `<@&${role.id}>`) 30 | arr.push(`${len} more...`); 31 | } 32 | return arr.join(", "); 33 | } 34 | await message.guild.members.fetch(); 35 | function emojitrimarray(arr, maxLen = 20) { 36 | if (arr.length > maxLen) { 37 | const len = arr.length - maxLen; 38 | arr = arr.slice(0, maxLen); 39 | arr.push(`${len} more...`); 40 | } 41 | return arr.join(", "); 42 | } 43 | let boosts = message.guild.premiumSubscriptionCount; 44 | var boostlevel = 0; 45 | if (boosts >= 2) boostlevel = "1"; 46 | if (boosts >= 15) boostlevel = "2"; 47 | if (boosts >= 30) boostlevel = "3 / ∞"; 48 | let maxbitrate = 96000; 49 | if (boosts >= 2) maxbitrate = 128000; 50 | if (boosts >= 15) maxbitrate = 256000; 51 | if (boosts >= 30) maxbitrate = 384000; 52 | message.reply({embeds: [new Discord.MessageEmbed() 53 | .setAuthor("Server Information About: " + message.guild.name, message.guild.iconURL({ 54 | dynamic: true 55 | }), "https://clan.milrato.eu") 56 | .setColor(ee.color) 57 | .addField("❱ Owner", `${message.guild.owner.user}\n\`${message.guild.owner.user.tag}\``, true) 58 | .addField("❱ Created On", "\`" + moment(message.guild.createdTimestamp).format("DD/MM/YYYY") + "\`\n" + "`"+ moment(message.guild.createdTimestamp).format("hh:mm:ss") +"`", true) 59 | .addField("❱ You Joined", "\`" + moment(message.member.joinedTimestamp).format("DD/MM/YYYY") + "\`\n" + "`"+ moment(message.member.joinedTimestamp).format("hh:mm:ss") +"`", true) 60 | 61 | .addField("❱ All Channels", "👁‍🗨 \`" + message.guild.channels.cache.size + "\`", true) 62 | .addField("❱ Text Channels", "💬 \`" + message.guild.channels.cache.filter(channel => channel.type == "text").size + "\`", true) 63 | .addField("❱ Voice Channels", "🔈 \`" + message.guild.channels.cache.filter(channel => channel.type == "voice").size + "\`", true) 64 | 65 | .addField("❱ Total USERS", "😀 \`" + message.guild.memberCount + "\`", true) 66 | .addField("❱ Total HUMANS", "👤 \`" + message.guild.members.cache.filter(member => !member.user.bot).size + "\`", true) 67 | .addField("❱ Total BOTS", "🤖 \`" + message.guild.members.cache.filter(member => member.user.bot).size + "\`", true) 68 | 69 | .addField("❱ ONLINE", "🟢 \`" + message.guild.members.cache.filter(member => member.presence.status != "offline").size + "\`", true) 70 | .addField("❱ OFFLINE", ":black_circle:\`" + message.guild.members.cache.filter(member => member.presence.status == "offline").size + "\`", true) 71 | 72 | .addField("❱ Total Boosts", "\`" + message.guild.premiumSubscriptionCount + "\`", true) 73 | .addField("❱ Boost-Level", "\`" + boostlevel + "\`", true) 74 | .addField("❱ Max-Talk-Bitrate", "👾 \`" + maxbitrate + " kbps\`", true) 75 | 76 | .addField(`❱ [${message.guild.emojis.cache.size}] Emojis: `, "> "+message.guild.emojis.cache.size < 20 ? message.guild.emojis.cache.map(emoji => `${emoji}`).join(", ") : message.guild.emojis.cache.size > 20 ? emojitrimarray(message.guild.emojis.cache.map(emoji => `${emoji}`)).substr(0, 1024) : 'No Emojis') 77 | .addField(`❱ [${message.guild.roles.cache.size}] Roles: `, "> "+message.guild.roles.cache.size < 25 ? message.guild.roles.cache.array().sort((a, b) => b.rawPosition - a.rawPosition).map(role => `<@&${role.id}>`).join(', ') : message.guild.roles.cache.size > 25 ? trimArray(message.guild.roles.cache) : 'None') 78 | .setThumbnail(message.guild.iconURL({ 79 | dynamic: true 80 | })) 81 | .setFooter("ID: " + message.guild.id, message.guild.iconURL({ 82 | dynamic: true 83 | }))]}); 84 | 85 | } catch (e) { 86 | console.log(String(e.stack).bgRed) 87 | return message.reply({embeds: [new MessageEmbed() 88 | .setColor(ee.wrongcolor) 89 | .setFooter(ee.footertext, ee.footericon) 90 | .setTitle(`❌ ERROR | An error occurred`) 91 | .setDescription(`\`\`\`${e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000)}\`\`\``) 92 | ]}); 93 | } 94 | } 95 | } 96 | /** 97 | * @INFO 98 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/discord-js-lavalink-Music-Bot-erela-js 99 | * @INFO 100 | * Work for Milrato Development | https://milrato.eu 101 | * @INFO 102 | * Please mention Him / Milrato Development, when using this Code! 103 | * @INFO 104 | */ 105 | -------------------------------------------------------------------------------- /commands/Information/support.js: -------------------------------------------------------------------------------- 1 | const { 2 | MessageEmbed 3 | } = require("discord.js"); 4 | const config = require("../../botconfig/config.json"); 5 | var ee = require("../../botconfig/embed.json"); 6 | const settings = require("../../botconfig/settings.json"); 7 | module.exports = { 8 | name: "support", //the command name for execution & for helpcmd [OPTIONAL] 9 | category: "Information", //the command category for helpcmd [OPTIONAL] 10 | aliases: ["server"], //the command aliases for helpcmd [OPTIONAL] 11 | cooldown: 5, //the command cooldown for execution & for helpcmd [OPTIONAL] 12 | usage: "support", //the command usage for helpcmd [OPTIONAL] 13 | description: "Sends a Link of the Support Server", //the command description for helpcmd [OPTIONAL] 14 | memberpermissions: [], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 15 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 16 | alloweduserids: [], //Only allow specific Users to execute a Command [OPTIONAL] 17 | minargs: 0, // minimum args for the message, 0 == none [OPTIONAL] 18 | maxargs: 0, // maximum args for the message, 0 == none [OPTIONAL] 19 | minplusargs: 0, // minimum args for the message, splitted with "++" , 0 == none [OPTIONAL] 20 | maxplusargs: 0, // maximum args for the message, splitted with "++" , 0 == none [OPTIONAL] 21 | argsmissing_message: "", //Message if the user has not enough args / not enough plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 22 | argstoomany_message: "", //Message if the user has too many / not enough args / too many plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 23 | run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { 24 | try { 25 | message.reply("https://discord.com/invite/FQGXbypRf8"); 26 | } catch (e) { 27 | console.log(String(e.stack).bgRed) 28 | return message.reply({embeds: [new MessageEmbed() 29 | .setColor(ee.wrongcolor) 30 | .setFooter(ee.footertext, ee.footericon) 31 | .setTitle(`❌ ERROR | An error occurred`) 32 | .setDescription(`\`\`\`${e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000)}\`\`\``) 33 | ]}); 34 | } 35 | } 36 | } 37 | /** 38 | * @INFO 39 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/discord-js-lavalink-Music-Bot-erela-js 40 | * @INFO 41 | * Work for Milrato Development | https://milrato.eu 42 | * @INFO 43 | * Please mention Him / Milrato Development, when using this Code! 44 | * @INFO 45 | */ 46 | -------------------------------------------------------------------------------- /commands/Information/uptime.js: -------------------------------------------------------------------------------- 1 | const { MessageEmbed } = require("discord.js"); 2 | const config = require("../../botconfig/config.json"); 3 | const ee = require("../../botconfig/embed.json"); 4 | const { duration } = require("../../handlers/functions") 5 | const settings = require("../../botconfig/settings.json"); 6 | module.exports = { 7 | name: "uptime", //the command name for execution & for helpcmd [OPTIONAL] 8 | category: "Information", //the command category for helpcmd [OPTIONAL] 9 | aliases: [], //the command aliases for helpcmd [OPTIONAL] 10 | cooldown: 5, //the command cooldown for execution & for helpcmd [OPTIONAL] 11 | usage: "uptime", //the command usage for helpcmd [OPTIONAL] 12 | description: "Returns the duration on how long the Bot is online", //the command description for helpcmd [OPTIONAL] 13 | memberpermissions: [], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 14 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 15 | alloweduserids: [], //Only allow specific Users to execute a Command [OPTIONAL] 16 | minargs: 0, // minimum args for the message, 0 == none [OPTIONAL] 17 | maxargs: 0, // maximum args for the message, 0 == none [OPTIONAL] 18 | minplusargs: 0, // minimum args for the message, splitted with "++" , 0 == none [OPTIONAL] 19 | maxplusargs: 0, // maximum args for the message, splitted with "++" , 0 == none [OPTIONAL] 20 | argsmissing_message: "", //Message if the user has not enough args / not enough plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 21 | argstoomany_message: "", //Message if the user has too many / not enough args / too many plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 22 | run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { 23 | try{ 24 | message.reply({embeds: [new MessageEmbed() 25 | .setColor(ee.color) 26 | .setFooter(ee.footertext, ee.footericon) 27 | .setTitle(`:white_check_mark: **${client.user.username}** is since:\n ${duration(client.uptime)} online`)] 28 | }); 29 | } catch (e) { 30 | console.log(String(e.stack).bgRed) 31 | return message.reply({embeds: [new MessageEmbed() 32 | .setColor(ee.wrongcolor) 33 | .setFooter(ee.footertext, ee.footericon) 34 | .setTitle(`❌ ERROR | An error occurred`) 35 | .setDescription(`\`\`\`${e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000)}\`\`\``) 36 | ]}); 37 | } 38 | } 39 | } 40 | /** 41 | * @INFO 42 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template 43 | * @INFO 44 | * Work for Milrato Development | https://milrato.eu 45 | * @INFO 46 | * Please mention Him / Milrato Development, when using this Code! 47 | * @INFO 48 | */ 49 | -------------------------------------------------------------------------------- /commands/Information/userinfo.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const {MessageEmbed} = require("discord.js"); 3 | const config = require("../../botconfig/config.json"); 4 | var ee = require("../../botconfig/embed.json"); 5 | const moment = require('moment'); 6 | const { GetUser, GetGlobalUser } = require("../../handlers/functions") 7 | const flags = { 8 | DISCORD_EMPLOYEE: 'Discord Employee', 9 | DISCORD_PARTNER: 'Discord Partner', 10 | BUGHUNTER_LEVEL_1: 'Bug Hunter (Level 1)', 11 | BUGHUNTER_LEVEL_2: 'Bug Hunter (Level 2)', 12 | HYPESQUAD_EVENTS: 'HypeSquad Events', 13 | HOUSE_BRAVERY: 'House of Bravery', 14 | HOUSE_BRILLIANCE: 'House of Brilliance', 15 | HOUSE_BALANCE: 'House of Balance', 16 | EARLY_SUPPORTER: 'Early Supporter', 17 | TEAM_USER: 'Team User', 18 | SYSTEM: 'System', 19 | VERIFIED_BOT: 'Verified Bot', 20 | VERIFIED_DEVELOPER: 'Verified Bot Developer' 21 | }; 22 | function trimArray(arr, maxLen = 25) { 23 | if (Array.from(arr.values()).length > maxLen) { 24 | const len = Array.from(arr.values()).length - maxLen; 25 | arr = Array.from(arr.values()).sort((a, b) => b.rawPosition - a.rawPosition).slice(0, maxLen); 26 | arr.map(role => `<@&${role.id}>`) 27 | arr.push(`${len} more...`); 28 | } 29 | return arr.join(", "); 30 | } 31 | const statuses = { 32 | "online" : "🟢", 33 | "idle" : "🟠", 34 | "dnd" : "🔴", 35 | "offline" : "⚫️", 36 | } 37 | module.exports = { 38 | name: "userinfo", //the command name for execution & for helpcmd [OPTIONAL] 39 | category: "Information", //the command category for helpcmd [OPTIONAL] 40 | aliases: ["uinfo", "whoami"], //the command aliases for helpcmd [OPTIONAL] 41 | cooldown: 5, //the command cooldown for execution & for helpcmd [OPTIONAL] 42 | usage: "userinfo [@USER] [global]", //the command usage for helpcmd [OPTIONAL] 43 | description: "Shows Information of a User", //the command description for helpcmd [OPTIONAL] 44 | memberpermissions: [], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 45 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 46 | alloweduserids: [], //Only allow specific Users to execute a Command [OPTIONAL] 47 | minargs: 0, // minimum args for the message, 0 == none [OPTIONAL] 48 | maxargs: 0, // maximum args for the message, 0 == none [OPTIONAL] 49 | minplusargs: 0, // minimum args for the message, splitted with "++" , 0 == none [OPTIONAL] 50 | maxplusargs: 0, // maximum args for the message, splitted with "++" , 0 == none [OPTIONAL] 51 | argsmissing_message: "", //Message if the user has not enough args / not enough plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 52 | argstoomany_message: "", //Message if the user has too many / not enough args / too many plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 53 | run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { 54 | try { 55 | var user; 56 | if(args[0]){ 57 | try{ 58 | if(args[1] && args[1].toLowerCase() == "global"){ 59 | args.pop() 60 | user = await GetGlobalUser(message, args) 61 | }else { 62 | user = await GetUser(message, args) 63 | } 64 | }catch (e){ 65 | if(!e) return message.reply("UNABLE TO FIND THE USER") 66 | return message.reply(e) 67 | } 68 | }else{ 69 | user = message.author; 70 | } 71 | if(!user || user == null || user.id == null || !user.id) return message.reply("❌ Could not find the USER") 72 | try{ 73 | const member = message.guild.members.cache.get(user.id); 74 | const roles = member.roles; 75 | const userFlags = member.user.flags.toArray(); 76 | const activity = member.user.presence.activities[0]; 77 | //create the EMBED 78 | const embeduserinfo = new MessageEmbed() 79 | embeduserinfo.setThumbnail(member.user.displayAvatarURL({ dynamic: true, size: 512 })) 80 | embeduserinfo.setAuthor("Information about: " + member.user.username + "#" + member.user.discriminator, member.user.displayAvatarURL({ dynamic: true }), "https://discord.gg/FQGXbypRf8") 81 | embeduserinfo.addField('**❱ Username:**',`<@${member.user.id}>\n\`${member.user.tag}\``,true) 82 | embeduserinfo.addField('**❱ ID:**',`\`${member.id}\``,true) 83 | embeduserinfo.addField('**❱ Avatar:**',`[\`Link to avatar\`](${member.user.displayAvatarURL({ format: "png" })})`,true) 84 | embeduserinfo.addField('**❱ Date Join DC:**', "\`"+moment(member.user.createdTimestamp).format("DD/MM/YYYY") + "\`\n" + "`"+ moment(member.user.createdTimestamp).format("hh:mm:ss") + "\`",true) 85 | embeduserinfo.addField('**❱ Date Join Guild:**', "\`"+moment(member.joinedTimestamp).format("DD/MM/YYYY") + "\`\n" + "`"+ moment(member.joinedTimestamp).format("hh:mm:ss")+ "\`",true) 86 | embeduserinfo.addField('**❱ Flags:**',`\`${userFlags.length ? userFlags.map(flag => flags[flag]).join(', ') : 'None'}\``,true) 87 | embeduserinfo.addField('**❱ Status:**',`\`${statuses[member.user.presence.status]} ${member.user.presence.status}\``,true) 88 | embeduserinfo.addField('**❱ Highest Role:**',`${member.roles.highest.id === message.guild.id ? 'None' : member.roles.highest}`,true) 89 | embeduserinfo.addField('**❱ Is a Bot:**',`\`${member.user.bot ? "✔️" : "❌"}\``,true) 90 | var userstatus = "Not having an activity"; 91 | if(activity){ 92 | if(activity.type === "CUSTOM_STATUS"){ 93 | let emoji = `${activity.emoji ? activity.emoji.id ? `<${activity.emoji.animated ? "a": ""}:${activity.emoji.name}:${activity.emoji.id}>`: activity.emoji.name : ""}` 94 | userstatus = `${emoji} \`${activity.state || 'Not having an acitivty.'}\`` 95 | } 96 | else{ 97 | userstatus = `\`${activity.type.toLowerCase().charAt(0).toUpperCase() + activity.type.toLowerCase().slice(1)} ${activity.name}\`` 98 | } 99 | } 100 | embeduserinfo.addField('**❱ Activity:**',`${userstatus}`) 101 | embeduserinfo.addField('**❱ Permissions:**',`${member.permissions.toArray().map(p=>`\`${p}\``).join(", ")}`) 102 | embeduserinfo.addField(`❱ [${roles.cache.size}] Roles: `, roles.cache.size < 25 ? Array.from(roles.cache.values()).sort((a, b) => b.rawPosition - a.rawPosition).map(role => `<@&${role.id}>`).join(', ') : roles.cache.size > 25 ? trimArray(roles.cache) : 'None') 103 | embeduserinfo.setColor(ee.color) 104 | embeduserinfo.setFooter(ee.footertext, ee.footericon) 105 | //send the EMBED 106 | message.reply({embeds: [embeduserinfo]}) 107 | }catch (e){ 108 | console.log(e) 109 | const userFlags = user.flags.toArray(); 110 | const activity = user.presence.activities[0]; 111 | //create the EMBED 112 | const embeduserinfo = new MessageEmbed() 113 | embeduserinfo.setThumbnail(user.displayAvatarURL({ dynamic: true, size: 512 })) 114 | embeduserinfo.setAuthor("Information about: " + user.username + "#" + user.discriminator, user.displayAvatarURL({ dynamic: true }), "https://discord.gg/FQGXbypRf8") 115 | embeduserinfo.addField('**❱ Username:**',`<@${user.id}>\n\`${user.tag}\``,true) 116 | embeduserinfo.addField('**❱ ID:**',`\`${user.id}\``,true) 117 | embeduserinfo.addField('**❱ Avatar:**',`[\`Link to avatar\`](${user.displayAvatarURL({ format: "png" })})`,true) 118 | embeduserinfo.addField('**❱ Flags:**',`\`${userFlags.length ? userFlags.map(flag => flags[flag]).join(', ') : 'None'}\``,true) 119 | embeduserinfo.addField('**❱ Status:**',`\`${statuses[user.presence.status]} ${user.presence.status}\``,true) 120 | embeduserinfo.addField('**❱ Is a Bot:**',`\`${user.bot ? "✔️" : "❌"}\``,true) 121 | var userstatus = "Not having an activity"; 122 | if(activity){ 123 | if(activity.type === "CUSTOM_STATUS"){ 124 | let emoji = `${activity.emoji ? activity.emoji.id ? `<${activity.emoji.animated ? "a": ""}:${activity.emoji.name}:${activity.emoji.id}>`: activity.emoji.name : ""}` 125 | userstatus = `${emoji} \`${activity.state || 'Not having an acitivty.'}\`` 126 | } 127 | else{ 128 | userstatus = `\`${activity.type.toLowerCase().charAt(0).toUpperCase() + activity.type.toLowerCase().slice(1)} ${activity.name}\`` 129 | } 130 | } 131 | embeduserinfo.addField('**❱ Activity:**',`${userstatus}`) 132 | embeduserinfo.addField('**❱ Permissions:**',`${member.permissions.toArray().map(p=>`\`${p}\``).join(", ")}`) 133 | embeduserinfo.setColor(ee.color) 134 | embeduserinfo.setFooter(ee.footertext, ee.footericon) 135 | //send the EMBED 136 | message.reply({embeds: [embeduserinfo]}) 137 | } 138 | 139 | } catch (e) { 140 | console.log(String(e.stack).bgRed) 141 | return message.reply({embeds: [new MessageEmbed() 142 | .setColor(ee.wrongcolor) 143 | .setFooter(ee.footertext, ee.footericon) 144 | .setTitle(`❌ ERROR | An error occurred`) 145 | .setDescription(`\`\`\`${e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000)}\`\`\``) 146 | ]}); 147 | } 148 | } 149 | } 150 | /** 151 | * @INFO 152 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/discord-js-lavalink-Music-Bot-erela-js 153 | * @INFO 154 | * Work for Milrato Development | https://milrato.eu 155 | * @INFO 156 | * Please mention Him / Milrato Development, when using this Code! 157 | * @INFO 158 | */ 159 | -------------------------------------------------------------------------------- /commands/Owner/changeavatar.js: -------------------------------------------------------------------------------- 1 | var { 2 | MessageEmbed 3 | } = require(`discord.js`); 4 | var Discord = require(`discord.js`); 5 | var config = require(`../../botconfig/config.json`); 6 | var settings = require(`../../botconfig/settings.json`); 7 | var ee = require(`../../botconfig/embed.json`); 8 | const fs = require('fs'); 9 | const fetch = require('node-fetch'); 10 | module.exports = { 11 | name: "changeavatar", 12 | category: "Owner", 13 | aliases: ["changebotavatar", "botavatar", "botprofilepicture", "botpfp"], 14 | cooldown: 5, 15 | usage: "changeavatar <Imagelink/Image>", 16 | description: "Changes the Avatar of the BOT: I SUGGEST YOU TO DO IT LIKE THAT: Type the command in the Chat, attach an Image to the Command (not via link, just add it) press enter", 17 | memberpermissions: [], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 18 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 19 | alloweduserids: settings.ownerIDS, //Only allow specific Users to execute a Command [OPTIONAL] 20 | minargs: 0, // minimum args for the message, 0 == none [OPTIONAL] 21 | maxargs: 0, // maximum args for the message, 0 == none [OPTIONAL] 22 | minplusargs: 0, // minimum args for the message, splitted with "++" , 0 == none [OPTIONAL] 23 | maxplusargs: 0, // maximum args for the message, splitted with "++" , 0 == none [OPTIONAL] 24 | argsmissing_message: "", //Message if the user has not enough args / not enough plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 25 | argstoomany_message: "", //Message if the user has too many / not enough args / too many plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 26 | run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { 27 | try { 28 | //define a global var 29 | var url; 30 | //if there is an attachment 31 | if (message.attachments.size > 0) { 32 | //loop through all attachments 33 | if (message.attachments.every(attachIsImage)) { 34 | //get a response from the fetcher 35 | const response = await fetch(url); 36 | //create a buffer from it 37 | const buffer = await response.buffer(); 38 | //write the file and log the state 39 | await fs.writeFile(`./image.jpg`, buffer, () =>{ 40 | console.log('finished downloading!') 41 | }); 42 | //set the avatar from the file 43 | client.user.setAvatar(`./image.jpg`) 44 | .then(user => { 45 | try { 46 | //try to delete it if possible 47 | fs.unlinkSync("./image.jpg") 48 | } catch {} 49 | //send a success message 50 | return message.reply({embeds: [new MessageEmbed() 51 | .setTitle(`Successfully, changed the Bot avatar!`) 52 | .setColor(ee.color) 53 | .setFooter(ee.footertext, ee.footericon) 54 | ]}); 55 | }) 56 | .catch(e => { 57 | //send an error message 58 | return message.reply({embeds: [new MessageEmbed() 59 | .setColor(ee.wrongcolor) 60 | .setFooter(ee.footertext, ee.footericon) 61 | .setTitle(`:x: Something went Wrong`) 62 | .setDescription(`\`\`\`${String(JSON.stringify(e)).substr(0, 2000)}\`\`\``) 63 | ]}); 64 | }); 65 | } else { 66 | return message.reply({embeds: [new MessageEmbed() 67 | .setTitle(`:x: ERROR | Could not use your Image as an Avatar, make sure it is a \`png\` / \`jpg\``) 68 | .setColor(ee.wrongcolor) 69 | .setFooter(ee.footertext, ee.footericon) 70 | ]}); 71 | } 72 | } else if (message.content && textIsImage(message.content)) { 73 | url = args.join(" ") 74 | const response = await fetch(url); 75 | const buffer = await response.buffer(); 76 | await fs.writeFile(`./image.jpg`, buffer, () => 77 | console.log('finished downloading!')); 78 | client.user.setAvatar(`./image.jpg`) 79 | .then(user => { 80 | try { 81 | fs.unlinkSync("./image.jpg") 82 | } catch { 83 | 84 | } 85 | return message.reply({embeds: [new MessageEmbed() 86 | .setTitle(`Successfully, changed the Bot avatar!`) 87 | .setColor(ee.color) 88 | .setFooter(ee.footertext, ee.footericon) 89 | ]}); 90 | }) 91 | .catch(e => { 92 | return message.reply({embeds: [new MessageEmbed() 93 | .setColor(ee.wrongcolor) 94 | .setFooter(ee.footertext, ee.footericon) 95 | .setTitle(`:x: Something went Wrong`) 96 | .setDescription(`\`\`\`${String(JSON.stringify(e)).substr(0, 2000)}\`\`\``) 97 | ]}); 98 | }); 99 | 100 | } else { 101 | return message.reply({embeds: [new MessageEmbed() 102 | .setTitle(`:x: ERROR | Could not use your Image as an Avatar, make sure it is a \`png\` / \`jpg\` / \`webp\``) 103 | .setDescription(`Useage: \`${prefix}changeavatar <AVATARLINK/IMAGE>\``) 104 | .setColor(ee.wrongcolor) 105 | .setFooter(ee.footertext, ee.footericon) 106 | ]}); 107 | } 108 | 109 | function attachIsImage(msgAttach) { 110 | url = msgAttach.url; 111 | 112 | //True if this url is a png image. 113 | return url.indexOf("png", url.length - "png".length /*or 3*/ ) !== -1 || 114 | url.indexOf("jpeg", url.length - "jpeg".length /*or 3*/ ) !== -1 || 115 | url.indexOf("jpg", url.length - "jpg".length /*or 3*/ ) !== -1; 116 | } 117 | 118 | function textIsImage(url) { 119 | return (url.match(/\.(jpeg|jpg|gif|png)$/) != null); 120 | } 121 | 122 | 123 | } catch (e) { 124 | console.log(String(e.stack).bgRed) 125 | return message.reply({embeds: [new MessageEmbed() 126 | .setColor(ee.wrongcolor) 127 | .setFooter(ee.footertext, ee.footericon) 128 | .setTitle(`❌ ERROR | An error occurred`) 129 | .setDescription(`\`\`\`${e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000)}\`\`\``) 130 | ]}); 131 | } 132 | }, 133 | }; 134 | /** 135 | * @INFO 136 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/discord-js-lavalink-Music-Bot-erela-js 137 | * @INFO 138 | * Work for Milrato Development | https://milrato.eu 139 | * @INFO 140 | * Please mention Him / Milrato Development, when using this Code! 141 | * @INFO 142 | */ 143 | -------------------------------------------------------------------------------- /commands/Owner/changename.js: -------------------------------------------------------------------------------- 1 | var { 2 | MessageEmbed 3 | } = require(`discord.js`); 4 | var Discord = require(`discord.js`); 5 | var config = require(`../../botconfig/config.json`); 6 | var settings = require(`../../botconfig/settings.json`); 7 | var ee = require(`../../botconfig/embed.json`); 8 | module.exports = { 9 | name: "changename", 10 | category: "Owner", 11 | aliases: ["changebotname", "botname"], 12 | cooldown: 5, 13 | usage: "changename <NEW BOT NAME>", 14 | description: "Changes the Name of the BOT", 15 | memberpermissions: [], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 16 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 17 | alloweduserids: settings.ownerIDS, //Only allow specific Users to execute a Command [OPTIONAL] 18 | minargs: 1, // minimum args for the message, 0 == none [OPTIONAL] 19 | maxargs: 0, // maximum args for the message, 0 == none [OPTIONAL] 20 | minplusargs: 0, // minimum args for the message, splitted with "++" , 0 == none [OPTIONAL] 21 | maxplusargs: 0, // maximum args for the message, splitted with "++" , 0 == none [OPTIONAL] 22 | argsmissing_message: "", //Message if the user has not enough args / not enough plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 23 | argstoomany_message: "", //Message if the user has too many / not enough args / too many plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 24 | run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { 25 | try { 26 | //if args too long send error 27 | if (args.join(" ").length > 32){ 28 | return message.reply({embeds: [new MessageEmbed() 29 | .setColor(ee.wrongcolor) 30 | .setFooter(ee.footertext, ee.footericon) 31 | .setTitle(`:x: Bot Name too long, can't have more then 32 Letters!`) 32 | ]}); 33 | } 34 | //set a user 35 | client.user.setUsername(args.join(" ")) 36 | .then(user => { 37 | //send success message 38 | return message.reply({embeds: [new MessageEmbed() 39 | .setColor(ee.color) 40 | .setFooter(ee.footertext, ee.footericon) 41 | .setTitle(`Changed my Name to: \`${user.username}\``) 42 | ]}); 43 | }) 44 | .catch(e => { 45 | //send error message 46 | return message.reply({embeds: [new MessageEmbed() 47 | .setColor(ee.wrongcolor).setFooter(ee.footertext, ee.footericon) 48 | .setTitle(`:x: Something went Wrong`) 49 | .setDescription(`\`\`\`${String(JSON.stringify(e)).substr(0, 2000)}\`\`\``) 50 | ]}); 51 | }); 52 | } catch (e) { 53 | console.log(String(e.stack).bgRed) 54 | return message.reply({embeds: [new MessageEmbed() 55 | .setColor(ee.wrongcolor) 56 | .setFooter(ee.footertext, ee.footericon) 57 | .setTitle(`❌ ERROR | An error occurred`) 58 | .setDescription(`\`\`\`${e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000)}\`\`\``) 59 | ]}); 60 | } 61 | }, 62 | }; 63 | /** 64 | * @INFO 65 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/discord-js-lavalink-Music-Bot-erela-js 66 | * @INFO 67 | * Work for Milrato Development | https://milrato.eu 68 | * @INFO 69 | * Please mention Him / Milrato Development, when using this Code! 70 | * @INFO 71 | */ -------------------------------------------------------------------------------- /commands/Owner/cmdreload.js: -------------------------------------------------------------------------------- 1 | var { 2 | MessageEmbed 3 | } = require(`discord.js`); 4 | var Discord = require(`discord.js`); 5 | var config = require(`../../botconfig/config.json`); 6 | var settings = require(`../../botconfig/settings.json`); 7 | var ee = require(`../../botconfig/embed.json`); 8 | module.exports = { 9 | name: `cmdreload`, 10 | category: `Owner`, 11 | aliases: [`commandreload`], 12 | description: `Reloads a command`, 13 | usage: `cmdreload <CMD>`, 14 | memberpermissions: [], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 15 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 16 | alloweduserids: settings.ownerIDS, //Only allow specific Users to execute a Command [OPTIONAL] 17 | minargs: 1, // minimum args for the message, 0 == none [OPTIONAL] 18 | maxargs: 0, // maximum args for the message, 0 == none [OPTIONAL] 19 | minplusargs: 0, // minimum args for the message, splitted with "++" , 0 == none [OPTIONAL] 20 | maxplusargs: 0, // maximum args for the message, splitted with "++" , 0 == none [OPTIONAL] 21 | argsmissing_message: "", //Message if the user has not enough args / not enough plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 22 | argstoomany_message: "", //Message if the user has too many / not enough args / too many plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 23 | run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { 24 | try { 25 | //get the cmd 26 | let thecmd = client.commands.get(args[0].toLowerCase()) || client.commands.get(client.aliases.get(args[0].toLowerCase())); 27 | //if cmd found 28 | if (thecmd) { 29 | try { 30 | //delete the cmd from there 31 | delete require.cache[require.resolve(`../../commands/${thecmd.category}/${thecmd.name}.js`)] // usage !reload <name> 32 | //delete the command from the collection 33 | client.commands.delete(thecmd.name) 34 | //Pull the cmd information 35 | const pull = require(`../../commands/${thecmd.category}/${thecmd.name}.js`) 36 | //set the information 37 | client.commands.set(thecmd.name, pull) 38 | //send success message 39 | return message.reply({embeds: [new MessageEmbed() 40 | .setColor(ee.color) 41 | .setFooter(ee.footertext, ee.footericon) 42 | .setTitle(`Reloaded: \`${args[0]}\``) 43 | ]}); 44 | } catch (e) { 45 | return message.reply({embeds: [new MessageEmbed() 46 | .setColor(ee.color) 47 | .setFooter(ee.footertext, ee.footericon) 48 | .setTitle(`:x: Could not reload: \`${args[0]}\``) 49 | .setDescription(`\`\`\`${e.message ? String(e.message).substr(0, 2000) : e.stack ? String(e.stack).substr(0, 2000) : String(e).substr(0, 2000)}\`\`\``) 50 | ]}); 51 | } 52 | } else { 53 | return message.reply({embeds: [new MessageEmbed() 54 | .setColor(ee.wrongcolor) 55 | .setFooter(ee.footertext, ee.footericon) 56 | .setTitle(`:x: Could not find: \`${args[0]}\``) 57 | ]}); 58 | } 59 | } catch (e) { 60 | console.log(String(e.stack).bgRed) 61 | return message.reply({embeds: [new MessageEmbed() 62 | .setColor(ee.wrongcolor) 63 | .setFooter(ee.footertext, ee.footericon) 64 | .setTitle(`❌ ERROR | An error occurred`) 65 | .setDescription(`\`\`\`${e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000)}\`\`\``) 66 | ]}); 67 | } 68 | }, 69 | }; 70 | /** 71 | * @INFO 72 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/discord-js-lavalink-Music-Bot-erela-js 73 | * @INFO 74 | * Work for Milrato Development | https://milrato.eu 75 | * @INFO 76 | * Please mention Him / Milrato Development, when using this Code! 77 | * @INFO 78 | */ 79 | -------------------------------------------------------------------------------- /commands/Owner/detailedeval.js: -------------------------------------------------------------------------------- 1 | const { 2 | MessageEmbed, 3 | splitMessage 4 | } = require(`discord.js`); 5 | var Discord = require(`discord.js`); 6 | var config = require(`../../botconfig/config.json`); 7 | var settings = require(`../../botconfig/settings.json`); 8 | var ee = require(`../../botconfig/embed.json`); 9 | const { 10 | inspect 11 | } = require(`util`); 12 | module.exports = { 13 | name: `detailedeval`, 14 | category: `Owner`, 15 | aliases: [`detailedevaluate`, "detailevaluate", "detaileval"], 16 | description: `Eval a Command in detail! (not cutting of the resulted message)`, 17 | usage: `detailedeval <CODE>`, 18 | memberpermissions: [], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 19 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 20 | alloweduserids: settings.ownerIDS, //Only allow specific Users to execute a Command [OPTIONAL] 21 | minargs: 1, // minimum args for the message, 0 == none [OPTIONAL] 22 | maxargs: 0, // maximum args for the message, 0 == none [OPTIONAL] 23 | minplusargs: 0, // minimum args for the message, splitted with "++" , 0 == none [OPTIONAL] 24 | maxplusargs: 0, // maximum args for the message, splitted with "++" , 0 == none [OPTIONAL] 25 | argsmissing_message: "", //Message if the user has not enough args / not enough plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 26 | argstoomany_message: "", //Message if the user has too many / not enough args / too many plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 27 | run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { 28 | try { 29 | //define a global variable 30 | let evaled; 31 | //if the args include the word token, return console error 32 | if (args.join(` `).includes(`token`)) return console.log(`ERROR NO TOKEN GRABBING ;)`.red); 33 | //get the evaled content 34 | evaled = await eval(args.join(` `)); 35 | //make string out of the evaluation 36 | let string = inspect(evaled); 37 | //if the token is included return error 38 | if (string.includes(client.token)) return console.log(`ERROR NO TOKEN GRABBING ;)`.red); 39 | //define queueembed 40 | let evalEmbed = new MessageEmbed() 41 | .setTitle(`${client.user.username} | Evaluation`) 42 | .setColor(ee.color); 43 | //split the description 44 | const splitDescription = splitMessage(string, { 45 | maxLength: 2040, 46 | char: `\n`, 47 | prepend: ``, 48 | append: `` 49 | }); 50 | //For every description send a new embed 51 | splitDescription.forEach(async (m) => { 52 | //(over)write embed description 53 | evalEmbed.setDescription(`\`\`\`` + m + `\`\`\``); 54 | //send embed 55 | message.channel.send(evalEmbed); 56 | }); 57 | } catch (e) { 58 | return message.channel.send(new MessageEmbed() 59 | .setColor(ee.wrongcolor) 60 | .setFooter(ee.footertext, ee.footericon) 61 | .setTitle(`:x: ERROR | An error occurred`) 62 | .setDescription(`\`\`\`${e.message}\`\`\``) 63 | ); 64 | } 65 | }, 66 | }; 67 | /** 68 | * @INFO 69 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/discord-js-lavalink-Music-Bot-erela-js 70 | * @INFO 71 | * Work for Milrato Development | https://milrato.eu 72 | * @INFO 73 | * Please mention Him / Milrato Development, when using this Code! 74 | * @INFO 75 | */ 76 | -------------------------------------------------------------------------------- /commands/Owner/eval.js: -------------------------------------------------------------------------------- 1 | const { 2 | MessageEmbed, 3 | splitMessage 4 | } = require(`discord.js`); 5 | var Discord = require(`discord.js`); 6 | var config = require(`../../botconfig/config.json`); 7 | var settings = require(`../../botconfig/settings.json`); 8 | var ee = require(`../../botconfig/embed.json`); 9 | const { 10 | inspect 11 | } = require(`util`); 12 | module.exports = { 13 | name: `eval`, 14 | category: `Owner`, 15 | aliases: [`evaluate`, "evaluate", "eval"], 16 | description: `Eval a Command!`, 17 | usage: `eval <CODE>`, 18 | memberpermissions: [], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 19 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 20 | alloweduserids: settings.ownerIDS, //Only allow specific Users to execute a Command [OPTIONAL] 21 | minargs: 1, // minimum args for the message, 0 == none [OPTIONAL] 22 | maxargs: 0, // maximum args for the message, 0 == none [OPTIONAL] 23 | minplusargs: 0, // minimum args for the message, splitted with "++" , 0 == none [OPTIONAL] 24 | maxplusargs: 0, // maximum args for the message, splitted with "++" , 0 == none [OPTIONAL] 25 | argsmissing_message: "", //Message if the user has not enough args / not enough plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 26 | argstoomany_message: "", //Message if the user has too many / not enough args / too many plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 27 | run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { 28 | try { 29 | //define a global variable 30 | let evaled; 31 | //if the args include the word token, return console error 32 | if (args.join(` `).includes(`token`)) return console.log(`ERROR NO TOKEN GRABBING ;)`.red); 33 | //get the evaled content 34 | evaled = await eval(args.join(` `)); 35 | //make string out of the evaluation 36 | let string = inspect(evaled); 37 | //if the token is included return error 38 | if (string.includes(client.token)) return console.log(`ERROR NO TOKEN GRABBING ;)`.red); 39 | //define queueembed 40 | let evalEmbed = new MessageEmbed() 41 | .setTitle(`${client.user.username} | Evaluation`) 42 | .setColor(ee.color); 43 | //split the description 44 | const splitDescription = splitMessage(string, { 45 | maxLength: 2040, 46 | char: `\n`, 47 | prepend: ``, 48 | append: `` 49 | }); 50 | //array for embeds 51 | let embeds = [] 52 | //For every description send a new embed 53 | await splitDescription.forEach(async (m) => { 54 | //(over)write embed description 55 | evalEmbed.setDescription(`\`\`\`` + m + `\`\`\``); 56 | embeds.push(evalEmbed) 57 | //send embed 58 | }); 59 | message.reply({embeds: embeds}); 60 | } catch (e) { 61 | return message.reply({embeds: [new MessageEmbed() 62 | .setColor(ee.wrongcolor) 63 | .setFooter(ee.footertext, ee.footericon) 64 | .setTitle(`❌ ERROR | An error occurred`) 65 | .setDescription(`\`\`\`${e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000)}\`\`\``) 66 | ]}); 67 | } 68 | }, 69 | }; 70 | /** 71 | * @INFO 72 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/discord-js-lavalink-Music-Bot-erela-js 73 | * @INFO 74 | * Work for Milrato Development | https://milrato.eu 75 | * @INFO 76 | * Please mention Him / Milrato Development, when using this Code! 77 | * @INFO 78 | */ 79 | -------------------------------------------------------------------------------- /commands/Owner/reloadbot.js: -------------------------------------------------------------------------------- 1 | var { 2 | MessageEmbed 3 | } = require(`discord.js`); 4 | var Discord = require(`discord.js`); 5 | var config = require(`../../botconfig/config.json`); 6 | var ee = require(`../../botconfig/embed.json`); 7 | var settings = require(`../../botconfig/settings.json`); 8 | var { 9 | delay 10 | } = require(`../../handlers/functions`); 11 | const fs = require("fs") 12 | module.exports = { 13 | name: "reloadbot", 14 | category: "Owner", 15 | aliases: ["botreloadbot"], 16 | cooldown: 5, 17 | usage: "reloadbot", 18 | description: "Reloads the Bot, All Commands Events, etc.", 19 | memberpermissions: [], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 20 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 21 | alloweduserids: settings.ownerIDS, //Only allow specific Users to execute a Command [OPTIONAL] 22 | minargs: 0, // minimum args for the message, 0 == none [OPTIONAL] 23 | maxargs: 1, // maximum args for the message, 0 == none [OPTIONAL] 24 | minplusargs: 0, // minimum args for the message, splitted with "++" , 0 == none [OPTIONAL] 25 | maxplusargs: 0, // maximum args for the message, splitted with "++" , 0 == none [OPTIONAL] 26 | argsmissing_message: "", //Message if the user has not enough args / not enough plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 27 | argstoomany_message: "", //Message if the user has too many / not enough args / too many plus args, which will be sent, leave emtpy / dont add, if you wanna use command.usage or the default message! [OPTIONAL] 28 | run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { 29 | try { 30 | //define the index file 31 | const index = require("../../index") 32 | //define a counter variable 33 | let eventcount = 0; 34 | //get the folders in events 35 | await fs.readdirSync("./events/").forEach(async (dir) => { 36 | //for each folder get all files 37 | const events = fs.readdirSync(`./events/${dir}/`).filter((file) => file.endsWith(".js")); 38 | //add the amount of files to the counter 39 | eventcount += events.length 40 | }) 41 | //send a temp message 42 | let tempmsg = await message.channel.send(new MessageEmbed() 43 | .setColor(ee.color).setFooter(ee.footertext, ee.footericon) 44 | .setAuthor("Reloading ...", "https://images-ext-1.discordapp.net/external/ANU162U1fDdmQhim_BcbQ3lf4dLaIQl7p0HcqzD5wJA/https/cdn.discordapp.com/emojis/756773010123522058.gif", "https://discord.gg/FQGXbypRf8") 45 | .setTitle(`> Reloading **\`${client.commands.size} Commands\`**\n\n> Reloading **\`${eventcount} Events\`**\n\n> Reloading **\`${client.handlers.length} Modules/Features\`**`) 46 | ) 47 | //clear the commands collection 48 | await client.commands.clear(); 49 | //Delete all files from the cache 50 | await fs.readdirSync("./commands/").forEach(async (dir) => { 51 | //get all commands from the folder 52 | const commands = fs.readdirSync(`./commands/${dir}/`).filter((file) => file.endsWith(".js")); 53 | //loop throug all cmds 54 | for (let file of commands) { 55 | try { 56 | //delete it from the cache 57 | delete require.cache[require.resolve(`../../commands/${dir}/${file}.js`)] 58 | //log if successful 59 | console.log(`SUCCESS :: ../../commands/${dir}/${file}.js`) 60 | } catch {} 61 | } 62 | }) 63 | //WAIT 1 SEC 64 | await delay(1000); 65 | //clear all events 66 | await client.removeAllListeners() 67 | //wait 1 Sec 68 | await delay(1000); 69 | //REMOVE ALL BASICS HANDLERS 70 | await client.handlers.forEach(handler => { 71 | try { 72 | //delete it from the cache 73 | delete require.cache[require.resolve(`../../handlers/${handler}`)]; 74 | //log if successful 75 | console.log(`SUCCESS :: ../../handlers/${handler}`); 76 | } catch (e) { 77 | console.log(e) 78 | } 79 | }); 80 | //if you are having cronjobs in your bot, stop them here and restart if needed! 81 | 82 | 83 | //wait 1 Sec 84 | await delay(1000); 85 | //Load the basics, (commands, dbs, events, etc.) 86 | index.handlers(); 87 | //SEND CMDS SUCCESS 88 | console.log(client.commands.map(cmd => cmd.name)) 89 | //edit the embed 90 | await tempmsg.edit({ 91 | embed: new MessageEmbed() 92 | .setColor(ee.color).setFooter(ee.footertext, ee.footericon) 93 | .setAuthor("Successfully Reloaded:", "https://cdn.discordapp.com/emojis/833101995723194437.gif?v=1", "https://discord.gg/FQGXbypRf8") 94 | .setTitle(`> **\`${client.commands.size} Commands\`**\n\n> **\`${eventcount} Events\`**\n\n> **\`${client.handlers.length} Modules/Features\`**`) 95 | }) 96 | } catch (e) { 97 | console.log(String(e.stack).bgRed) 98 | return message.channel.send(new MessageEmbed() 99 | .setColor(ee.wrongcolor).setFooter(ee.footertext, ee.footericon) 100 | .setTitle(`:x: Something went Wrong`) 101 | .setDescription(`\`\`\`${String(JSON.stringify(e)).substr(0, 2000)}\`\`\``) 102 | ); 103 | } 104 | }, 105 | }; 106 | /** 107 | * @INFO 108 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/discord-js-lavalink-Music-Bot-erela-js 109 | * @INFO 110 | * Work for Milrato Development | https://milrato.eu 111 | * @INFO 112 | * Please mention Him / Milrato Development, when using this Code! 113 | * @INFO 114 | */ -------------------------------------------------------------------------------- /events/client/debug.js: -------------------------------------------------------------------------------- 1 | //here the event starts 2 | module.exports = (client, info) => { 3 | //console.log(String(info).grey); 4 | } 5 | /** 6 | * @INFO 7 | * Bot Coded by Tomato#6966 | https://discord.gg/FQGXbypRf8 8 | * @INFO 9 | * Work for Milrato Development | https://milrato.eu 10 | * @INFO 11 | * Please mention him / Milrato Development, when using this Code! 12 | * @INFO 13 | */ 14 | -------------------------------------------------------------------------------- /events/client/disconnect.js: -------------------------------------------------------------------------------- 1 | //here the event starts 2 | module.exports = client => { 3 | console.log(`You have been disconnected at ${new Date()}.`.dim) 4 | } 5 | /** 6 | * @INFO 7 | * Bot Coded by Tomato#6966 | https://discord.gg/FQGXbypRf8 8 | * @INFO 9 | * Work for Milrato Development | https://milrato.eu 10 | * @INFO 11 | * Please mention him / Milrato Development, when using this Code! 12 | * @INFO 13 | */ 14 | 15 | -------------------------------------------------------------------------------- /events/client/error.js: -------------------------------------------------------------------------------- 1 | //here the event starts 2 | module.exports = (client, error) => { 3 | console.log(String(error).red.dim); 4 | } 5 | /** 6 | * @INFO 7 | * Bot Coded by Tomato#6966 | https://discord.gg/FQGXbypRf8 8 | * @INFO 9 | * Work for Milrato Development | https://milrato.eu 10 | * @INFO 11 | * Please mention him / Milrato Development, when using this Code! 12 | * @INFO 13 | */ 14 | -------------------------------------------------------------------------------- /events/client/rateLimit.js: -------------------------------------------------------------------------------- 1 | //here the event starts 2 | module.exports = (client, rateLimitData) => { 3 | console.log(JSON.stringify(rateLimitData).grey.italic.dim); 4 | } 5 | /** 6 | * @INFO 7 | * Bot Coded by Tomato#6966 | https://discord.gg/FQGXbypRf8 8 | * @INFO 9 | * Work for Milrato Development | https://milrato.eu 10 | * @INFO 11 | * Please mention him / Milrato Development, when using this Code! 12 | * @INFO 13 | */ 14 | -------------------------------------------------------------------------------- /events/client/ready.js: -------------------------------------------------------------------------------- 1 | //here the event starts 2 | const config = require("../../botconfig/config.json") 3 | const { change_status } = require("../../handlers/functions"); 4 | module.exports = client => { 5 | //SETTING ALL GUILD DATA FOR THE DJ ONLY COMMANDS for the DEFAULT 6 | //client.guilds.cache.forEach(guild=>client.settings.set(guild.id, ["autoplay", "clearqueue", "forward", "loop", "jump", "loopqueue", "loopsong", "move", "pause", "resume", "removetrack", "removedupe", "restart", "rewind", "seek", "shuffle", "skip", "stop", "volume"], "djonlycmds")) 7 | try{ 8 | try{ 9 | const stringlength = 69; 10 | console.log("\n") 11 | console.log(` ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓`.bold.brightGreen) 12 | console.log(` ┃ `.bold.brightGreen + " ".repeat(-1+stringlength-` ┃ `.length)+ "┃".bold.brightGreen) 13 | console.log(` ┃ `.bold.brightGreen + `Discord Bot is online!`.bold.brightGreen + " ".repeat(-1+stringlength-` ┃ `.length-`Discord Bot is online!`.length)+ "┃".bold.brightGreen) 14 | console.log(` ┃ `.bold.brightGreen + ` /--/ ${client.user.tag} /--/ `.bold.brightGreen+ " ".repeat(-1+stringlength-` ┃ `.length-` /--/ ${client.user.tag} /--/ `.length)+ "┃".bold.brightGreen) 15 | console.log(` ┃ `.bold.brightGreen + " ".repeat(-1+stringlength-` ┃ `.length)+ "┃".bold.brightGreen) 16 | console.log(` ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛`.bold.brightGreen) 17 | }catch{ /* */ } 18 | change_status(client); 19 | //loop through the status per each 10 minutes 20 | setInterval(()=>{ 21 | change_status(client); 22 | }, 15 * 1000); 23 | 24 | } catch (e){ 25 | console.log(String(e.stack).grey.italic.dim.bgRed) 26 | } 27 | } 28 | /** 29 | * @INFO 30 | * Bot Coded by Tomato#6966 | https://discord.gg/FQGXbypRf8 31 | * @INFO 32 | * Work for Milrato Development | https://milrato.eu 33 | * @INFO 34 | * Please mention him / Milrato Development, when using this Code! 35 | * @INFO 36 | */ 37 | -------------------------------------------------------------------------------- /events/client/reconnecting.js: -------------------------------------------------------------------------------- 1 | //here the event starts 2 | module.exports = client => { 3 | console.log(`Reconnceting at ${new Date()}.`.bgYellow.black) 4 | } 5 | /** 6 | * @INFO 7 | * Bot Coded by Tomato#6966 | https://discord.gg/FQGXbypRf8 8 | * @INFO 9 | * Work for Milrato Development | https://milrato.eu 10 | * @INFO 11 | * Please mention him / Milrato Development, when using this Code! 12 | * @INFO 13 | */ 14 | -------------------------------------------------------------------------------- /events/client/shardDisconnect.js: -------------------------------------------------------------------------------- 1 | //here the event starts 2 | module.exports = (client, event, id) => { 3 | console.log(` || <==> || [${String(new Date).split(" ", 5).join(" ")}] || <==> || Shard #${id} Disconnected || <==> ||`) 4 | } 5 | /** 6 | * @INFO 7 | * Bot Coded by Tomato#6966 | https://discord.gg/FQGXbypRf8 8 | * @INFO 9 | * Work for Milrato Development | https://milrato.eu 10 | * @INFO 11 | * Please mention him / Milrato Development, when using this Code! 12 | * @INFO 13 | */ 14 | -------------------------------------------------------------------------------- /events/client/shardError.js: -------------------------------------------------------------------------------- 1 | //here the event starts 2 | module.exports = (client, error, id) => { 3 | console.log(` || <==> || [${String(new Date).split(" ", 5).join(" ")}] || <==> || Shard #${id} Errored || <==> ||`) 4 | } 5 | /** 6 | * @INFO 7 | * Bot Coded by Tomato#6966 | https://discord.gg/FQGXbypRf8 8 | * @INFO 9 | * Work for Milrato Development | https://milrato.eu 10 | * @INFO 11 | * Please mention him / Milrato Development, when using this Code! 12 | * @INFO 13 | */ 14 | -------------------------------------------------------------------------------- /events/client/shardReady.js: -------------------------------------------------------------------------------- 1 | //here the event starts 2 | module.exports = (client, id) => { 3 | console.log(` || <==> || [${String(new Date).split(" ", 5).join(" ")}] || <==> || Shard #${id} Ready || <==> ||`) 4 | } 5 | /** 6 | * @INFO 7 | * Bot Coded by Tomato#6966 | https://discord.gg/FQGXbypRf8 8 | * @INFO 9 | * Work for Milrato Development | https://milrato.eu 10 | * @INFO 11 | * Please mention him / Milrato Development, when using this Code! 12 | * @INFO 13 | */ 14 | -------------------------------------------------------------------------------- /events/client/shardReconnecting.js: -------------------------------------------------------------------------------- 1 | //here the event starts 2 | module.exports = (client, id) => { 3 | console.log(` || <==> || [${String(new Date).split(" ", 5).join(" ")}] || <==> || Shard #${id} Reconnecting || <==> ||`) 4 | } 5 | /** 6 | * @INFO 7 | * Bot Coded by Tomato#6966 | https://discord.gg/FQGXbypRf8 8 | * @INFO 9 | * Work for Milrato Development | https://milrato.eu 10 | * @INFO 11 | * Please mention him / Milrato Development, when using this Code! 12 | * @INFO 13 | */ 14 | -------------------------------------------------------------------------------- /events/client/shardResume.js: -------------------------------------------------------------------------------- 1 | //here the event starts 2 | module.exports = (client, id, replayedEvents) => { 3 | console.log(` || <==> || [${String(new Date).split(" ", 5).join(" ")}] || <==> || Shard #${id} Resumed || <==> ||`) 4 | } 5 | /** 6 | * @INFO 7 | * Bot Coded by Tomato#6966 | https://discord.gg/FQGXbypRf8 8 | * @INFO 9 | * Work for Milrato Development | https://milrato.eu 10 | * @INFO 11 | * Please mention him / Milrato Development, when using this Code! 12 | * @INFO 13 | */ 14 | -------------------------------------------------------------------------------- /events/client/warn.js: -------------------------------------------------------------------------------- 1 | //here the event starts 2 | module.exports = (client, error) => { 3 | console.log(String(error).yellow.dim); 4 | } 5 | /** 6 | * @INFO 7 | * Bot Coded by Tomato#6966 | https://discord.gg/FQGXbypRf8 8 | * @INFO 9 | * Work for Milrato Development | https://milrato.eu 10 | * @INFO 11 | * Please mention him / Milrato Development, when using this Code! 12 | * @INFO 13 | */ 14 | -------------------------------------------------------------------------------- /events/guild/guildMemberAdd.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @INFO 3 | * Loading all needed File Information Parameters 4 | */ 5 | const config = require("../../botconfig/config.json"); //loading config file with token and prefix 6 | const settings = require("../../botconfig/settings.json"); //loading settings file with the settings 7 | const ee = require("../../botconfig/embed.json"); //Loading all embed settings like color footertext and icon ... 8 | const Discord = require("discord.js"); //this is the official discord.js wrapper for the Discord Api, which we use! 9 | //here the event starts 10 | module.exports = (client, member) => { 11 | //Do some code, once the Bot joined the Server 12 | } -------------------------------------------------------------------------------- /events/guild/interactionCreate.js: -------------------------------------------------------------------------------- 1 | //Import Modules 2 | const config = require(`../../botconfig/config.json`); 3 | const ee = require(`../../botconfig/embed.json`); 4 | const settings = require(`../../botconfig/settings.json`); 5 | const { onCoolDown, replacemsg } = require("../../handlers/functions"); 6 | const Discord = require("discord.js"); 7 | module.exports = (client, interaction) => { 8 | const CategoryName = interaction.commandName; 9 | let command = false; 10 | try{ 11 | if (client.slashCommands.has(CategoryName + interaction.options.getSubcommand())) { 12 | command = client.slashCommands.get(CategoryName + interaction.options.getSubcommand()); 13 | } 14 | }catch{ 15 | if (client.slashCommands.has("normal" + CategoryName)) { 16 | command = client.slashCommands.get("normal" + CategoryName); 17 | } 18 | } 19 | if(command) { 20 | if (onCoolDown(interaction, command)) { 21 | return interaction.reply({ephemeral: true, 22 | embeds: [new Discord.MessageEmbed() 23 | .setColor(ee.wrongcolor) 24 | .setFooter(ee.footertext, ee.footericon) 25 | .setTitle(replacemsg(settings.messages.cooldown, { 26 | prefix: prefix, 27 | command: command, 28 | timeLeft: onCoolDown(interaction, command) 29 | }))] 30 | }); 31 | } 32 | //if Command has specific permission return error 33 | if (command.memberpermissions && command.memberpermissions.length > 0 && !interaction.member.permissions.has(command.memberpermissions)) { 34 | return interaction.reply({ ephemeral: true, embeds: [new Discord.MessageEmbed() 35 | .setColor(ee.wrongcolor) 36 | .setFooter(ee.footertext, ee.footericon) 37 | .setTitle(replacemsg(settings.messages.notallowed_to_exec_cmd.title)) 38 | .setDescription(replacemsg(settings.messages.notallowed_to_exec_cmd.description.memberpermissions, { 39 | command: command, 40 | prefix: prefix 41 | }))] 42 | }); 43 | } 44 | //if Command has specific needed roles return error 45 | if (command.requiredroles && command.requiredroles.length > 0 && interaction.member.roles.cache.size > 0 && !interaction.member.roles.cache.some(r => command.requiredroles.includes(r.id))) { 46 | return interaction.reply({ ephemeral: true, embeds: [new Discord.MessageEmbed() 47 | .setColor(ee.wrongcolor) 48 | .setFooter(ee.footertext, ee.footericon) 49 | .setTitle(replacemsg(settings.messages.notallowed_to_exec_cmd.title)) 50 | .setDescription(replacemsg(settings.messages.notallowed_to_exec_cmd.description.requiredroles, { 51 | command: command, 52 | prefix: prefix 53 | }))] 54 | }) 55 | } 56 | //if Command has specific users return error 57 | if (command.alloweduserids && command.alloweduserids.length > 0 && !command.alloweduserids.includes(interaction.member.id)) { 58 | return interaction.reply({ ephemeral: true, embeds: [new Discord.MessageEmbed() 59 | .setColor(ee.wrongcolor) 60 | .setFooter(ee.footertext, ee.footericon) 61 | .setTitle(replacemsg(settings.messages.notallowed_to_exec_cmd.title)) 62 | .setDescription(replacemsg(settings.messages.notallowed_to_exec_cmd.description.alloweduserids, { 63 | command: command, 64 | prefix: prefix 65 | }))] 66 | }); 67 | } 68 | //execute the Command 69 | command.run(client, interaction, interaction.member, interaction.guild) 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /events/guild/messageCreate.js: -------------------------------------------------------------------------------- 1 | //Import Modules 2 | const config = require(`../../botconfig/config.json`); 3 | const ee = require(`../../botconfig/embed.json`); 4 | const settings = require(`../../botconfig/settings.json`); 5 | const { onCoolDown, replacemsg } = require("../../handlers/functions"); 6 | const Discord = require("discord.js"); 7 | module.exports = async (client, message) => { 8 | if(!message.guild || !message.channel || message.author.bot) return; 9 | if(message.channel.partial) await message.channel.fetch(); 10 | if(message.partial) await message.fetch(); 11 | const prefix = config.prefix; 12 | const prefixRegex = new RegExp(`^(<@!?${client.user.id}>|${escapeRegex(prefix)})`); 13 | if(!prefixRegex.test(message.content)) return; 14 | const [, mPrefix] = message.content.match(prefixRegex); 15 | const args = message.content.slice(mPrefix.length).trim().split(/ +/).filter(Boolean); 16 | const cmd = args.length > 0 ? args.shift().toLowerCase() : null; 17 | if(cmd.length == 0){ 18 | if(mPrefix.includes(client.user.id)){ 19 | message.reply({embeds: [new Discord.MessageEmbed().setColor(ee.color).setFooter(ee.footertext, ee.footericon).setTitle(`:thumbsup: **My Prefix here, is __\`${prefix}\`__**`)]}) 20 | } 21 | return; 22 | } 23 | let command = client.commands.get(cmd); 24 | if(!command) command = client.commands.get(client.aliases.get(cmd)); 25 | if (command) { 26 | //Check if user is on cooldown with the cmd, with Tomato#6966's Function from /handlers/functions.js 27 | if (onCoolDown(message, command)) { 28 | return message.reply({ 29 | embeds: [new Discord.MessageEmbed() 30 | .setColor(ee.wrongcolor) 31 | .setFooter(ee.footertext, ee.footericon) 32 | .setTitle(replacemsg(settings.messages.cooldown, { 33 | prefix: prefix, 34 | command: command, 35 | timeLeft: onCoolDown(message, command) 36 | }))] 37 | }); 38 | } 39 | try { 40 | //if Command has specific permission return error 41 | if (command.memberpermissions && command.memberpermissions.length > 0 && !message.member.permissions.has(command.memberpermissions)) { 42 | return message.reply({ embeds: [new Discord.MessageEmbed() 43 | .setColor(ee.wrongcolor) 44 | .setFooter(ee.footertext, ee.footericon) 45 | .setTitle(replacemsg(settings.messages.notallowed_to_exec_cmd.title)) 46 | .setDescription(replacemsg(settings.messages.notallowed_to_exec_cmd.description.memberpermissions, { 47 | command: command, 48 | prefix: prefix 49 | }))] 50 | }).then(msg => {setTimeout(()=>{msg.delete().catch((e) => {console.log(String(e).grey)})}, settings.timeout.notallowed_to_exec_cmd.memberpermissions)}).catch((e) => {console.log(String(e).grey)}); 51 | } 52 | //if Command has specific needed roles return error 53 | if (command.requiredroles && command.requiredroles.length > 0 && message.member.roles.cache.size > 0 && !message.member.roles.cache.some(r => command.requiredroles.includes(r.id))) { 54 | return message.reply({embeds: [new Discord.MessageEmbed() 55 | .setColor(ee.wrongcolor) 56 | .setFooter(ee.footertext, ee.footericon) 57 | .setTitle(replacemsg(settings.messages.notallowed_to_exec_cmd.title)) 58 | .setDescription(replacemsg(settings.messages.notallowed_to_exec_cmd.description.requiredroles, { 59 | command: command, 60 | prefix: prefix 61 | }))] 62 | }).then(msg => {setTimeout(()=>{msg.delete().catch((e) => {console.log(String(e).grey)})}, settings.timeout.notallowed_to_exec_cmd.requiredroles)}).catch((e) => {console.log(String(e).grey)}); 63 | 64 | } 65 | //if Command has specific users return error 66 | if (command.alloweduserids && command.alloweduserids.length > 0 && !command.alloweduserids.includes(message.author.id)) { 67 | return message.reply({embeds: [new Discord.MessageEmbed() 68 | .setColor(ee.wrongcolor) 69 | .setFooter(ee.footertext, ee.footericon) 70 | .setTitle(replacemsg(settings.messages.notallowed_to_exec_cmd.title)) 71 | .setDescription(replacemsg(settings.messages.notallowed_to_exec_cmd.description.alloweduserids, { 72 | command: command, 73 | prefix: prefix 74 | }))] 75 | }).then(msg => {setTimeout(()=>{msg.delete().catch((e) => {console.log(String(e).grey)})}, settings.timeout.notallowed_to_exec_cmd.alloweduserids)}).catch((e) => {console.log(String(e).grey)}); 76 | } 77 | //if command has minimum args, and user dont entered enough, return error 78 | if(command.minargs && command.minargs > 0 && args.length < command.minargs) { 79 | return message.reply({embeds: [new Discord.MessageEmbed() 80 | .setColor(ee.wrongcolor) 81 | .setFooter(ee.footertext, ee.footericon) 82 | .setTitle(":x: Wrong Command Usage!") 83 | .setDescription(command.argsmissing_message && command.argsmissing_message.trim().length > 0 ? command.argsmissing_message : command.usage ? "Usage: " + command.usage : "Wrong Command Usage")] 84 | }).then(msg => {setTimeout(()=>{msg.delete().catch((e) => {console.log(String(e).grey)})}, settings.timeout.minargs)}).catch((e) => {console.log(String(e).grey)}); 85 | } 86 | //if command has maximum args, and user enters too many, return error 87 | if(command.maxargs && command.maxargs > 0 && args.length > command.maxargs) { 88 | return message.reply({embeds: [new Discord.MessageEmbed() 89 | .setColor(ee.wrongcolor) 90 | .setFooter(ee.footertext, ee.footericon) 91 | .setTitle(":x: Wrong Command Usage!") 92 | .setDescription(command.argstoomany_message && command.argstoomany_message.trim().length > 0 ? command.argstoomany_message : command.usage ? "Usage: " + command.usage : "Wrong Command Usage")] 93 | }).then(msg => {setTimeout(()=>{msg.delete().catch((e) => {console.log(String(e).grey)})}, settings.timeout.maxargs)}).catch((e) => {console.log(String(e).grey)}); 94 | } 95 | 96 | //if command has minimum args (splitted with "++"), and user dont entered enough, return error 97 | if(command.minplusargs && command.minplusargs > 0 && args.join(" ").split("++").filter(Boolean).length < command.minplusargs) { 98 | return message.reply({embeds: [new Discord.MessageEmbed() 99 | .setColor(ee.wrongcolor) 100 | .setFooter(ee.footertext, ee.footericon) 101 | .setTitle(":x: Wrong Command Usage!") 102 | .setDescription(command.argsmissing_message && command.argsmissing_message.trim().length > 0 ? command.argsmissing_message : command.usage ? "Usage: " + command.usage : "Wrong Command Usage")] 103 | }).then(msg => {setTimeout(()=>{msg.delete().catch((e) => {console.log(String(e).grey)})}, settings.timeout.minplusargs)}).catch((e) => {console.log(String(e).grey)}); 104 | } 105 | //if command has maximum args (splitted with "++"), and user enters too many, return error 106 | if(command.maxplusargs && command.maxplusargs > 0 && args.join(" ").split("++").filter(Boolean).length > command.maxplusargs) { 107 | return message.reply({embeds: [new Discord.MessageEmbed() 108 | .setColor(ee.wrongcolor) 109 | .setFooter(ee.footertext, ee.footericon) 110 | .setTitle(":x: Wrong Command Usage!") 111 | .setDescription(command.argstoomany_message && command.argstoomany_message.trim().length > 0 ? command.argsmissing_message : command.usage ? "Usage: " + command.usage : "Wrong Command Usage")] 112 | }).then(msg => {setTimeout(()=>{msg.delete().catch((e) => {console.log(String(e).grey)})}, settings.timeout.maxplusargs)}).catch((e) => {console.log(String(e).grey)}); 113 | } 114 | //run the command with the parameters: client, message, args, Cmduser, text, prefix, 115 | command.run(client, message, args, args.join(" ").split("++").filter(Boolean), message.member, args.join(" "), prefix); 116 | } catch (error) { 117 | if (settings.somethingwentwrong_cmd) { 118 | return message.reply({ 119 | embeds: [new Discord.MessageEmbed() 120 | .setColor(ee.wrongcolor) 121 | .setFooter(ee.footertext, ee.footericon) 122 | .setTitle(replacemsg(settings.messages.somethingwentwrong_cmd.title, { 123 | prefix: prefix, 124 | command: command 125 | })) 126 | .setDescription(replacemsg(settings.messages.somethingwentwrong_cmd.description, { 127 | error: error, 128 | prefix: prefix, 129 | command: command 130 | }))] 131 | }).then(msg => {setTimeout(()=>{msg.delete().catch((e) => {console.log(String(e).grey)})}, 4000)}).catch((e) => {console.log(String(e).grey)}); 132 | } 133 | } 134 | } else //if the command is not found send an info msg 135 | return message.reply({ 136 | embeds: [new Discord.MessageEmbed() 137 | .setColor(ee.wrongcolor) 138 | .setFooter(ee.footertext, ee.footericon) 139 | .setTitle(replacemsg(settings.messages.unknown_cmd, { 140 | prefix: prefix 141 | }))] 142 | }).then(msg => {setTimeout(()=>{msg.delete().catch((e) => {console.log(String(e).grey)})}, 4000)}).catch((e) => {console.log(String(e).grey)}); 143 | } 144 | /** 145 | * @INFO 146 | * Bot Coded by Tomato#6966 | https://discord.gg/milrato 147 | * @INFO 148 | * Work for Milrato Development | https://milrato.eu 149 | * @INFO 150 | * Please mention Him / Milrato Development, when using this Code! 151 | * @INFO 152 | */ 153 | function escapeRegex(str) { 154 | return str.replace(/[.*+?^${}()|[\]\\]/g, `\\$&`); 155 | } 156 | -------------------------------------------------------------------------------- /events/guild/messageReactionAdd.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @INFO 3 | * Loading all needed File Information Parameters 4 | */ 5 | const config = require("../../botconfig/config.json"); //loading config file with token and prefix 6 | const settings = require("../../botconfig/settings.json"); //loading settings file with the settings 7 | const ee = require("../../botconfig/embed.json"); //Loading all embed settings like color footertext and icon ... 8 | const Discord = require("discord.js"); //this is the official discord.js wrapper for the Discord Api, which we use! 9 | //here the event starts 10 | module.exports = async (client, reaction, user) => { 11 | //logs when a reaction appears 12 | if (reaction.message.partial) await reaction.message.fetch(); 13 | if (reaction.partial) await reaction.fetch(); 14 | if (user.bot) return; 15 | if (!reaction.message.guild) return; 16 | //REST OF THE CODE HERE 17 | } -------------------------------------------------------------------------------- /events/guild/messageReactionRemove.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @INFO 3 | * Loading all needed File Information Parameters 4 | */ 5 | const config = require("../../botconfig/config.json"); //loading config file with token and prefix 6 | const settings = require("../../botconfig/settings.json"); //loading settings file with the settings 7 | const ee = require("../../botconfig/embed.json"); //Loading all embed settings like color footertext and icon ... 8 | const Discord = require("discord.js"); //this is the official discord.js wrapper for the Discord Api, which we use! 9 | //here the event starts 10 | module.exports = async (client, reaction, user) => { 11 | //logs when a reaction appears 12 | if (reaction.message.partial) await reaction.message.fetch(); 13 | if (reaction.partial) await reaction.fetch(); 14 | if (user.bot) return; 15 | if (!reaction.message.guild) return; 16 | //REST OF THE CODE HERE 17 | } -------------------------------------------------------------------------------- /events/guild/threadCreate.js: -------------------------------------------------------------------------------- 1 | module.exports = async (client, thread) => { 2 | if(thread.joinable){ 3 | try{ 4 | await thread.join(); 5 | }catch (e){ 6 | console.log(e) 7 | } 8 | } 9 | } 10 | /** 11 | * @INFO 12 | * Bot Coded by Tomato#6966 | https://discord.gg/milrato 13 | * @INFO 14 | * Work for Milrato Development | https://milrato.eu 15 | * @INFO 16 | * Please mention Him / Milrato Development, when using this Code! 17 | * @INFO 18 | */ 19 | -------------------------------------------------------------------------------- /events/guild/voiceStateUpdate.js: -------------------------------------------------------------------------------- 1 | module.exports = async (client, oldState, newState) => { 2 | if ( 3 | (!oldState.streaming && newState.streaming) || 4 | (oldState.streaming && !newState.streaming) || 5 | (!oldState.serverDeaf && newState.serverDeaf) || 6 | (oldState.serverDeaf && !newState.serverDeaf) || 7 | (!oldState.serverMute && newState.serverMute) || 8 | (oldState.serverMute && !newState.serverMute) || 9 | (!oldState.selfDeaf && newState.selfDeaf) || 10 | (oldState.selfDeaf && !newState.selfDeaf) || 11 | (!oldState.selfMute && newState.selfMute) || 12 | (oldState.selfMute && !newState.selfMute) || 13 | (!oldState.selfVideo && newState.selfVideo) || 14 | (oldState.selfVideo && !newState.selfVideo) 15 | ) 16 | if (!oldState.channelId && newState.channelId) { 17 | if(newState.channel.type == "GUILD_STAGE_VOICE" && newState.guild.me.voice.suppress){ 18 | try{ 19 | await newState.guild.me.voice.setSuppressed(false); 20 | }catch (e){ 21 | console.log(String(e).grey) 22 | } 23 | } 24 | return 25 | } 26 | if (oldState.channelId && !newState.channelId) { 27 | return 28 | } 29 | if (oldState.channelId && newState.channelId) { 30 | if(newState.channel.type == "GUILD_STAGE_VOICE" && newState.guild.me.voice.suppress){ 31 | try{ 32 | await newState.guild.me.voice.setSuppressed(false); 33 | }catch (e){ 34 | console.log(String(e).grey) 35 | } 36 | } 37 | return; 38 | } 39 | } 40 | /** 41 | * @INFO 42 | * Bot Coded by Tomato#6966 | https://discord.gg/milrato 43 | * @INFO 44 | * Work for Milrato Development | https://milrato.eu 45 | * @INFO 46 | * Please mention Him / Milrato Development, when using this Code! 47 | * @INFO 48 | */ -------------------------------------------------------------------------------- /handlers/antiCrash.js: -------------------------------------------------------------------------------- 1 | module.exports = client => { 2 | process.on('unhandledRejection', (reason, p) => { 3 | console.log(' [antiCrash] :: Unhandled Rejection/Catch'); 4 | console.log(reason, p); 5 | }); 6 | process.on("uncaughtException", (err, origin) => { 7 | console.log(' [antiCrash] :: Uncaught Exception/Catch'); 8 | console.log(err, origin); 9 | }) 10 | process.on('uncaughtExceptionMonitor', (err, origin) => { 11 | console.log(' [antiCrash] :: Uncaught Exception/Catch (MONITOR)'); 12 | console.log(err, origin); 13 | }); 14 | process.on('multipleResolves', (type, promise, reason) => { 15 | console.log(' [antiCrash] :: Multiple Resolves'); 16 | console.log(type, promise, reason); 17 | }); 18 | } 19 | -------------------------------------------------------------------------------- /handlers/commands.js: -------------------------------------------------------------------------------- 1 | const { 2 | readdirSync 3 | } = require("fs"); 4 | console.log("Welcome to SERVICE HANDLER /--/ By https://milrato.eu /--/ Discord: Tomato#6966".yellow); 5 | module.exports = (client) => { 6 | try { 7 | let amount = 0; 8 | readdirSync("./commands/").forEach((dir) => { 9 | const commands = readdirSync(`./commands/${dir}/`).filter((file) => file.endsWith(".js")); 10 | for (let file of commands) { 11 | let pull = require(`../commands/${dir}/${file}`); 12 | if (pull.name) { 13 | client.commands.set(pull.name, pull); 14 | amount++; 15 | } else { 16 | console.log(file, `error -> missing a help.name, or help.name is not a string.`.brightRed); 17 | continue; 18 | } 19 | if (pull.aliases && Array.isArray(pull.aliases)) pull.aliases.forEach((alias) => client.aliases.set(alias, pull.name)); 20 | } 21 | }); 22 | console.log(`${amount} Commands Loaded`.brightGreen); 23 | } catch (e) { 24 | console.log(String(e.stack).bgRed) 25 | } 26 | }; 27 | /** 28 | * @INFO 29 | * Bot Coded by Tomato#6966 | https://discord.gg/milrato 30 | * @INFO 31 | * Work for Milrato Development | https://milrato.eu 32 | * @INFO 33 | * Please mention Him / Milrato Development, when using this Code! 34 | * @INFO 35 | */ -------------------------------------------------------------------------------- /handlers/events.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const allevents = []; 3 | module.exports = async (client) => { 4 | try { 5 | try { 6 | const stringlength = 69; 7 | console.log("\n") 8 | console.log(` ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓`.bold.brightGreen) 9 | console.log(` ┃ `.bold.brightGreen + " ".repeat(-1 + stringlength - ` ┃ `.length) + "┃".bold.brightGreen) 10 | console.log(` ┃ `.bold.brightGreen + `Welcome to SERVICE HANDLER!`.bold.brightGreen + " ".repeat(-1 + stringlength - ` ┃ `.length - `Welcome to SERVICE HANDLER!`.length) + "┃".bold.brightGreen) 11 | console.log(` ┃ `.bold.brightGreen + ` /-/ By https://milrato.eu /-/`.bold.brightGreen + " ".repeat(-1 + stringlength - ` ┃ `.length - ` /-/ By https://milrato.eu /-/`.length) + "┃".bold.brightGreen) 12 | console.log(` ┃ `.bold.brightGreen + " ".repeat(-1 + stringlength - ` ┃ `.length) + "┃".bold.brightGreen) 13 | console.log(` ┃ `.bold.brightGreen + ` /-/ Discord: Tomato#6966 /-/`.bold.brightGreen + " ".repeat(-1 + stringlength - ` ┃ `.length - ` /-/ By Discord: Tomato#6966 /-/`.length) + " ┃".bold.brightGreen) 14 | console.log(` ┃ `.bold.brightGreen + " ".repeat(-1 + stringlength - ` ┃ `.length) + "┃".bold.brightGreen) 15 | console.log(` ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛`.bold.brightGreen) 16 | } catch { 17 | /* */ } 18 | let amount = 0; 19 | const load_dir = (dir) => { 20 | const event_files = fs.readdirSync(`./events/${dir}`).filter((file) => file.endsWith(".js")); 21 | for (const file of event_files) { 22 | try { 23 | const event = require(`../events/${dir}/${file}`) 24 | let eventName = file.split(".")[0]; 25 | allevents.push(eventName); 26 | client.on(eventName, event.bind(null, client)); 27 | amount++; 28 | } catch (e) { 29 | console.log(e) 30 | } 31 | } 32 | } 33 | await ["client", "guild"].forEach(e => load_dir(e)); 34 | console.log(`${amount} Events Loaded`.brightGreen); 35 | try { 36 | const stringlength2 = 69; 37 | console.log("\n") 38 | console.log(` ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓`.bold.yellow) 39 | console.log(` ┃ `.bold.yellow + " ".repeat(-1 + stringlength2 - ` ┃ `.length) + "┃".bold.yellow) 40 | console.log(` ┃ `.bold.yellow + `Logging into the BOT...`.bold.yellow + " ".repeat(-1 + stringlength2 - ` ┃ `.length - `Logging into the BOT...`.length) + "┃".bold.yellow) 41 | console.log(` ┃ `.bold.yellow + " ".repeat(-1 + stringlength2 - ` ┃ `.length) + "┃".bold.yellow) 42 | console.log(` ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛`.bold.yellow) 43 | } catch { 44 | /* */ } 45 | } catch (e) { 46 | console.log(String(e.stack).bgRed) 47 | } 48 | }; 49 | /** 50 | * @INFO 51 | * Bot Coded by Tomato#6966 | https://discord.gg/milrato 52 | * @INFO 53 | * Work for Milrato Development | https://milrato.eu 54 | * @INFO 55 | * Please mention Him / Milrato Development, when using this Code! 56 | * @INFO 57 | */ -------------------------------------------------------------------------------- /handlers/functions.js: -------------------------------------------------------------------------------- 1 | const { 2 | MessageEmbed, 3 | Collection 4 | } = require("discord.js"); 5 | const config = require("../botconfig/config.json"); 6 | const ee = require("../botconfig/embed.json"); 7 | const settings = require("../botconfig/settings.json"); 8 | //EXPORT ALL FUNCTIONS 9 | module.exports.nFormatter = nFormatter; 10 | module.exports.change_status = change_status; 11 | module.exports.shuffle = shuffle; 12 | module.exports.formatDate = formatDate; 13 | module.exports.delay = delay; 14 | module.exports.getRandomInt = getRandomInt; 15 | module.exports.duration = duration; 16 | module.exports.getRandomNum = getRandomNum; 17 | module.exports.createBar = createBar; 18 | module.exports.format = format; 19 | module.exports.swap_pages = swap_pages; 20 | module.exports.swap_pages2 = swap_pages2; 21 | module.exports.escapeRegex = escapeRegex; 22 | module.exports.arrayMove = arrayMove; 23 | module.exports.isValidURL = isValidURL; 24 | module.exports.GetUser = GetUser; 25 | module.exports.GetRole = GetRole; 26 | module.exports.GetGlobalUser = GetGlobalUser; 27 | module.exports.parseMilliseconds = parseMilliseconds; 28 | module.exports.onCoolDown = onCoolDown; 29 | 30 | module.exports.replacemsg = replacedefaultmessages 31 | /** 32 | * 33 | * @param {*} text The Text that should be replaced, usually from /botconfig/settings.json 34 | * @param {*} options Those Options are what are needed for the replaceMent! Valid ones are: { 35 | * timeLeft: "", 36 | * commandmemberpermissions: { memberpermissions: [] }, 37 | * commandalloweduserids: { alloweduserids: [] }, 38 | * commandrequiredroles: { requiredroles: [] }, 39 | * commandname: { name: "" }, 40 | * commandaliases: { aliases: [] }, 41 | * prefix: "", 42 | * errormessage: { message: "" } 43 | * errorstack: { stack: STACK } 44 | * error: ERRORTYPE 45 | * } 46 | * @returns STRING 47 | */ 48 | function replacedefaultmessages(text, o = {}){ 49 | if(!text || text == undefined || text == null) throw "No Text for the replacedefault message added as First Parameter"; 50 | const options = Object(o) 51 | if(!options || options == undefined || options == null) return String(text) 52 | return String(text) 53 | .replace(/%{timeleft}%/gi, options && options.timeLeft ? options.timeLeft.toFixed(1) : "%{timeleft}%") 54 | .replace(/%{commandname}%/gi, options && options.command && options.command.name ? options.command.name : "%{commandname}%") 55 | .replace(/%{commandaliases}%/gi, options && options.command && options.command.aliases ? options.command.aliases.map(v => `\`${v}\``).join(",") : "%{commandaliases}%") 56 | .replace(/%{prefix}%/gi, options && options.prefix ? options.prefix : "%{prefix}%") 57 | .replace(/%{commandmemberpermissions}%/gi, options && options.command && options.command.memberpermissions ? options.command.memberpermissions.map(v => `\`${v}\``).join(",") : "%{commandmemberpermissions}%") 58 | .replace(/%{commandalloweduserids}%/gi, options && options.command &&options.command.alloweduserids ? options.command.alloweduserids.map(v => `<@${v}>`).join(",") : "%{commandalloweduserids}%") 59 | .replace(/%{commandrequiredroles}%/gi, options && options.command &&options.command.requiredroles ? options.command.requiredroles.map(v => `<@&${v}>`).join(",") : "%{commandrequiredroles}%") 60 | .replace(/%{errormessage}%/gi, options && options.error && options.error.message ? options.error.message : options && options.error ? options.error : "%{errormessage}%") 61 | .replace(/%{errorstack}%/gi, options && options.error && options.error.stack ? options.error.stack : options && options.error && options.error.message ? options.error.message : options && options.error ? options.error : "%{errorstack}%") 62 | .replace(/%{error}%/gi, options && options.error ? options.error : "%{error}%") 63 | 64 | } 65 | 66 | /** 67 | * 68 | * @param {*} message A DiscordMessage, with the client, information 69 | * @param {*} command The Command with the command.name 70 | * @returns BOOLEAN 71 | */ 72 | 73 | function onCoolDown(message, command) { 74 | if(!message || !message.client) throw "No Message with a valid DiscordClient granted as First Parameter"; 75 | if(!command || !command.name) throw "No Command with a valid Name granted as Second Parameter"; 76 | const client = message.client; 77 | if (!client.cooldowns.has(command.name)) { //if its not in the cooldown, set it too there 78 | client.cooldowns.set(command.name, new Collection()); 79 | } 80 | const now = Date.now(); //get the current time 81 | const timestamps = client.cooldowns.get(command.name); //get the timestamp of the last used commands 82 | const cooldownAmount = (command.cooldown || settings.default_cooldown_in_sec) * 1000; //get the cooldownamount of the command, if there is no cooldown there will be automatically 1 sec cooldown, so you cannot spam it^^ 83 | if (timestamps.has(message.member.id)) { //if the user is on cooldown 84 | const expirationTime = timestamps.get(message.member.id) + cooldownAmount; //get the amount of time he needs to wait until he can run the cmd again 85 | if (now < expirationTime) { //if he is still on cooldonw 86 | const timeLeft = (expirationTime - now) / 1000; //get the lefttime 87 | //return true 88 | return timeLeft 89 | } 90 | else { 91 | //if he is not on cooldown, set it to the cooldown 92 | timestamps.set(message.member.id, now); 93 | //set a timeout function with the cooldown, so it gets deleted later on again 94 | setTimeout(() => timestamps.delete(message.member.id), cooldownAmount); 95 | //return false aka not on cooldown 96 | return false; 97 | } 98 | } 99 | else { 100 | //if he is not on cooldown, set it to the cooldown 101 | timestamps.set(message.member.id, now); 102 | //set a timeout function with the cooldown, so it gets deleted later on again 103 | setTimeout(() => timestamps.delete(message.member.id), cooldownAmount); 104 | //return false aka not on cooldown 105 | return false; 106 | } 107 | } 108 | 109 | /** 110 | * 111 | * @param {*} milliseconds NUMBER | TIME IN MILLISECONDS 112 | * @returns Object of Formatted Time in Days to nanoseconds 113 | */ 114 | function parseMilliseconds(milliseconds) { 115 | if (typeof milliseconds !== 'number') { 116 | throw new TypeError('Expected a number'); 117 | } 118 | 119 | return { 120 | days: Math.trunc(milliseconds / 86400000), 121 | hours: Math.trunc(milliseconds / 3600000) % 24, 122 | minutes: Math.trunc(milliseconds / 60000) % 60, 123 | seconds: Math.trunc(milliseconds / 1000) % 60, 124 | milliseconds: Math.trunc(milliseconds) % 1000, 125 | microseconds: Math.trunc(milliseconds * 1000) % 1000, 126 | nanoseconds: Math.trunc(milliseconds * 1e6) % 1000 127 | }; 128 | } 129 | 130 | /** 131 | * 132 | * @param {*} string A WHOLE TEXT, checks if there is a URL IN IT 133 | * @returns BOOLEAN/THE URL 134 | */ 135 | function isValidURL(string) { 136 | const args = string.split(" "); 137 | let url; 138 | for(const arg of args){ 139 | try { 140 | url = new URL(arg); 141 | url = url.protocol === "http:" || url.protocol === "https:"; 142 | break; 143 | } catch (_) { 144 | url = false; 145 | } 146 | } 147 | return url; 148 | }; 149 | 150 | /** 151 | * 152 | * @param {*} message a DISCORDMESSAGE with the Content and guild and client information 153 | * @param {*} arg //a argument, for search for example 154 | * @returns BOOLEAN/DISCORDUSER 155 | */ 156 | function GetUser(message, arg){ 157 | var errormessage = ":x: I failed finding that User..."; 158 | return new Promise(async (resolve, reject) => { 159 | var args = arg, client = message.client; 160 | if(!client || !message) return reject("CLIENT IS NOT DEFINED") 161 | if(!args || args == null || args == undefined) args = message.content.trim().split(/ +/).slice(1); 162 | let user = message.mentions.users.first(); 163 | if(!user && args[0] && args[0].length == 18) { 164 | user = await client.users.fetch(args[0]) 165 | if(!user) return reject(errormessage) 166 | return resolve(user); 167 | } 168 | else if(!user && args[0]){ 169 | let alluser = message.guild.members.cache.map(member=> String(member.user.tag).toLowerCase()) 170 | user = alluser.find(user => user.startsWith(args.join(" ").toLowerCase())) 171 | user = message.guild.members.cache.find(me => String(me.user.tag).toLowerCase() == user) 172 | if(!user || user == null || !user.id) { 173 | alluser = message.guild.members.cache.map(member => String(member.displayName + "#" + member.user.discriminator).toLowerCase()) 174 | user = alluser.find(user => user.startsWith(args.join(" ").toLowerCase())) 175 | user = message.guild.members.cache.find(me => String(me.displayName + "#" + me.user.discriminator).toLowerCase() == user) 176 | if(!user || user == null || !user.id) return reject(errormessage) 177 | } 178 | user = await client.users.fetch(user.user.id) 179 | if(!user) return reject(errormessage) 180 | return resolve(user); 181 | } 182 | else { 183 | user = message.mentions.users.first() || message.author; 184 | return resolve(user); 185 | } 186 | }) 187 | } 188 | 189 | /** 190 | * 191 | * @param {*} message a DISCORDMESSAGE with the Content and guild and client information 192 | * @param {*} arg //a argument, for search for example 193 | * @returns BOOLEAN/GUILDROLE 194 | */ 195 | function GetRole(message, arg){ 196 | var errormessage = ":x: I failed finding that Role..."; 197 | return new Promise(async (resolve, reject) => { 198 | var args = arg, client = message.client; 199 | if(!client || !message) return reject("CLIENT IS NOT DEFINED") 200 | if(!args || args == null || args == undefined) args = message.content.trim().split(/ +/).slice(1); 201 | let user = message.mentions.roles.filter(role=>role.guild.id==message.guild.id).first(); 202 | if(!user && args[0] && args[0].length == 18) { 203 | user = message.guild.roles.cache.get(args[0]) 204 | if(!user) return reject(errormessage) 205 | return resolve(user); 206 | } 207 | else if(!user && args[0]){ 208 | let alluser = message.guild.roles.cache.map(role => String(role.name).toLowerCase()) 209 | user = alluser.find(r => r.split(" ").join("").includes(args.join("").toLowerCase())) 210 | user = message.guild.roles.cache.find(role => String(role.name).toLowerCase() === user) 211 | if(!user) return reject(errormessage) 212 | return resolve(user); 213 | } 214 | else { 215 | user = message.mentions.roles.filter(role=>role.guild.id==message.guild.id).first(); 216 | if(!user) return reject(errormessage) 217 | return resolve(user); 218 | } 219 | }) 220 | } 221 | 222 | 223 | /** 224 | * 225 | * @param {*} message a DISCORDMESSAGE with the Content and guild and client information 226 | * @param {*} arg //a argument, for search for example 227 | * @returns BOOLEAN/DISCORDUSER 228 | */ 229 | function GetGlobalUser(message, arg){ 230 | var errormessage = ":x: I failed finding that User..."; 231 | return new Promise(async (resolve, reject) => { 232 | var args = arg, client = message.client; 233 | if(!client || !message) return reject("CLIENT IS NOT DEFINED") 234 | if(!args || args == null || args == undefined) args = message.content.trim().split(/ +/).slice(1); 235 | let user = message.mentions.users.first(); 236 | if(!user && args[0] && args[0].length == 18) { 237 | user = await client.users.fetch(args[0]) 238 | if(!user) return reject(errormessage) 239 | return resolve(user); 240 | } 241 | else if(!user && args[0]){ 242 | let alluser = [], allmembers = []; 243 | var guilds = Array.from(client.guilds.cache.values()) 244 | for(const g of guilds){ 245 | var members = Array.from(g.members.cache.values()); 246 | for(const m of members) { alluser.push(m.user.tag); allmembers.push(m); } 247 | } 248 | user = alluser.find(user => user.startsWith(args.join(" ").toLowerCase())) 249 | user = allmembers.find(me => String(me.user.tag).toLowerCase() == user) 250 | if(!user || user == null || !user.id) { 251 | user = alluser.find(user => user.startsWith(args.join(" ").toLowerCase())) 252 | user = allmembers.find(me => String(me.displayName + "#" + me.user.discriminator).toLowerCase() == user) 253 | if(!user || user == null || !user.id) return reject(errormessage) 254 | } 255 | user = await client.users.fetch(user.user.id) 256 | if(!user) return reject(errormessage) 257 | return resolve(user); 258 | } 259 | else { 260 | user = message.mentions.users.first() || message.author; 261 | return resolve(user); 262 | } 263 | }) 264 | } 265 | 266 | /** 267 | * 268 | * @param {*} array Shuffles a given array (mix) 269 | * @returns ARRAY 270 | */ 271 | function shuffle(array) { 272 | try { 273 | var j, x, i; 274 | for (i = array.length - 1; i > 0; i--) { 275 | j = Math.floor(Math.random() * (i + 1)); 276 | x = array[i]; 277 | array[i] = array[j]; 278 | array[j] = x; 279 | } 280 | return array; 281 | } catch (e) { 282 | console.log(String(e.stack).bgRed) 283 | } 284 | } 285 | 286 | /** 287 | * 288 | * @param {*} date Date format (Date.now()) 289 | * @returns Formatted Date 290 | */ 291 | function formatDate(date) { 292 | try { 293 | return new Intl.DateTimeFormat("en-US").format(date); 294 | } catch (e) { 295 | console.log(String(e.stack).bgRed) 296 | return false; 297 | } 298 | } 299 | 300 | /** 301 | * 302 | * @param {*} duration Number | Time in Milliseconds 303 | * @returns Object of Formatted Time in Days to milliseconds 304 | */ 305 | function parseDuration(duration) { 306 | let remain = duration 307 | let days = Math.floor(remain / (1000 * 60 * 60 * 24)) 308 | remain = remain % (1000 * 60 * 60 * 24) 309 | 310 | let hours = Math.floor(remain / (1000 * 60 * 60)) 311 | remain = remain % (1000 * 60 * 60) 312 | 313 | let minutes = Math.floor(remain / (1000 * 60)) 314 | remain = remain % (1000 * 60) 315 | 316 | let seconds = Math.floor(remain / (1000)) 317 | remain = remain % (1000) 318 | 319 | let milliseconds = remain 320 | 321 | return { 322 | days, 323 | hours, 324 | minutes, 325 | seconds, 326 | milliseconds 327 | }; 328 | } 329 | 330 | /** 331 | * 332 | * @param {*} o Object of Time from days to nanoseconds/milliseconds 333 | * @param {*} useMilli Optional Boolean parameter, if it should use milliseconds or not in the showof 334 | * @returns Formatted Time 335 | */ 336 | function formatTime(o, useMilli = false) { 337 | let parts = [] 338 | if (o.days) { 339 | let ret = o.days + ' Day' 340 | if (o.days !== 1) { 341 | ret += 's' 342 | } 343 | parts.push(ret) 344 | } 345 | if (o.hours) { 346 | let ret = o.hours + ' Hr' 347 | if (o.hours !== 1) { 348 | ret += 's' 349 | } 350 | parts.push(ret) 351 | } 352 | if (o.minutes) { 353 | let ret = o.minutes + ' Min' 354 | if (o.minutes !== 1) { 355 | ret += 's' 356 | } 357 | parts.push(ret) 358 | 359 | } 360 | if (o.seconds) { 361 | let ret = o.seconds + ' Sec' 362 | if (o.seconds !== 1) { 363 | ret += 's' 364 | } 365 | parts.push(ret) 366 | } 367 | if (useMilli && o.milliseconds) { 368 | let ret = o.milliseconds + ' ms' 369 | parts.push(ret) 370 | } 371 | if (parts.length === 0) { 372 | return 'instantly' 373 | } else { 374 | return parts 375 | } 376 | } 377 | 378 | /** 379 | * 380 | * @param {*} duration Number | Time in Millisceonds 381 | * @param {*} useMilli Optional Boolean parameter, if it should use milliseconds or not in the showof 382 | * @returns Formatted Time 383 | */ 384 | function duration(duration, useMilli = false) { 385 | let time = parseDuration(duration) 386 | return formatTime(time, useMilli) 387 | } 388 | 389 | /** 390 | * 391 | * @param {*} delayInms Number | Time in Milliseconds 392 | * @returns Promise, waiting for the given Milliseconds 393 | */ 394 | function delay(delayInms) { 395 | try { 396 | return new Promise((resolve) => { 397 | setTimeout(() => { 398 | resolve(2); 399 | }, delayInms); 400 | }); 401 | } catch (e) { 402 | console.log(String(e.stack).bgRed) 403 | } 404 | } 405 | 406 | /** 407 | * 408 | * @param {*} max Number | 0 - MAX 409 | * @returns Number 410 | */ 411 | function getRandomInt(max) { 412 | try { 413 | return Math.floor(Math.random() * Math.floor(max)); 414 | } catch (e) { 415 | console.log(String(e.stack).bgRed) 416 | } 417 | } 418 | 419 | /** 420 | * 421 | * @param {*} min Number | min - max 422 | * @param {*} max Number | min - max 423 | * @returns Number 424 | */ 425 | function getRandomNum(min, max) { 426 | try { 427 | return Math.floor(Math.random() * Math.floor((max - min) + min)); 428 | } catch (e) { 429 | console.log(String(e.stack).bgRed) 430 | } 431 | } 432 | 433 | /** 434 | * 435 | * @param {*} total Number | Time in Milliseconds 436 | * @param {*} current Number | Time in Milliseconds | Current Music Position 437 | * @param {*} size Number | Amount of Letters in the Bar (SIZE) Default is: 25 438 | * @param {*} line EMOJI | the default line is: "▬" 439 | * @param {*} slider EMOJI | the default slider is: "🔷" 440 | * @returns STRING a BAR [▬▬▬▬▬🔷▬▬▬▬▬▬▬▬] 441 | */ 442 | function createBar(total, current, size = 25, line = "▬", slider = "🔷") { 443 | try { 444 | if (!total) throw "MISSING MAX TIME"; 445 | if (!current) return `**[${mover}${line.repeat(size - 1)}]**`; 446 | let bar = current > total 447 | ? [line.repeat(size / 2 * 2), (current / total) * 100] 448 | : [line.repeat(Math.round(size / 2 * (current / total))).replace(/.$/, slider) 449 | + line.repeat(size - Math.round(size * (current / total)) + 1), current / total]; 450 | if (!String(bar).includes(mover)) { 451 | return `**[${mover}${line.repeat(size - 1)}]**`; 452 | } else{ 453 | return `**[${bar[0]}]**`; 454 | } 455 | } catch (e) { 456 | console.log(String(e.stack).bgRed) 457 | } 458 | } 459 | 460 | /** 461 | * 462 | * @param {*} millis Number | Time in Milliseconds 463 | * @returns Formatted time in: HH:MM:SS HH only if bigger then 0 464 | */ 465 | function format(millis) { 466 | try { 467 | var h = Math.floor(millis / 3600000), 468 | m = Math.floor(millis / 60000), 469 | s = ((millis % 60000) / 1000).toFixed(0); 470 | if (h < 1) return (m < 10 ? "0" : "") + m + ":" + (s < 10 ? "0" : "") + s + " | " + (Math.floor(millis / 1000)) + " Seconds"; 471 | else return (h < 10 ? "0" : "") + h + ":" + (m < 10 ? "0" : "") + m + ":" + (s < 10 ? "0" : "") + s + " | " + (Math.floor(millis / 1000)) + " Seconds"; 472 | } catch (e) { 473 | console.log(String(e.stack).bgRed) 474 | } 475 | } 476 | 477 | /** 478 | * 479 | * @param {*} str String of message, not replacing pings 480 | * @returns Only the Pinged message 481 | */ 482 | function escapeRegex(str) { 483 | try { 484 | return str.replace(/[.*+?^${}()|[\]\\]/g, `\\$&`); 485 | } catch (e) { 486 | console.log(String(e.stack).bgRed) 487 | } 488 | } 489 | 490 | /** 491 | * 492 | * @param {*} array ARRAY | Complete Array to work with 493 | * @param {*} from NUMBER | Position of first ITEM 494 | * @param {*} to NUMBER | Position where to move it to 495 | * @returns ARRAY | the Moved Array 496 | */ 497 | function arrayMove(array, from, to) { 498 | try { 499 | array = [...array]; 500 | const startIndex = from < 0 ? array.length + from : from; 501 | if (startIndex >= 0 && startIndex < array.length) { 502 | const endIndex = to < 0 ? array.length + to : to; 503 | const [item] = array.splice(from, 1); 504 | array.splice(endIndex, 0, item); 505 | } 506 | return array; 507 | } catch (e) { 508 | console.log(String(e.stack).bgRed) 509 | } 510 | } 511 | 512 | /** 513 | * 514 | * @param {*} num Number 515 | * @param {*} digits How many digits it should have: 10.231k == 3 516 | * @returns Formatted Number 517 | */ 518 | function nFormatter(num, digits = 2) { 519 | const lookup = [ 520 | { value: 1, symbol: "" }, 521 | { value: 1e3, symbol: "k" }, 522 | { value: 1e6, symbol: "M" }, 523 | { value: 1e9, symbol: "G" }, 524 | { value: 1e12, symbol: "T" }, 525 | { value: 1e15, symbol: "P" }, 526 | { value: 1e18, symbol: "E" } 527 | ]; 528 | const rx = /\.0+$|(\.[0-9]*[1-9])0+$/; 529 | var item = lookup.slice().reverse().find(function(item) { 530 | return num >= item.value; 531 | }); 532 | return item ? (num / item.value).toFixed(digits).replace(rx, "$1") + item.symbol : "0"; 533 | } 534 | 535 | /** 536 | * @param {*} message Discord Message with a DiscordChannel (TEXTCHANNEL) 537 | * @param {*} desc A Description, STRING OR ARRAY 538 | * @param {*} TITLE Title of the Embed 539 | * @param {*} reactionemojis Emojis for swaping the pages, Default: ["⬅️", "⏹", "➡️"] | OPTIONAL 540 | * @param {*} sliceamount If an Array is beeing used, it is the amount of items, per page, if a string then the amount of letters per page, Default Array: 15, Default String: 1000 | OPTIONAL 541 | * @returns VOID, works by itself 542 | */ 543 | const { MessageButton, MessageActionRow } = require('discord.js') 544 | async function swap_pages(client, message, description, TITLE) { 545 | let prefix = config.prefix; 546 | let cmduser = message.author; 547 | 548 | let currentPage = 0; 549 | //GET ALL EMBEDS 550 | let embeds = []; 551 | //if input is an array 552 | if (Array.isArray(description)) { 553 | try { 554 | let k = 20; 555 | for (let i = 0; i < description.length; i += 20) { 556 | const current = description.slice(i, k); 557 | k += 20; 558 | const embed = new MessageEmbed() 559 | .setDescription(current) 560 | .setTitle(TITLE) 561 | .setColor(ee.color) 562 | .setFooter(ee.footertext, ee.footericon) 563 | embeds.push(embed); 564 | } 565 | embeds; 566 | } catch {} 567 | } else { 568 | try { 569 | let k = 1000; 570 | for (let i = 0; i < description.length; i += 1000) { 571 | const current = description.slice(i, k); 572 | k += 1000; 573 | const embed = new MessageEmbed() 574 | .setDescription(current) 575 | .setTitle(TITLE) 576 | .setColor(ee.color) 577 | .setFooter(ee.footertext, ee.footericon) 578 | embeds.push(embed); 579 | } 580 | embeds; 581 | } catch {} 582 | } 583 | if (embeds.length === 0) return message.channel.send({embeds: [new MessageEmbed() 584 | .setTitle(`${emoji.msg.ERROR} No Content added to the SWAP PAGES Function`) 585 | .setColor(ee.wrongcolor) 586 | .setFooter(ee.footertext, ee.footericon)]}).catch(e => console.log("THIS IS TO PREVENT A CRASH")) 587 | if (embeds.length === 1) return message.channel.send({embeds: [embeds[0]]}).catch(e => console.log("THIS IS TO PREVENT A CRASH")) 588 | 589 | let button_back = new MessageButton().setStyle('SUCCESS').setCustomId('1').setEmoji("833802907509719130").setLabel("Back") 590 | let button_home = new MessageButton().setStyle('DANGER').setCustomId('2').setEmoji("🏠").setLabel("Home") 591 | let button_forward = new MessageButton().setStyle('SUCCESS').setCustomId('3').setEmoji('832598861813776394').setLabel("Forward") 592 | const allbuttons = [new MessageActionRow().addComponents([button_back, button_home, button_forward])] 593 | //Send message with buttons 594 | let swapmsg = await message.channel.send({ 595 | content: `***Click on the __Buttons__ to swap the Pages***`, 596 | embeds: [embeds[0]], 597 | components: allbuttons 598 | }); 599 | //create a collector for the thinggy 600 | const collector = swapmsg.createMessageComponentCollector({filter: (i) => i.isButton() && i.user && i.user.id == cmduser.id && i.message.author.id == client.user.id, time: 180e3 }); //collector for 5 seconds 601 | //array of all embeds, here simplified just 10 embeds with numbers 0 - 9 602 | collector.on('collect', async b => { 603 | if(b.user.id !== message.author.id) 604 | return b.reply(`<:no:833101993668771842> **Only the one who typed ${prefix}help is allowed to react!**`, true) 605 | //page forward 606 | if(b.customId == "1") { 607 | //b.reply("***Swapping a PAGE FORWARD***, *please wait 2 Seconds for the next Input*", true) 608 | if (currentPage !== 0) { 609 | currentPage -= 1 610 | await swapmsg.edit({embeds: [embeds[currentPage]], components: allbuttons}); 611 | await b.deferUpdate(); 612 | } else { 613 | currentPage = embeds.length - 1 614 | await swapmsg.edit({embeds: [embeds[currentPage]], components: allbuttons}); 615 | await b.deferUpdate(); 616 | } 617 | } 618 | //go home 619 | else if(b.customId == "2"){ 620 | //b.reply("***Going Back home***, *please wait 2 Seconds for the next Input*", true) 621 | currentPage = 0; 622 | await swapmsg.edit({embeds: [embeds[currentPage]], components: allbuttons}); 623 | await b.deferUpdate(); 624 | } 625 | //go forward 626 | else if(b.customId == "3"){ 627 | //b.reply("***Swapping a PAGE BACK***, *please wait 2 Seconds for the next Input*", true) 628 | if (currentPage < embeds.length - 1) { 629 | currentPage++; 630 | await swapmsg.edit({embeds: [embeds[currentPage]], components: allbuttons}); 631 | await b.deferUpdate(); 632 | } else { 633 | currentPage = 0 634 | await swapmsg.edit({embeds: [embeds[currentPage]], components: allbuttons}); 635 | await b.deferUpdate(); 636 | } 637 | 638 | } 639 | }); 640 | 641 | 642 | } 643 | async function swap_pages2(client, message, embeds) { 644 | let currentPage = 0; 645 | let cmduser = message.author; 646 | if (embeds.length === 1) return message.channel.send({embeds: [embeds[0]]}).catch(e => console.log("THIS IS TO PREVENT A CRASH")) 647 | let button_back = new MessageButton().setStyle('SUCCESS').setCustomId('1').setEmoji("833802907509719130").setLabel("Back") 648 | let button_home = new MessageButton().setStyle('DANGER').setCustomId('2').setEmoji("🏠").setLabel("Home") 649 | let button_forward = new MessageButton().setStyle('SUCCESS').setCustomId('3').setEmoji('832598861813776394').setLabel("Forward") 650 | const allbuttons = [new MessageActionRow().addComponents([button_back, button_home, button_forward])] 651 | let prefix = client.settings.get(message.guild.id, "prefix"); 652 | //Send message with buttons 653 | let swapmsg = await message.channel.send({ 654 | content: `***Click on the __Buttons__ to swap the Pages***`, 655 | embeds: [embeds[0]], 656 | components: allbuttons 657 | }); 658 | //create a collector for the thinggy 659 | const collector = swapmsg.createMessageComponentCollector({filter: (i) => i.isButton() && i.user && i.user.id == cmduser.id && i.message.author.id == client.user.id, time: 180e3 }); //collector for 5 seconds 660 | //array of all embeds, here simplified just 10 embeds with numbers 0 - 9 661 | collector.on('collect', async b => { 662 | if(b.user.id !== message.author.id) 663 | return b.reply(`<:no:833101993668771842> **Only the one who typed ${prefix}help is allowed to react!**`, true) 664 | //page forward 665 | if(b.customId == "1") { 666 | //b.reply("***Swapping a PAGE FORWARD***, *please wait 2 Seconds for the next Input*", true) 667 | if (currentPage !== 0) { 668 | currentPage -= 1 669 | await swapmsg.edit({embeds: [embeds[currentPage]], components: allbuttons}); 670 | await b.deferUpdate(); 671 | } else { 672 | currentPage = embeds.length - 1 673 | await swapmsg.edit({embeds: [embeds[currentPage]], components: allbuttons}); 674 | await b.deferUpdate(); 675 | } 676 | } 677 | //go home 678 | else if(b.customId == "2"){ 679 | //b.reply("***Going Back home***, *please wait 2 Seconds for the next Input*", true) 680 | currentPage = 0; 681 | await swapmsg.edit({embeds: [embeds[currentPage]], components: allbuttons}); 682 | await b.deferUpdate(); 683 | } 684 | //go forward 685 | else if(b.customId == "3"){ 686 | //b.reply("***Swapping a PAGE BACK***, *please wait 2 Seconds for the next Input*", true) 687 | if (currentPage < embeds.length - 1) { 688 | currentPage++; 689 | await swapmsg.edit({embeds: [embeds[currentPage]], components: allbuttons}); 690 | await b.deferUpdate(); 691 | } else { 692 | currentPage = 0 693 | await swapmsg.edit({embeds: [embeds[currentPage]], components: allbuttons}); 694 | await b.deferUpdate(); 695 | } 696 | 697 | } 698 | }); 699 | 700 | } 701 | 702 | /** 703 | * 704 | * @param {*} client Discord Client 705 | * Function to Change the Status 706 | */ 707 | function change_status(client) { 708 | try { 709 | client.user.setActivity(`${config.prefix}help | ${client.guilds.cache.size} Guilds | ${Math.ceil(client.users.cache.size/1000)}k Members`, { 710 | type: "PLAYING", 711 | }); 712 | } catch (e) { 713 | console.log(String(e.stack).bgRed) 714 | } 715 | } 716 | -------------------------------------------------------------------------------- /handlers/slashCommands.js: -------------------------------------------------------------------------------- 1 | const { readdirSync, lstatSync } = require("fs"); 2 | const { SlashCommandBuilder } = require('@discordjs/builders'); 3 | const config = require("../botconfig/config.json"); 4 | const dirSetup = config.slashCommandsDirs; 5 | module.exports = (client) => { 6 | try { 7 | let allCommands = []; 8 | readdirSync("./slashCommands/").forEach((dir) => { 9 | if(lstatSync(`./slashCommands/${dir}`).isDirectory()) { 10 | const groupName = dir; 11 | const cmdSetup = dirSetup.find(d=>d.Folder == dir); 12 | //If its a valid cmdsetup 13 | if(cmdSetup && cmdSetup.Folder) { 14 | //Set the SubCommand as a Slash Builder 15 | const subCommand = new SlashCommandBuilder().setName(String(cmdSetup.CmdName).replace(/\s+/g, '_').toLowerCase()).setDescription(String(cmdSetup.CmdDescription)); 16 | //Now for each file in that subcommand, add a command! 17 | const slashCommands = readdirSync(`./slashCommands/${dir}/`).filter((file) => file.endsWith(".js")); 18 | for (let file of slashCommands) { 19 | let pull = require(`../slashCommands/${dir}/${file}`); 20 | if (pull.name && pull.description) { 21 | subCommand 22 | .addSubcommand((subcommand) => { 23 | subcommand.setName(String(pull.name).toLowerCase()).setDescription(pull.description) 24 | if(pull.options && pull.options.length > 0){ 25 | for(const option of pull.options){ 26 | if(option.User && option.User.name && option.User.description){ 27 | subcommand.addUserOption((op) => 28 | op.setName(String(option.User.name).replace(/\s+/g, '_').toLowerCase()).setDescription(option.User.description).setRequired(option.User.required) 29 | ) 30 | } else if(option.Integer && option.Integer.name && option.Integer.description){ 31 | subcommand.addIntegerOption((op) => 32 | op.setName(String(option.Integer.name).replace(/\s+/g, '_').toLowerCase()).setDescription(option.Integer.description).setRequired(option.Integer.required) 33 | ) 34 | } else if(option.String && option.String.name && option.String.description){ 35 | subcommand.addStringOption((op) => 36 | op.setName(String(option.String.name).replace(/\s+/g, '_').toLowerCase()).setDescription(option.String.description).setRequired(option.String.required) 37 | ) 38 | } else if(option.Channel && option.Channel.name && option.Channel.description){ 39 | subcommand.addChannelOption((op) => 40 | op.setName(String(option.Channel.name).replace(/\s+/g, '_').toLowerCase()).setDescription(option.Channel.description).setRequired(option.Channel.required) 41 | ) 42 | } else if(option.Role && option.Role.name && option.Role.description){ 43 | subcommand.addRoleOption((op) => 44 | op.setName(String(option.Role.name).replace(/\s+/g, '_').toLowerCase()).setDescription(option.Role.description).setRequired(option.Role.required) 45 | ) 46 | } else if(option.StringChoices && option.StringChoices.name && option.StringChoices.description && option.StringChoices.choices && option.StringChoices.choices.length > 0){ 47 | subcommand.addStringOption((op) => 48 | op.setName(String(option.StringChoices.name).replace(/\s+/g, '_').toLowerCase()).setDescription(option.StringChoices.description).setRequired(option.StringChoices.required) 49 | .addChoices(option.StringChoices.choices.map(c=> [String(c[0]).replace(/\s+/g, '_').toLowerCase(),String(c[1])] )), 50 | ) 51 | } else if(option.IntChoices && option.IntChoices.name && option.IntChoices.description && option.IntChoices.choices && option.IntChoices.choices.length > 0){ 52 | subcommand.addStringOption((op) => 53 | op.setName(String(option.IntChoices.name).replace(/\s+/g, '_').toLowerCase()).setDescription(option.IntChoices.description).setRequired(option.IntChoices.required) 54 | .addChoices(option.IntChoices.choices.map(c=> [String(c[0]).replace(/\s+/g, '_').toLowerCase(),parseInt(c[1])] )), 55 | ) 56 | } else { 57 | console.log(`A Option is missing the Name or/and the Description of ${pull.name}`) 58 | } 59 | } 60 | } 61 | return subcommand; 62 | }) 63 | client.slashCommands.set(String(cmdSetup.CmdName).replace(/\s+/g, '_').toLowerCase() + pull.name, pull) 64 | } else { 65 | console.log(file, `error -> missing a help.name, or help.name is not a string.`.brightRed); 66 | continue; 67 | } 68 | } 69 | //add the subcommand to the array 70 | allCommands.push(subCommand.toJSON()); 71 | } 72 | else { 73 | return console.log(`The Subcommand-Folder ${dir} is not in the dirSetup Configuration!`); 74 | } 75 | } else { 76 | let pull = require(`../slashCommands/${dir}`); 77 | if (pull.name && pull.description) { 78 | let Command = new SlashCommandBuilder().setName(String(pull.name).toLowerCase()).setDescription(pull.description); 79 | if(pull.options && pull.options.length > 0){ 80 | for(const option of pull.options){ 81 | if(option.User && option.User.name && option.User.description){ 82 | Command.addUserOption((op) => 83 | op.setName(String(option.User.name).replace(/\s+/g, '_').toLowerCase()).setDescription(option.User.description).setRequired(option.User.required) 84 | ) 85 | } else if(option.Integer && option.Integer.name && option.Integer.description){ 86 | Command.addIntegerOption((op) => 87 | op.setName(String(option.Integer.name).replace(/\s+/g, '_').toLowerCase()).setDescription(option.Integer.description).setRequired(option.Integer.required) 88 | ) 89 | } else if(option.String && option.String.name && option.String.description){ 90 | Command.addStringOption((op) => 91 | op.setName(String(option.String.name).replace(/\s+/g, '_').toLowerCase()).setDescription(option.String.description).setRequired(option.String.required) 92 | ) 93 | } else if(option.Channel && option.Channel.name && option.Channel.description){ 94 | Command.addChannelOption((op) => 95 | op.setName(String(option.Channel.name).replace(/\s+/g, '_').toLowerCase()).setDescription(option.Channel.description).setRequired(option.Channel.required) 96 | ) 97 | } else if(option.Role && option.Role.name && option.Role.description){ 98 | Command.addRoleOption((op) => 99 | op.setName(String(option.Role.name).replace(/\s+/g, '_').toLowerCase()).setDescription(option.Role.description).setRequired(option.Role.required) 100 | ) 101 | } else if(option.StringChoices && option.StringChoices.name && option.StringChoices.description && option.StringChoices.choices && option.StringChoices.choices.length > 0){ 102 | Command.addStringOption((op) => 103 | op.setName(String(option.StringChoices.name).replace(/\s+/g, '_').toLowerCase()).setDescription(option.StringChoices.description).setRequired(option.StringChoices.required) 104 | .addChoices(option.StringChoices.choices.map(c=> [String(c[0]).replace(/\s+/g, '_').toLowerCase(),String(c[1])] )), 105 | ) 106 | } else if(option.IntChoices && option.IntChoices.name && option.IntChoices.description && option.IntChoices.choices && option.IntChoices.choices.length > 0){ 107 | Command.addStringOption((op) => 108 | op.setName(String(option.IntChoices.name).replace(/\s+/g, '_').toLowerCase()).setDescription(option.IntChoices.description).setRequired(option.IntChoices.required) 109 | .addChoices(option.IntChoices.choices.map(c=> [String(c[0]).replace(/\s+/g, '_').toLowerCase(),parseInt(c[1])] )), 110 | ) 111 | } else { 112 | console.log(`A Option is missing the Name or/and the Description of ${pull.name}`) 113 | } 114 | } 115 | } 116 | allCommands.push(Command.toJSON()); 117 | client.slashCommands.set("normal" + pull.name, pull) 118 | } 119 | else { 120 | console.log(file, `error -> missing a help.name, or help.name is not a string.`.brightRed); 121 | } 122 | } 123 | }); 124 | 125 | //Once the Bot is ready, add all Slas Commands to each guild 126 | client.on("ready", () => { 127 | if(config.loadSlashsGlobal){ 128 | client.application.commands.set(allCommands) 129 | .then(slashCommandsData => { 130 | console.log(`${slashCommandsData.size} slashCommands ${`(With ${slashCommandsData.map(d => d.options).flat().length} Subcommands)`.green} Loaded for all: ${`All possible Guilds`.underline}`.brightGreen); 131 | console.log(`Because u are Using Global Settings, it can take up to 1 hour until the Commands are changed!`.bold.yellow) 132 | }).catch((e)=>console.log(e)); 133 | } else { 134 | client.guilds.cache.map(g => g).forEach((guild) => { 135 | try{ 136 | guild.commands.set(allCommands) 137 | .then(slashCommandsData => { 138 | console.log(`${slashCommandsData.size} slashCommands ${`(With ${slashCommandsData.map(d => d.options).flat().length} Subcommands)`.green} Loaded for: ${`${guild.name}`.underline}`.brightGreen); 139 | }).catch((e)=>console.log(e)); 140 | }catch (e){ 141 | console.log(String(e).grey) 142 | } 143 | }); 144 | } 145 | }) 146 | //DISABLE WHEN USING GLOBAL! 147 | client.on("guildCreate", (guild) => { 148 | try{ 149 | if(!config.loadSlashsGlobal){ 150 | guild.commands.set(allCommands) 151 | .then(slashCommandsData => { 152 | console.log(`${slashCommandsData.size} slashCommands ${`(With ${slashCommandsData.map(d => d.options).flat().length} Subcommands)`.green} Loaded for: ${`${guild.name}`.underline}`.brightGreen); 153 | }).catch((e)=>console.log(e)); 154 | } 155 | }catch (e){ 156 | console.log(String(e).grey) 157 | } 158 | }) 159 | 160 | } catch (e) { 161 | console.log(String(e.stack).bgRed) 162 | } 163 | }; 164 | /** 165 | * @INFO 166 | * Bot Coded by Tomato#6966 | https://discord.gg/milrato 167 | * @INFO 168 | * Work for Milrato Development | https://milrato.eu 169 | * @INFO 170 | * Please mention Him / Milrato Development, when using this Code! 171 | * @INFO 172 | */ 173 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const config = require(`./botconfig/config.json`); 3 | const settings = require(`./botconfig/settings.json`); 4 | const colors = require("colors"); 5 | const client = new Discord.Client({ 6 | //fetchAllMembers: false, 7 | //restTimeOffset: 0, 8 | //restWsBridgetimeout: 100, 9 | shards: "auto", 10 | allowedMentions: { 11 | parse: [ ], 12 | repliedUser: false, 13 | }, 14 | partials: ['MESSAGE', 'CHANNEL', 'REACTION'], 15 | intents: [ 16 | Discord.Intents.FLAGS.GUILDS, 17 | Discord.Intents.FLAGS.GUILD_MEMBERS, 18 | //Discord.Intents.FLAGS.GUILD_BANS, 19 | //Discord.Intents.FLAGS.GUILD_EMOJIS_AND_STICKERS, 20 | //Discord.Intents.FLAGS.GUILD_INTEGRATIONS, 21 | //Discord.Intents.FLAGS.GUILD_WEBHOOKS, 22 | //Discord.Intents.FLAGS.GUILD_INVITES, 23 | Discord.Intents.FLAGS.GUILD_VOICE_STATES, 24 | //Discord.Intents.FLAGS.GUILD_PRESENCES, 25 | Discord.Intents.FLAGS.GUILD_MESSAGES, 26 | Discord.Intents.FLAGS.GUILD_MESSAGE_REACTIONS, 27 | //Discord.Intents.FLAGS.GUILD_MESSAGE_TYPING, 28 | //Discord.Intents.FLAGS.DIRECT_MESSAGES, 29 | //Discord.Intents.FLAGS.DIRECT_MESSAGE_REACTIONS, 30 | //Discord.Intents.FLAGS.DIRECT_MESSAGE_TYPING 31 | ], 32 | presence: { 33 | activity: { 34 | name: `Music`, 35 | type: "LISTENING", 36 | }, 37 | status: "online" 38 | } 39 | }); 40 | //Define some Global Collections 41 | client.commands = new Discord.Collection(); 42 | client.cooldowns = new Discord.Collection(); 43 | client.slashCommands = new Discord.Collection(); 44 | client.aliases = new Discord.Collection(); 45 | client.categories = require("fs").readdirSync(`./commands`); 46 | //Require the Handlers Add the antiCrash file too, if its enabled 47 | ["events", "commands", "slashCommands", settings.antiCrash ? "antiCrash" : null] 48 | .filter(Boolean) 49 | .forEach(h => { 50 | require(`./handlers/${h}`)(client); 51 | }) 52 | //Start the Bot 53 | client.login(config.token) 54 | 55 | /** 56 | * @INFO 57 | * Bot Coded by Tomato#6966 | https://discord.gg/milrato 58 | * @INFO 59 | * Work for Milrato Development | https://milrato.eu 60 | * @INFO 61 | * Please mention Him / Milrato Development, when using this Code! 62 | * @INFO 63 | */ 64 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "v13musicbot", 3 | "version": "1.0.0", 4 | "description": "A Discord Music Bot built with latest Discord Voice Features", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "github.com/Tomato6966/v13-music-bot" 12 | }, 13 | "keywords": [ 14 | "Music", 15 | "Bot", 16 | "Discord", 17 | "Discord-jsv13", 18 | "v13", 19 | "js", 20 | "nodejs" 21 | ], 22 | "author": "Tomato6966", 23 | "license": "MIT", 24 | "dependencies": { 25 | "@discordjs/builders": "^0.6.0", 26 | "colors": "^1.4.0", 27 | "discord.js": "^13.1.0", 28 | "moment": "^2.29.1" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /slashCommands/Admin/embed.js: -------------------------------------------------------------------------------- 1 | const { MessageEmbed } = require("discord.js"); 2 | const config = require("../../botconfig/config.json"); 3 | const ee = require("../../botconfig/embed.json"); 4 | const settings = require("../../botconfig/settings.json"); 5 | module.exports = { 6 | name: "embed", //the command name for the Slash Command 7 | description: "Send a embed into the Chat", //the command description for Slash Command Overview 8 | cooldown: 5, 9 | memberpermissions: ["MANAGE_SERVER"], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 10 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 11 | alloweduserids: [], //Only allow specific Users to execute a Command [OPTIONAL] 12 | options: [ //OPTIONAL OPTIONS, make the array empty / dont add this option if you don't need options! 13 | //INFORMATIONS! You can add Options, but mind that the NAME MUST BE LOWERCASED! AND NO SPACES!!!, for the CHOCIES you need to add a array of arrays; [ ["",""] , ["",""] ] 14 | //{"Integer": { name: "ping_amount", description: "How many times do you want to ping?", required: true }}, //to use in the code: interacton.getInteger("ping_amount") 15 | {"String": { name: "title", description: "What should be the Embed title?", required: true }}, //to use in the code: interacton.getString("title") 16 | {"String": { name: "description", description: "What should be the Embed Description? [ +n+ = NewLine ]", required: true }}, //to use in the code: interacton.getString("description") 17 | {"String": { name: "color", description: "What should be the Embed Color?", required: false }}, //to use in the code: interacton.getString("color") 18 | //{"User": { name: "ping_a_user", description: "To Ping a user lol", required: false }}, //to use in the code: interacton.getUser("ping_a_user") 19 | {"Channel": { name: "in_where", description: "In What Channel should I send it?", required: false }}, //to use in the code: interacton.getChannel("what_channel") 20 | //{"Role": { name: "what_role", description: "To Ping a Role lol", required: false }}, //to use in the code: interacton.getRole("what_role") 21 | //{"IntChoices": { name: "what_ping", description: "What Ping do you want to get?", required: true, choices: [["Bot", 1], ["Discord Api", 2]] }}, //here the second array input MUST BE A NUMBER // TO USE IN THE CODE: interacton.getInteger("what_ping") 22 | //{"StringChoices": { name: "what_ping", description: "What Ping do you want to get?", required: true, choices: [["Bot", "botping"], ["Discord Api", "api"]] }}, //here the second array input MUST BE A STRING // TO USE IN THE CODE: interacton.getString("what_ping") 23 | 24 | ], 25 | run: async (client, interaction) => { 26 | try{ 27 | //console.log(interaction, StringOption) 28 | 29 | //things u can directly access in an interaction! 30 | const { member, channelId, guildId, applicationId, 31 | commandName, deferred, replied, ephemeral, 32 | options, id, createdTimestamp 33 | } = interaction; 34 | const { guild } = member; 35 | //let IntOption = options.getInteger("OPTIONNAME"); //same as in IntChoices //RETURNS NUMBER 36 | const EmbedTitle = options.getString("title"); //same as in StringChoices //RETURNS STRING 37 | const EmbedDescription = options.getString("description"); //same as in StringChoices //RETURNS STRING 38 | const EmbedColor = options.getString("color"); //same as in StringChoices //RETURNS STRING 39 | //let UserOption = options.getUser("OPTIONNAME"); //RETURNS USER OBJECT 40 | const ChannelOption = options.getChannel("in_where"); //RETURNS CHANNEL OBJECt 41 | //let RoleOption = options.getRole("OPTIONNAME"); //RETURNS ROLE OBJECT 42 | const channel = ChannelOption && ["GUILD_PRIVATE_THREAD ", "GUILD_PUBLIC_THREAD ", "GUILD_NEWS_THREAD ", "GUILD_NEWS", "GUILD_TEXT"].includes(ChannelOption.type) ? ChannelOption : guild.channels.cache.get(channelId); 43 | let embed = new MessageEmbed().setColor(EmbedColor ? EmbedColor : "BLURPLE") 44 | .setTitle(String(EmbedTitle).substr(0, 256)) 45 | .setDescription(String(EmbedDescription).substr(0, 2048).split("+n+").join("\n")) 46 | .setFooter(guild.name, guild.iconURL({dynamic: true})); 47 | //update it without a response! 48 | await interaction.reply({content: `Sending the Embed...`, ephemeral: true}); 49 | //SEND THE EMBED! 50 | await channel.send({embeds: [embed]}); 51 | //Edit the reply 52 | interaction.editReply({content: `✅ Embed sent!`, ephemeral: true}); 53 | } catch (e) { 54 | console.log(String(e.stack).bgRed) 55 | } 56 | } 57 | } 58 | /** 59 | * @INFO 60 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template 61 | * @INFO 62 | * Work for Milrato Development | https://milrato.eu 63 | * @INFO 64 | * Please mention Him / Milrato Development, when using this Code! 65 | * @INFO 66 | */ 67 | -------------------------------------------------------------------------------- /slashCommands/Admin/say.js: -------------------------------------------------------------------------------- 1 | const { MessageEmbed } = require("discord.js"); 2 | const config = require("../../botconfig/config.json"); 3 | const ee = require("../../botconfig/embed.json"); 4 | const settings = require("../../botconfig/settings.json"); 5 | module.exports = { 6 | name: "say", //the command name for the Slash Command 7 | description: "Send a Text into the Chat", //the command description for Slash Command Overview 8 | cooldown: 5, 9 | memberpermissions: ["MANAGE_SERVER"], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 10 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 11 | alloweduserids: [], //Only allow specific Users to execute a Command [OPTIONAL] 12 | options: [ //OPTIONAL OPTIONS, make the array empty / dont add this option if you don't need options! 13 | //INFORMATIONS! You can add Options, but mind that the NAME MUST BE LOWERCASED! AND NO SPACES!!!, for the CHOCIES you need to add a array of arrays; [ ["",""] , ["",""] ] 14 | //{"Integer": { name: "ping_amount", description: "How many times do you want to ping?", required: true }}, //to use in the code: interacton.getInteger("ping_amount") 15 | {"String": { name: "text", description: "What should I send? [ +n+ = Newline ]", required: true }}, //to use in the code: interacton.getString("title") 16 | //{"User": { name: "ping_a_user", description: "To Ping a user lol", required: false }}, //to use in the code: interacton.getUser("ping_a_user") 17 | {"Channel": { name: "in_where", description: "In What Channel should I send it?", required: false }}, //to use in the code: interacton.getChannel("what_channel") 18 | //{"Role": { name: "what_role", description: "To Ping a Role lol", required: false }}, //to use in the code: interacton.getRole("what_role") 19 | //{"IntChoices": { name: "what_ping", description: "What Ping do you want to get?", required: true, choices: [["Bot", 1], ["Discord Api", 2]] }}, //here the second array input MUST BE A NUMBER // TO USE IN THE CODE: interacton.getInteger("what_ping") 20 | //{"StringChoices": { name: "what_ping", description: "What Ping do you want to get?", required: true, choices: [["Bot", "botping"], ["Discord Api", "api"]] }}, //here the second array input MUST BE A STRING // TO USE IN THE CODE: interacton.getString("what_ping") 21 | 22 | ], 23 | run: async (client, interaction) => { 24 | try{ 25 | //console.log(interaction, StringOption) 26 | 27 | //things u can directly access in an interaction! 28 | const { member, channelId, guildId, applicationId, 29 | commandName, deferred, replied, ephemeral, 30 | options, id, createdTimestamp 31 | } = interaction; 32 | const { guild } = member; 33 | //let IntOption = options.getInteger("OPTIONNAME"); //same as in IntChoices //RETURNS NUMBER 34 | const Text = options.getString("text"); //same as in StringChoices //RETURNS STRING 35 | //let UserOption = options.getUser("OPTIONNAME"); //RETURNS USER OBJECT 36 | const ChannelOption = options.getChannel("in_where"); //RETURNS CHANNEL OBJECt 37 | //let RoleOption = options.getRole("OPTIONNAME"); //RETURNS ROLE OBJECT 38 | const channel = ChannelOption && ["GUILD_PRIVATE_THREAD ", "GUILD_PUBLIC_THREAD ", "GUILD_NEWS_THREAD ", "GUILD_NEWS", "GUILD_TEXT"].includes(ChannelOption.type) ? ChannelOption : guild.channels.cache.get(channelId); 39 | //update it without a response! 40 | await interaction.reply({content: `Sending the Message...`, ephemeral: true}); 41 | //SEND THE EMBED! 42 | await channel.send({content: String(Text).substr(0, 2000).split("+n+").join("\n")}); 43 | //Edit the reply 44 | interaction.editReply({content: `✅ Message sent!`, ephemeral: true}); 45 | } catch (e) { 46 | console.log(String(e.stack).bgRed) 47 | } 48 | } 49 | } 50 | /** 51 | * @INFO 52 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template 53 | * @INFO 54 | * Work for Milrato Development | https://milrato.eu 55 | * @INFO 56 | * Please mention Him / Milrato Development, when using this Code! 57 | * @INFO 58 | */ 59 | -------------------------------------------------------------------------------- /slashCommands/Info/ping.js: -------------------------------------------------------------------------------- 1 | const { MessageEmbed } = require("discord.js"); 2 | const config = require("../../botconfig/config.json"); 3 | const ee = require("../../botconfig/embed.json"); 4 | const settings = require("../../botconfig/settings.json"); 5 | module.exports = { 6 | name: "ping", //the command name for the Slash Command 7 | description: "Gives you information on how fast the Bot is", //the command description for Slash Command Overview 8 | cooldown: 1, 9 | memberpermissions: [], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 10 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 11 | alloweduserids: [], //Only allow specific Users to execute a Command [OPTIONAL] 12 | options: [ //OPTIONAL OPTIONS, make the array empty / dont add this option if you don't need options! 13 | //INFORMATIONS! You can add Options, but mind that the NAME MUST BE LOWERCASED! AND NO SPACES!!!, for the CHOCIES you need to add a array of arrays; [ ["",""] , ["",""] ] 14 | //{"Integer": { name: "ping_amount", description: "How many times do you want to ping?", required: true }}, //to use in the code: interacton.getInteger("ping_amount") 15 | //{"String": { name: "ping_amount", description: "How many times do you want to ping?", required: true }}, //to use in the code: interacton.getString("ping_amount") 16 | //{"User": { name: "ping_a_user", description: "To Ping a user lol", required: false }}, //to use in the code: interacton.getUser("ping_a_user") 17 | //{"Channel": { name: "what_channel", description: "To Ping a Channel lol", required: false }}, //to use in the code: interacton.getChannel("what_channel") 18 | //{"Role": { name: "what_role", description: "To Ping a Role lol", required: false }}, //to use in the code: interacton.getRole("what_role") 19 | //{"IntChoices": { name: "what_ping", description: "What Ping do you want to get?", required: true, choices: [["Bot", 1], ["Discord Api", 2]] }, //here the second array input MUST BE A NUMBER // TO USE IN THE CODE: interacton.getInteger("what_ping") 20 | {"StringChoices": { name: "what_ping", description: "What Ping do you want to get?", required: true, choices: [["Bot", "botping"], ["Discord Api", "api"]] }}, //here the second array input MUST BE A STRING // TO USE IN THE CODE: interacton.getString("what_ping") 21 | ], 22 | run: async (client, interaction) => { 23 | try{ 24 | //console.log(interaction, StringOption) 25 | 26 | //things u can directly access in an interaction! 27 | const { member, channelId, guildId, applicationId, 28 | commandName, deferred, replied, ephemeral, 29 | options, id, createdTimestamp 30 | } = interaction; 31 | const { guild } = member; 32 | //let IntOption = options.getInteger("OPTIONNAME"); //same as in IntChoices 33 | const StringOption = options.getString("what_ping"); //same as in StringChoices 34 | //let UserOption = options.getUser("OPTIONNAME"); 35 | //let ChannelOption = options.getChannel("OPTIONNAME"); 36 | //let RoleOption = options.getRole("OPTIONNAME"); 37 | 38 | if(StringOption == "botping") { 39 | await interaction.reply({content: `Getting the Bot Ping...`, ephemeral: true}); 40 | interaction.editReply({content: `Bot Ping: \`${Math.floor((Date.now() - createdTimestamp) - 2 * Math.floor(client.ws.ping))} ms\``, ephemeral: true}) 41 | } 42 | //Other Option is API so we are alright 43 | else { 44 | interaction.reply({content: `Api Ping: \`${Math.floor(client.ws.ping)} ms\``, ephemeral: true}) 45 | } 46 | } catch (e) { 47 | console.log(String(e.stack).bgRed) 48 | } 49 | } 50 | } 51 | /** 52 | * @INFO 53 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template 54 | * @INFO 55 | * Work for Milrato Development | https://milrato.eu 56 | * @INFO 57 | * Please mention Him / Milrato Development, when using this Code! 58 | * @INFO 59 | */ 60 | -------------------------------------------------------------------------------- /slashCommands/Info/userinfo.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const {MessageEmbed} = require("discord.js"); 3 | const config = require("../../botconfig/config.json"); 4 | var ee = require("../../botconfig/embed.json"); 5 | const moment = require('moment'); 6 | const flags = { 7 | DISCORD_EMPLOYEE: 'Discord Employee', 8 | DISCORD_PARTNER: 'Discord Partner', 9 | BUGHUNTER_LEVEL_1: 'Bug Hunter (Level 1)', 10 | BUGHUNTER_LEVEL_2: 'Bug Hunter (Level 2)', 11 | HYPESQUAD_EVENTS: 'HypeSquad Events', 12 | HOUSE_BRAVERY: 'House of Bravery', 13 | HOUSE_BRILLIANCE: 'House of Brilliance', 14 | HOUSE_BALANCE: 'House of Balance', 15 | EARLY_SUPPORTER: 'Early Supporter', 16 | TEAM_USER: 'Team User', 17 | SYSTEM: 'System', 18 | VERIFIED_BOT: 'Verified Bot', 19 | VERIFIED_DEVELOPER: 'Verified Bot Developer' 20 | }; 21 | function trimArray(arr, maxLen = 25) { 22 | if (Array.from(arr.values()).length > maxLen) { 23 | const len = Array.from(arr.values()).length - maxLen; 24 | arr = Array.from(arr.values()).sort((a, b) => b.rawPosition - a.rawPosition).slice(0, maxLen); 25 | arr.map(role => `<@&${role.id}>`) 26 | arr.push(`${len} more...`); 27 | } 28 | return arr.join(", "); 29 | } 30 | const statuses = { 31 | "online" : "🟢", 32 | "idle" : "🟠", 33 | "dnd" : "🔴", 34 | "offline" : "⚫️", 35 | } 36 | module.exports = { 37 | name: "userinfo", //the command name for the Slash Command 38 | description: "Gives you information about a User", //the command description for Slash Command Overview 39 | cooldown: 1, 40 | memberpermissions: [], //Only allow members with specific Permissions to execute a Commmand [OPTIONAL] 41 | requiredroles: [], //Only allow specific Users with a Role to execute a Command [OPTIONAL] 42 | alloweduserids: [], //Only allow specific Users to execute a Command [OPTIONAL] 43 | options: [ //OPTIONAL OPTIONS, make the array empty / dont add this option if you don't need options! 44 | //INFORMATIONS! You can add Options, but mind that the NAME MUST BE LOWERCASED! AND NO SPACES!!!, for the CHOCIES you need to add a array of arrays; [ ["",""] , ["",""] ] 45 | //{"Integer": { name: "ping_amount", description: "How many times do you want to ping?", required: true }}, //to use in the code: interacton.getInteger("ping_amount") 46 | //{"String": { name: "ping_amount", description: "How many times do you want to ping?", required: true }}, //to use in the code: interacton.getString("ping_amount") 47 | {"User": { name: "which_user", description: "From Which User do you want to get Information from?", required: false }}, //to use in the code: interacton.getUser("ping_a_user") 48 | //{"Channel": { name: "what_channel", description: "To Ping a Channel lol", required: false }}, //to use in the code: interacton.getChannel("what_channel") 49 | //{"Role": { name: "what_role", description: "To Ping a Role lol", required: false }}, //to use in the code: interacton.getRole("what_role") 50 | //{"IntChoices": { name: "what_ping", description: "What Ping do you want to get?", required: true, choices: [["Bot", 1], ["Discord Api", 2]] }, //here the second array input MUST BE A NUMBER // TO USE IN THE CODE: interacton.getInteger("what_ping") 51 | //{"StringChoices": { name: "what_ping", description: "What Ping do you want to get?", required: true, choices: [["Bot", "botping"], ["Discord Api", "api"]] }}, //here the second array input MUST BE A STRING // TO USE IN THE CODE: interacton.getString("what_ping") 52 | ], 53 | run: async (client, interaction) => { 54 | try{ 55 | //console.log(interaction, StringOption) 56 | 57 | //things u can directly access in an interaction! 58 | const { member, channelId, guildId, applicationId, 59 | commandName, deferred, replied, ephemeral, 60 | options, id, createdTimestamp 61 | } = interaction; 62 | const { guild } = member; 63 | //let IntOption = options.getInteger("OPTIONNAME"); //same as in IntChoices 64 | //const StringOption = options.getString("what_ping"); //same as in StringChoices 65 | let UserOption = options.getUser("which_user"); 66 | if(!UserOption) UserOption = member.user; 67 | //let ChannelOption = options.getChannel("OPTIONNAME"); 68 | //let RoleOption = options.getRole("OPTIONNAME"); 69 | try{ 70 | await guild.members.fetch(); 71 | const member = guild.members.cache.get(UserOption.id); 72 | const roles = member.roles; 73 | const userFlags = UserOption.flags.toArray(); 74 | const activity = UserOption.presence?.activities[0]; 75 | //create the EMBED 76 | const embeduserinfo = new MessageEmbed() 77 | embeduserinfo.setThumbnail(member.user.displayAvatarURL({ dynamic: true, size: 512 })) 78 | embeduserinfo.setAuthor("Information about: " + member.user.username + "#" + member.user.discriminator, member.user.displayAvatarURL({ dynamic: true }), "https://discord.gg/FQGXbypRf8") 79 | embeduserinfo.addField('**❱ Username:**',`<@${member.user.id}>\n\`${member.user.tag}\``,true) 80 | embeduserinfo.addField('**❱ ID:**',`\`${member.id}\``,true) 81 | embeduserinfo.addField('**❱ Avatar:**',`[\`Link to avatar\`](${member.user.displayAvatarURL({ format: "png" })})`,true) 82 | embeduserinfo.addField('**❱ Date Join DC:**', "\`"+moment(member.user.createdTimestamp).format("DD/MM/YYYY") + "\`\n" + "`"+ moment(member.user.createdTimestamp).format("hh:mm:ss") + "\`",true) 83 | embeduserinfo.addField('**❱ Date Join Guild:**', "\`"+moment(member.joinedTimestamp).format("DD/MM/YYYY") + "\`\n" + "`"+ moment(member.joinedTimestamp).format("hh:mm:ss")+ "\`",true) 84 | embeduserinfo.addField('**❱ Flags:**',`\`${userFlags.length ? userFlags.map(flag => flags[flag]).join(', ') : 'None'}\``,true) 85 | embeduserinfo.addField('**❱ Status:**',`\`${statuses[member.user.presence?.status]} ${member.user.presence?.status}\``,true) 86 | embeduserinfo.addField('**❱ Highest Role:**',`${member.roles.highest.id === guild.id ? 'None' : member.roles.highest}`,true) 87 | embeduserinfo.addField('**❱ Is a Bot:**',`\`${member.user.bot ? "✔️" : "❌"}\``,true) 88 | var userstatus = "Not having an activity"; 89 | if(activity){ 90 | if(activity.type === "CUSTOM_STATUS"){ 91 | let emoji = `${activity.emoji ? activity.emoji.id ? `<${activity.emoji.animated ? "a": ""}:${activity.emoji.name}:${activity.emoji.id}>`: activity.emoji.name : ""}` 92 | userstatus = `${emoji} \`${activity.state || 'Not having an acitivty.'}\`` 93 | } 94 | else{ 95 | userstatus = `\`${activity.type.toLowerCase().charAt(0).toUpperCase() + activity.type.toLowerCase().slice(1)} ${activity.name}\`` 96 | } 97 | } 98 | embeduserinfo.addField('**❱ Activity:**',`${userstatus}`) 99 | embeduserinfo.addField('**❱ Permissions:**',`${member.permissions.toArray().map(p=>`\`${p}\``).join(", ")}`) 100 | embeduserinfo.addField(`❱ [${roles.cache.size}] Roles: `, roles.cache.size < 25 ? Array.from(roles.cache.values()).sort((a, b) => b.rawPosition - a.rawPosition).map(role => `<@&${role.id}>`).join(', ') : roles.cache.size > 25 ? trimArray(roles.cache) : 'None') 101 | embeduserinfo.setColor(ee.color) 102 | embeduserinfo.setFooter(ee.footertext, ee.footericon) 103 | //send the EMBED 104 | interaction.reply({embeds: [embeduserinfo], ephemeral: true}) 105 | }catch (e){ 106 | console.log(e) 107 | const userFlags = UserOption.flags.toArray(); 108 | const activity = UserOption.presence?.activities[0]; 109 | //create the EMBED 110 | const embeduserinfo = new MessageEmbed() 111 | embeduserinfo.setThumbnail(UserOption.displayAvatarURL({ dynamic: true, size: 512 })) 112 | embeduserinfo.setAuthor("Information about: " + UserOption.username + "#" + UserOption.discriminator, UserOption.displayAvatarURL({ dynamic: true }), "https://discord.gg/FQGXbypRf8") 113 | embeduserinfo.addField('**❱ Username:**',`<@${UserOption.id}>\n\`${UserOption.tag}\``,true) 114 | embeduserinfo.addField('**❱ ID:**',`\`${UserOption.id}\``,true) 115 | embeduserinfo.addField('**❱ Avatar:**',`[\`Link to avatar\`](${UserOption.displayAvatarURL({ format: "png" })})`,true) 116 | embeduserinfo.addField('**❱ Flags:**',`\`${userFlags.length ? userFlags.map(flag => flags[flag]).join(', ') : 'None'}\``,true) 117 | embeduserinfo.addField('**❱ Status:**',`\`${statuses[UserOption.presence?.status]} ${UserOption.presence?.status}\``,true) 118 | embeduserinfo.addField('**❱ Is a Bot:**',`\`${UserOption.bot ? "✔️" : "❌"}\``,true) 119 | var userstatus = "Not having an activity"; 120 | if(activity){ 121 | if(activity.type === "CUSTOM_STATUS"){ 122 | let emoji = `${activity.emoji ? activity.emoji.id ? `<${activity.emoji.animated ? "a": ""}:${activity.emoji.name}:${activity.emoji.id}>`: activity.emoji.name : ""}` 123 | userstatus = `${emoji} \`${activity.state || 'Not having an acitivty.'}\`` 124 | } 125 | else{ 126 | userstatus = `\`${activity.type.toLowerCase().charAt(0).toUpperCase() + activity.type.toLowerCase().slice(1)} ${activity.name}\`` 127 | } 128 | } 129 | embeduserinfo.addField('**❱ Activity:**',`${userstatus}`) 130 | embeduserinfo.addField('**❱ Permissions:**',`${member.permissions.toArray().map(p=>`\`${p}\``).join(", ")}`) 131 | embeduserinfo.setColor(ee.color) 132 | embeduserinfo.setFooter(ee.footertext, ee.footericon) 133 | //send the EMBED 134 | interaction.reply({embeds: [embeduserinfo], ephemeral: true}) 135 | } 136 | } catch (e) { 137 | console.log(String(e.stack).bgRed) 138 | } 139 | } 140 | } 141 | /** 142 | * @INFO 143 | * Bot Coded by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template 144 | * @INFO 145 | * Work for Milrato Development | https://milrato.eu 146 | * @INFO 147 | * Please mention Him / Milrato Development, when using this Code! 148 | * @INFO 149 | */ 150 | --------------------------------------------------------------------------------