├── .editorconfig ├── .eslintrc.json ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── package.json ├── src ├── core │ ├── EventLoader.js │ ├── settings.json.example │ └── utils.js └── ressources │ ├── Commands │ ├── antiinvite.js │ ├── avatar.js │ ├── ban.js │ ├── botlist.js │ ├── calc.js │ ├── cat.js │ ├── coin.js │ ├── cookie.js │ ├── cubs.js │ ├── donate.js │ ├── donators.js │ ├── eval.js │ ├── exec.js │ ├── facepalm.js │ ├── food.js │ ├── fox.js │ ├── goodbye.js │ ├── help.js │ ├── info.js │ ├── invite.js │ ├── joinlog.js │ ├── kick.js │ ├── lenny.js │ ├── love.js │ ├── modlist.js │ ├── neko.js │ ├── osu.js │ ├── painting.js │ ├── ping.js │ ├── prefix.js │ ├── punch.js │ ├── purge.js │ ├── reload.js │ ├── reverse.js │ ├── roll.js │ ├── say.js │ ├── serverinfo.js │ ├── shards.js │ ├── suport.js │ ├── tag.js │ ├── tagadd.js │ ├── tagdelete.js │ ├── taginfo.js │ ├── taglist.js │ ├── userinfo.js │ ├── weather.js │ ├── welcome.js │ ├── wolf.js │ └── yomama.js │ └── Events │ ├── debug.js │ ├── disconnect.js │ ├── error.js │ ├── guildCreate.js │ ├── guildDelete.js │ ├── guildMemberAdd.js │ ├── guildMemberRemove.js │ ├── message.js │ ├── ready.js │ └── warn.js ├── system-client.js └── system.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tab 5 | indent_size = 4 6 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "eslint:recommended", 3 | "env": { 4 | "node": true, 5 | "es6": true 6 | }, 7 | "globals": { 8 | "client": true, 9 | "system": true 10 | }, 11 | "parserOptions": { 12 | "ecmaVersion": 2017 13 | }, 14 | "rules": { 15 | "no-extra-parens": ["warn", "all", { 16 | "nestedBinaryExpressions": false 17 | }], 18 | "valid-jsdoc": ["warn", { 19 | "requireReturn": false, 20 | "requireReturnDescription": false, 21 | "preferType": { 22 | "String": "string", 23 | "Number": "number", 24 | "Boolean": "boolean", 25 | "Function": "function", 26 | "object": "Object", 27 | "date": "Date", 28 | "error": "Error" 29 | } 30 | }], 31 | 32 | "accessor-pairs": "warn", 33 | "array-callback-return": "error", 34 | "consistent-return": "error", 35 | "curly": ["error", "multi-line", "consistent"], 36 | "dot-location": ["error", "property"], 37 | "dot-notation": "error", 38 | "eqeqeq": "error", 39 | "no-empty-function": "error", 40 | "no-floating-decimal": "error", 41 | "no-implied-eval": "error", 42 | "no-invalid-this": "error", 43 | "no-lone-blocks": "error", 44 | "no-multi-spaces": "error", 45 | "no-new-func": "error", 46 | "no-new-wrappers": "error", 47 | "no-new": "error", 48 | "no-octal-escape": "error", 49 | "no-self-compare": "error", 50 | "no-sequences": "error", 51 | "no-throw-literal": "error", 52 | "no-unmodified-loop-condition": "error", 53 | "no-console": "off", 54 | "no-useless-call": "error", 55 | "no-useless-concat": "error", 56 | "no-useless-escape": "off", 57 | "no-void": "error", 58 | "no-warning-comments": "warn", 59 | "wrap-iife": "error", 60 | "yoda": "error", 61 | 62 | "no-label-var": "error", 63 | "no-shadow": "error", 64 | "no-undef-init": "error", 65 | 66 | "callback-return": "error", 67 | "handle-callback-err": "error", 68 | "no-mixed-requires": "error", 69 | "no-new-require": "error", 70 | "no-path-concat": "error", 71 | 72 | "array-bracket-spacing": "error", 73 | "block-spacing": "error", 74 | "brace-style": ["error", "1tbs", { "allowSingleLine": true }], 75 | "camelcase": "off", 76 | "comma-dangle": "error", 77 | "comma-spacing": "error", 78 | "comma-style": "error", 79 | "computed-property-spacing": "error", 80 | "consistent-this": "error", 81 | "eol-last": "error", 82 | "func-style": ["error", "declaration", { "allowArrowFunctions": true }], 83 | "id-length": ["error", { "exceptions": ["i", "j", "a", "b", "t", "r", "o", "c", "k"] }], 84 | "indent": ["error", "tab", { "SwitchCase": 1 }], 85 | "key-spacing": "error", 86 | "keyword-spacing": ["error", { 87 | "overrides": { 88 | "if": { "after": false }, 89 | "for": { "after": false }, 90 | "while": { "after": false }, 91 | "catch": { "after": false }, 92 | "switch": { "after": false } 93 | } 94 | }], 95 | "max-len": ["error", 200, 2], 96 | "max-nested-callbacks": ["error", { "max": 3 }], 97 | "max-statements-per-line": ["error", { "max": 2 }], 98 | "new-cap": "error", 99 | "no-array-constructor": "error", 100 | "no-lonely-if": "error", 101 | "no-mixed-operators": "error", 102 | "no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 1, "maxBOF": 0 }], 103 | "no-new-object": "error", 104 | "no-spaced-func": "error", 105 | "no-trailing-spaces": "error", 106 | "no-unneeded-ternary": "error", 107 | "no-whitespace-before-property": "error", 108 | "object-curly-newline": "error", 109 | "object-curly-spacing": ["error", "always"], 110 | "operator-assignment": "error", 111 | "operator-linebreak": ["error", "after"], 112 | "padded-blocks": ["error", "never"], 113 | "quotes": ["error", "double", { "allowTemplateLiterals": true, "avoidEscape": true }], 114 | "quote-props": ["error", "as-needed"], 115 | "semi-spacing": "error", 116 | "semi": "error", 117 | "space-before-blocks": "error", 118 | "space-in-parens": "error", 119 | "space-infix-ops": "error", 120 | "space-unary-ops": "error", 121 | "spaced-comment": "error", 122 | "unicode-bom": "error", 123 | 124 | "arrow-body-style": "error", 125 | "arrow-spacing": "error", 126 | "no-duplicate-imports": "error", 127 | "no-useless-computed-key": "error", 128 | "no-useless-constructor": "error", 129 | "prefer-arrow-callback": "error", 130 | "prefer-rest-params": "error", 131 | "prefer-spread": "error", 132 | "prefer-template": "error", 133 | "rest-spread-spacing": "error", 134 | "template-curly-spacing": "error", 135 | "yield-star-spacing": "error" 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | src/ressources/translation/** 2 | Setup/* 3 | node_modules/* 4 | src/core/settings.json 5 | Info.json 6 | src/ressources/working/** 7 | src/ressources/images/** 8 | **/logs 9 | .eslintrc 10 | .jshintrc 11 | npm-debug.log 12 | package-lock.json 13 | 14 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "7" 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # System-bot - Moderative and user-friendly discord bot using discord.js 2 | 3 | [![Greenkeeper badge](https://badges.greenkeeper.io/Shiigehiro/System-bot.svg?token=4cda8feba46805f098ce574cda41ff430925ada67e511c3ecc5987dce03c8d7d&ts=1519032704291)](https://greenkeeper.io/) 4 | [![GitHub license](https://img.shields.io/github/license/Shiigehiro/System-bot.svg)](https://github.com/Shiigehiro/System-bot) 5 | [![Servers badge](https://discordbots.org/api/widget/servers/226393343385403403.svg)](https://discordbots.org/bot/226393343385403403) 6 | [![Status badge](https://discordbots.org/api/widget/status/226393343385403403.svg)](https://discordbots.org/bot/226393343385403403) 7 | [![Donate](https://img.shields.io/badge/donate-patreon-red.svg)](https://www.patreon.com/Shiigehiro) 8 | 9 | 10 | [![ko-fi](https://www.ko-fi.com/img/donate_sm.png)](https://ko-fi.com/Q5Q6NFCC) 11 | 12 | ## Configuration 13 | 14 | * In the [settings.json.example](https://github.com/Computer-Man497/System-bot/blob/master/src/core/settings.json.example) You can find numerous settings which can be modified if you are going to self host. 15 | * They are pretty self-explanatory, but below are a few important ones. 16 | 17 | * **"token"**-This is your bot token which you can generate from [Discord Developer Portal](https://discordapp.com/developers) Remember to keep this a secret and don't share it on the web! 18 | 19 | ## Contributing 20 | 21 | * Open a ticket for each bug/feature so it can be discussed 22 | * Join [Discord server](https://discord.gg/wfTrpkg) for suggestion or support 23 | * Work on a new branch on your own fork 24 | * Open a PR that will be reviewed by a developer 25 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "system", 3 | "version": "2.24.0", 4 | "description": "Moderative and user-friendly discord bot", 5 | "main": "system.js", 6 | "dependencies": { 7 | "chalk": "^2.3.2", 8 | "colog": "^1.0.4", 9 | "curlrequest": "^1.0.1", 10 | "discord.js": "^11.3.2", 11 | "flip-text": "^1.1.0", 12 | "jimp": "^0.2.28", 13 | "mathjs": "^5.0.0", 14 | "moment": "^2.21.0", 15 | "mysql": "^2.15.0", 16 | "nodemailer": "^5.0.0", 17 | "performance-now": "^2.1.0", 18 | "pretty-ms": "^4.0.0", 19 | "querystring": "^0.2.0", 20 | "request": "^2.85.0", 21 | "superagent": "^4.0.0", 22 | "unirest": "^0.6.0", 23 | "weather-js": "^2.0.0", 24 | "winston": "^3.0.0", 25 | "xkcd-api": "^1.0.1", 26 | "xml2js": "^0.4.19" 27 | }, 28 | "scripts": { 29 | "test": "node system.js" 30 | }, 31 | "repository": "git+https://github.com/Shiigehiro/System-bot.git", 32 | "author": "Shiigehiro", 33 | "license": "AGPL-3.0", 34 | "bugs": { 35 | "url": "https://github.com/Shiigehiro/System-bot/issues" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/core/EventLoader.js: -------------------------------------------------------------------------------- 1 | const reqEvent = (event) => require(`../ressources/Events/${event}`); 2 | module.exports = client => { 3 | client.on("ready", () => reqEvent("ready")(client)); 4 | client.on("message", reqEvent("message")); 5 | client.on("guildCreate", reqEvent("guildCreate")); 6 | client.on("guildDelete", reqEvent("guildDelete")); 7 | client.on("guildMemberAdd", reqEvent("guildMemberAdd")); 8 | client.on("guildMemberRemove", reqEvent("guildMemberRemove")); 9 | client.on("debug", reqEvent("debug")); 10 | client.on("error", reqEvent("error")); 11 | client.on("warn", reqEvent("warn")); 12 | client.on("disconnect", reqEvent("disconnect")); 13 | }; 14 | -------------------------------------------------------------------------------- /src/core/settings.json.example: -------------------------------------------------------------------------------- 1 | { 2 | "token": "token", 3 | "osutoken": "token", 4 | "carbonitex": "token", 5 | "discordbot": "token", 6 | "dborg": "token", 7 | "discordbotfr": "token", 8 | "discordlist": "token", 9 | "mashape": "token", 10 | "datadog": { 11 | "user": "username", 12 | "pass": "password" 13 | }, 14 | "mysql": { 15 | "host": "localhost", 16 | "user": "user", 17 | "password": "pass", 18 | "database": "db" 19 | }, 20 | "guildhook": { 21 | "id":"hook_id", 22 | "token":"hook_token" 23 | }, 24 | "prefix": "$$", 25 | "ownerid": "138338704937713664", 26 | "author": "Shiigehiro#0164", 27 | "invite": "https://discordapp.com/oauth2/authorize?permissions=268954646&client_id=226393343385403403&scope=bot", 28 | "support": "https://discord.gg/wfTrpkg", 29 | "website": "https://shiigehiro.github.io/system/" 30 | } 31 | -------------------------------------------------------------------------------- /src/core/utils.js: -------------------------------------------------------------------------------- 1 | var system = module.exports = {}; 2 | var fs = require("fs"); 3 | var request = require("request"); 4 | var colog = require("colog"); 5 | var prettyMs = require("pretty-ms"); 6 | const Discord = require("discord.js"); 7 | 8 | system.update = {}; 9 | system.post = {}; 10 | 11 | system.DataDog = function(apiKey, applicationKey, opt_apiBaseUrl) { 12 | if(!opt_apiBaseUrl) opt_apiBaseUrl = "https://app.datadoghq.com"; 13 | 14 | this.apiBaseUrl = opt_apiBaseUrl; 15 | this.apiKey = apiKey; 16 | this.applicationKey = applicationKey; 17 | }; 18 | 19 | system.permission = function(permission) { 20 | var table = { 21 | 1: ["Nothing.", false], 22 | 2: ["NSFW channel.", "NSFW"], 23 | 3: ["Owner only.", "OWNER"], 24 | 4: ["Create instant invite.", "CREATE_INSTANT_INVITE"], 25 | 5: ["Kick members.", "KICK_MEMBERS"], 26 | 6: ["Ban members.", "BAN_MEMBERS"], 27 | 7: ["Administrator.", "ADMINISTRATOR"], 28 | 8: ["Manage channels.", "MANAGE_CHANNELS"], 29 | 9: ["Manage guild.", "MANAGE_GUILD"], 30 | 10: ["Add reaction.", "ADD_REACTIONS"], 31 | 11: ["Read messages.", "READ_MESSAGES"], 32 | 12: ["Send messages.", "SEND_MESSAGES"], 33 | 13: ["Send TTS messages.", "SEND_TTS_MESSAGES"], 34 | 14: ["Manage messages.", "MANAGE_MESSAGES"], 35 | 15: ["Embed links.", "EMBED_LINKS"], 36 | 16: ["Attach files.", "ATTACH_FILES"], 37 | 17: ["Read message history.", "READ_MESSAGE_HISTORY"], 38 | 18: ["Mention everyone.", "MENTION_EVERYONE"], 39 | 19: ["Use external emojis.", "EXTERNAL_EMOJIS"], 40 | 20: ["Connect.", "CONNECT"], 41 | 21: ["Speak.", "SPEAK"], 42 | 22: ["Mute members.", "MUTE_MEMBERS"], 43 | 23: ["Deafen members.", "DEAFEN_MEMBERS"], 44 | 24: ["Move members.", "MOVE_MEMBERS"], 45 | 25: ["Use VAD.", "USE_VAD"], 46 | 26: ["Change nickname.", "CHANGE_NICKNAME"], 47 | 27: ["Manage nickanmes.", "MANAGE_NICKNAMES"], 48 | 28: ["Manage roles.", "MANAGE_ROLES_OR_PERMISSIONS"], 49 | 29: ["Manage webhooks.", "MANAGE_WEBHOOKS"], 50 | 30: ["Manage emojis.", "MANAGE_EMOJIS"], 51 | 31: ["system developpers only.", "DEV"], 52 | 32: ["Donators only.", "BETA"] 53 | }; 54 | return table[permission]; 55 | }; 56 | 57 | system.log = function(message, type) { 58 | const color = { 59 | debug: "magenta", 60 | error: "red", 61 | warn: "yellow", 62 | info: "green" 63 | }[type]; 64 | colog.log(colog.color(`[${client.options.shardId}]`, "yellow") + colog.color(`[${type}]: ${message}`, color)); 65 | }; 66 | 67 | system.type = function(type) { 68 | var table = { 69 | 1: "Core", 70 | 2: "Moderative", 71 | 3: "Social", 72 | 4: "Fun", 73 | 5: "Utilities", 74 | 6: "NSFW" 75 | }; 76 | return table[type]; 77 | }; 78 | 79 | system.shortsend = function(channel, message, time) { 80 | if(!channel) return system.warn("No channel found!"); 81 | else if(!message) return system.warn("Try to send a blank message.."); 82 | else return channel.send(message).then(msg => msg.delete(time ? time : 5000)); 83 | }; 84 | 85 | system.uptime = function(now, start) { 86 | return prettyMs(now - start, { secDecimalDigits: 0 }); 87 | }; 88 | 89 | system.update.command = function() { 90 | var commands = []; 91 | client.commands.array().forEach(cmd => { 92 | if(system.permission(cmd.conf.permLevel)[1] !== "DEV") { 93 | commands.push({ 94 | name: `${client.settings.prefix}${cmd.help.name}`, 95 | args: cmd.help.usage, help: cmd.help.description, 96 | permission: system.permission(cmd.conf.permLevel)[0] 97 | }); 98 | } 99 | }); 100 | return commands; 101 | }; 102 | 103 | system.update.database = function() { 104 | client.guilds.forEach(element => { 105 | client.mysql.query(`SELECT * FROM guilds WHERE g_id = "${element.id}"`, (err, rows) => { 106 | if(err) return system.log(err, "error"); 107 | if(!rows[0]) { 108 | client.mysql.query("INSERT INTO guilds SET ?", { g_id: element.id, prefix: "$$" }); 109 | } 110 | return true; 111 | }); 112 | }); 113 | }; 114 | 115 | system.getUser = function(message, search) { 116 | let members = message.guild.members.filter(member => { 117 | if(member.user.username.toLowerCase().includes(search.toLowerCase())) return true; 118 | if(member.nickname && member.nickname.toLowerCase().includes(search.toLowerCase())) return true; 119 | if(member.id === search) return true; 120 | return false; 121 | }); 122 | 123 | if(members.last()) return members.last(); 124 | return false; 125 | }; 126 | 127 | system.findImage = function(folder) { 128 | if(!folder) return false; 129 | 130 | var pics = fs.readdirSync(`${process.cwd()}/src/ressources/images/${folder}/`); 131 | var rand = Math.floor(Math.random() * (pics.length - 1)); 132 | var ext = pics[rand].split(".")[1]; 133 | return [`${process.cwd()}/src/ressources/images/${folder}/${pics[rand]}`, ext]; 134 | }; 135 | 136 | system.updateGuild = function() { 137 | system.post.carbonitex(); 138 | system.post.discordbot(); 139 | system.post.discordlist(); 140 | system.post.dbl(); 141 | system.post.discordbotfr(); 142 | }; 143 | 144 | /* Datadog post */ 145 | system.DataDog.prototype.postSeries = function(series, callback) { 146 | request.post({ 147 | url: `${this.apiBaseUrl}/api/v1/series`, 148 | qs: { 149 | api_key: this.apiKey, 150 | application_key: this.applicationKey 151 | }, 152 | json: series 153 | }, callback); 154 | }; 155 | 156 | /* system POST DATA FUNCTION */ 157 | system.post.carbonitex = function() { 158 | client.shard.fetchClientValues("guilds.size").then(results => { 159 | request.post({ 160 | url: "https://www.carbonitex.net/discord/data/botdata.php", 161 | headers: { "content-type": "application/json" }, 162 | json: true, 163 | body: { 164 | key: client.settings.carbonitex, 165 | servercount: results.reduce((prev, val) => prev + val, 0), 166 | botname: client.user.username, 167 | logoid: client.user.avatar, 168 | botid: client.user.id, 169 | ownername: client.settings.author, 170 | ownerid: client.settings.ownerid 171 | } 172 | }, (err) => { 173 | if(err) system.log(err, "error"); 174 | }); 175 | }); 176 | }; 177 | 178 | system.post.discordlist = function() { 179 | client.shard.fetchClientValues("guilds.size").then(results => { 180 | request.post({ 181 | url: "https://bots.discordlist.net/api", 182 | headers: { "content-type": "application/json" }, 183 | json: true, 184 | body: { 185 | token: client.settings.discordlist, 186 | servers: results.reduce((prev, val) => prev + val, 0) 187 | } 188 | }, (err) => { 189 | if(err) system.log(err, "error"); 190 | }); 191 | }); 192 | }; 193 | 194 | system.post.discordbotfr = function() { 195 | client.shard.fetchClientValues("guilds.size").then(results => { 196 | request.post({ 197 | url: `https://discordbot.takohell.com/api/v1/bot/${client.user.id}`, 198 | headers: { 199 | "content-type": "application/json", 200 | Authorization: client.settings.discordbotfr 201 | }, 202 | json: true, 203 | body: { 204 | count: results.reduce((prev, val) => prev + val, 0), 205 | shard: client.options.shardCount 206 | } 207 | }, (err) => { 208 | if(err) system.log(err, "error"); 209 | }); 210 | }); 211 | }; 212 | 213 | system.post.dbl = function() { 214 | request.post({ 215 | url: `https://discordbots.org/api/bots/${client.user.id}/stats`, 216 | headers: { 217 | "content-type": "application/json", 218 | Authorization: client.settings.dbl 219 | }, 220 | json: true, 221 | body: { 222 | server_count: client.guilds.size, 223 | shard_id: client.options.shardId, 224 | shard_count: client.options.shardCount 225 | } 226 | }, (err) => { 227 | if(err) system.log(err, "error"); 228 | }); 229 | }; 230 | 231 | system.post.discordbot = function() { 232 | client.shard.fetchClientValues("guilds.size").then(results => { 233 | request.post({ 234 | url: `https://bots.discord.pw/api/bots/${client.user.id}/stats`, 235 | headers: { 236 | "content-type": "application/json", 237 | Authorization: client.settings.discordbot 238 | }, 239 | json: true, 240 | body: { server_count: results.reduce((prev, val) => prev + val, 0) } 241 | }, (err) => { 242 | if(err) system.log(err, "error"); 243 | }); 244 | }); 245 | }; 246 | 247 | system.post.datadog = function() { 248 | client.shard.fetchClientValues("guilds.size").then(guilds => { 249 | client.shard.fetchClientValues("channels.size").then(channels => { 250 | client.shard.fetchClientValues("users.size").then(users => { 251 | client.mysql.query(`SELECT * FROM stats WHERE function = "m_received"`, (err, rows) => { 252 | if(err) return system.log(err, "error"); 253 | client.mysql.query(`SELECT * FROM stats WHERE function = "c_received"`, (err2, rows2) => { 254 | if(err) return system.log(err, "error"); 255 | client.dd.postSeries({ 256 | series: [{ 257 | metric: "wolver.servers", 258 | points: [ 259 | [Date.now() / 1000, guilds.reduce((prev, val) => prev + val, 0)] 260 | ], 261 | type: "counter", 262 | tags: ["Wolver"] 263 | }, { 264 | metric: "wolver.channels", 265 | points: [ 266 | [Date.now() / 1000, channels.reduce((prev, val) => prev + val, 0)] 267 | ], 268 | type: "counter", 269 | tags: ["Wolver"] 270 | }, { 271 | metric: "wolver.users", 272 | points: [ 273 | [Date.now() / 1000, users.reduce((prev, val) => prev + val, 0)] 274 | ], 275 | type: "counter", 276 | tags: ["Wolver"] 277 | }, { 278 | metric: "wolver.messages", 279 | points: [ 280 | [Date.now() / 1000, rows[0].var] 281 | ], 282 | type: "counter", 283 | tags: ["Wolver"] 284 | }, { 285 | metric: "wolver.commands", 286 | points: [ 287 | [Date.now() / 1000, rows2[0].var] 288 | ], 289 | type: "counter", 290 | tags: ["Wolver"] 291 | }, { 292 | metric: "wolver.shardCount", 293 | points: [ 294 | [Date.now() / 1000, client.options.shardCount] 295 | ], 296 | type: "counter", 297 | tags: ["Wolver"] 298 | }] 299 | }); 300 | return true; 301 | }); 302 | return true; 303 | }); 304 | }); 305 | }); 306 | }); 307 | }; 308 | 309 | system.post.newguild = function(guild) { 310 | const hook = new Discord.WebhookClient(client.settings.guildhook.id, client.settings.guildhook.token); 311 | 312 | hook.sendMessage(`:white_check_mark: *${guild.name}* • owner: *${guild.owner.user.username}* • ${guild.members.filter(mb => mb.user.bot === false).size} users for ${guild.members.filter(mb => mb.user.bot === true).size - 1} bots`, { 313 | username: "system", 314 | avatarURL: client.user.avatarURL 315 | }); 316 | }; 317 | 318 | system.post.deleteguild = function(guild) { 319 | const hook = new Discord.WebhookClient(client.settings.guildhook.id, client.settings.guildhook.token); 320 | 321 | hook.sendMessage(`:no_entry: *${guild.name}* • Owner: *${guild.owner.user.username}* • ${guild.members.filter(mb => mb.user.bot === false).size} users for ${guild.members.filter(mb => mb.user.bot === true).size - 1} bots`, { 322 | username: "system", 323 | avatarURL: client.user.avatarURL 324 | }); 325 | }; 326 | 327 | system.post.messages = function() { 328 | client.mysql.query(`SELECT * FROM stats WHERE function = "m_received"`, (err, rows) => { 329 | if(err) return system.log(err, "error"); 330 | client.mysql.query(`UPDATE stats SET var = ${rows[0].var + client.messages} WHERE function = "m_received"`); 331 | client.messages = 0; 332 | return true; 333 | }); 334 | }; 335 | 336 | system.post.commands = function() { 337 | client.mysql.query(`SELECT * FROM stats WHERE function = "c_received"`, (err, rows) => { 338 | if(err) return system.log(err, "error"); 339 | client.mysql.query(`UPDATE stats SET var = ${rows[0].var + client.commands} WHERE function = "c_received"`); 340 | client.commands = 0; 341 | return true; 342 | }); 343 | }; 344 | -------------------------------------------------------------------------------- /src/ressources/Commands/antiinvite.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message) => { 2 | if(message.guild.antiinvite === undefined) { 3 | client.mysql.query(`SELECT * FROM antiinvite WHERE gID = '${message.guild.id}'`, (err, rows) => { 4 | if(err) return system.log(err, "error"); 5 | 6 | if(rows && rows[0]) { 7 | client.mysql.query(`DELETE FROM antiinvite WHERE sID = '${message.guild.id}'`); 8 | message.guild.antiinvite = 0; 9 | message.channel.send(":information_source: Anti-invite is now disabled!"); 10 | } else { 11 | client.mysql.query("INSERT INTO antiinvite SET ?", { sID: message.guild.id }); 12 | message.guild.antiinvite = 1; 13 | message.channel.send(":information_source: Anti-invite is now enabled!"); 14 | } 15 | return true; 16 | }); 17 | } else if(message.guild.antiinvite) { 18 | client.mysql.query(`DELETE FROM antiinvite WHERE sID = '${message.guild.id}'`); 19 | message.guild.antiinvite = 0; 20 | message.channel.send(":information_source: Anti-invite is now disabled!"); 21 | } else if(!message.guild.antiinvite) { 22 | client.mysql.query("INSERT INTO antiinvite SET ?", { sID: message.guild.id }); 23 | message.guild.antiinvite = 1; 24 | message.channel.send(":information_source: Anti-invite is now enabled!"); 25 | } 26 | }; 27 | 28 | exports.conf = { 29 | enabled: true, 30 | guildOnly: false, 31 | aliases: [], 32 | permLevel: 31, 33 | type: 2 34 | }; 35 | 36 | exports.help = { 37 | name: `antiinvite`, 38 | description: `Enable/Disable anti-invite.`, 39 | usage: `${client.settings.prefix}antiinvite` 40 | }; 41 | -------------------------------------------------------------------------------- /src/ressources/Commands/avatar.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message, args) => { 2 | let user = {}; 3 | if(message.mentions.users.first()) user = message.mentions.users.first(); 4 | else if(args && system.getUser(message, args)) user = system.getUser(message, args).user; 5 | else user = message.author; 6 | 7 | message.channel.send({ 8 | embed: { 9 | description: `Avatar of **${user.username}#${user.discriminator}**\nIf the image is not displayed, [click here](${user.avatarURL})`, 10 | image: { url: user.avatarURL }, 11 | color: 0xFFFFFF 12 | } 13 | }); 14 | }; 15 | 16 | exports.conf = { 17 | enabled: true, 18 | guildOnly: false, 19 | aliases: [], 20 | permLevel: 1, 21 | type: 2 22 | }; 23 | 24 | exports.help = { 25 | name: "avatar", 26 | description: "Show avatar.", 27 | usage: `${client.settings.prefix}avatar ` 28 | }; 29 | -------------------------------------------------------------------------------- /src/ressources/Commands/ban.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message) => { 2 | if(!message.guild.me.hasPermission("BAN_MEMBERS")) return system.shortsend(message.channel, `I need the \`Ban members\` permission for do that action.`); 3 | 4 | if(!message.mentions.users.first()) return system.shortsend(message.channel, `:warning: You need mention someone.`); 5 | 6 | message.mentions.users.map(u => { 7 | message.guild.member(u).ban({"reason": `Banned by ${message.author.username}#${message.author.discriminator}`, "days":1}); 8 | message.channel.send(`Banned **${u.username}**.`); 9 | }); 10 | return true; 11 | }; 12 | 13 | exports.conf = { 14 | enabled: true, 15 | guildOnly: false, 16 | aliases: [], 17 | permLevel: 6, 18 | type: 2 19 | }; 20 | 21 | exports.help = { 22 | name: `ban`, 23 | description: `Ban mentionned user.`, 24 | usage: `${client.settings.prefix}ban ` 25 | }; 26 | -------------------------------------------------------------------------------- /src/ressources/Commands/botlist.js: -------------------------------------------------------------------------------- 1 | const unirest = require("unirest"); 2 | 3 | const rightpad = (v, n, c = "0") => String(v).length >= n ? `${v}` : String(v) + String(c).repeat(n - String(v).length); 4 | const leftpad = (v, n, c = "0") => String(v).length >= n ? `${v}` : (String(c).repeat(n) + v).slice(-n); 5 | 6 | exports.run = (client, message, args) => { 7 | unirest.get("https://www.carbonitex.net/discord/api/listedbots").end(res => { 8 | let chunks = []; 9 | let bots = res.body.sort((a, b) => b.servercount - a.servercount); 10 | bots = bots.filter(b => b.servercount !== "0" && b.botid > 15); 11 | bots = bots.map(b => { 12 | b.name = b.name.replace(/[^a-z0-9]/gmi, "").replace(/\s+/g, ""); 13 | return b; 14 | }); 15 | while(bots.length > 0) chunks.push(bots.splice(0, 15)); 16 | let page = Math.min(Math.max(parseInt(args)), chunks.length) || 1; 17 | message.channel.send(`Page ${page}/${chunks.length}\n` + chunks[page - 1].map((b, i) => `[${leftpad(((page - 1) * 15) + (i + 1), 2)}] [${rightpad(b.name + "]", 25, " ")}${b.servercount} Servers`).join("\n"), { code: "xl" }); 18 | }); 19 | }; 20 | 21 | exports.conf = { 22 | enabled: true, 23 | guildOnly: false, 24 | aliases: [], 25 | permLevel: 1, 26 | type: 5 27 | }; 28 | 29 | exports.help = { 30 | name: `botlist`, 31 | description: `Carbonitex botlist.`, 32 | usage: `${client.settings.prefix}botlist [page]` 33 | }; 34 | -------------------------------------------------------------------------------- /src/ressources/Commands/calc.js: -------------------------------------------------------------------------------- 1 | var math = require("mathjs"); 2 | 3 | exports.run = (client, message, args) => { 4 | try { 5 | console.log(args); 6 | message.channel.send(math.eval(args)); 7 | } catch(err) { 8 | if(err) message.channel.send(`**${err.message}**`); 9 | } 10 | }; 11 | 12 | exports.conf = { 13 | enabled: true, 14 | guildOnly: false, 15 | aliases: [], 16 | permLevel: 1, 17 | type: 5 18 | }; 19 | 20 | exports.help = { 21 | name: `calc`, 22 | description: `Calculate something.`, 23 | usage: `${client.settings.prefix}calc ` 24 | }; 25 | -------------------------------------------------------------------------------- /src/ressources/Commands/cat.js: -------------------------------------------------------------------------------- 1 | var http = require("http"); 2 | 3 | exports.run = (client, message) => { 4 | http.get("http://random.cat/meow", (res) => { 5 | var body = ""; 6 | res.on("data", (chunk) => { 7 | body += chunk; 8 | }); 9 | res.on("end", () => { 10 | let output = JSON.parse(body); 11 | message.channel.send({ 12 | embed: { 13 | image: { url: output.file }, 14 | color: 0xFFFFFF 15 | } 16 | }); 17 | }); 18 | }); 19 | }; 20 | 21 | exports.conf = { 22 | enabled: true, 23 | guildOnly: false, 24 | aliases: [], 25 | permLevel: 1, 26 | type: 4 27 | }; 28 | 29 | exports.help = { 30 | name: `cat`, 31 | description: `Random cat pictures.`, 32 | usage: `${client.settings.prefix}cat` 33 | }; 34 | -------------------------------------------------------------------------------- /src/ressources/Commands/coin.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message) => { 2 | let coin = Math.round(Math.random() * 1); 3 | let flip = ["Heads !", "Tails !"]; 4 | message.channel.send({ 5 | embed: { 6 | description: flip[coin], 7 | header: { text: "Flip a coin" }, 8 | color: 0xFFFFFF 9 | } 10 | }); 11 | }; 12 | 13 | exports.conf = { 14 | enabled: true, 15 | guildOnly: false, 16 | aliases: [], 17 | permLevel: 1, 18 | type: 5 19 | }; 20 | 21 | exports.help = { 22 | name: `coin`, 23 | description: `Flip a coin.`, 24 | usage: `${client.settings.prefix}coin` 25 | }; 26 | -------------------------------------------------------------------------------- /src/ressources/Commands/cookie.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message, args) => { 2 | function sendCookie(channel, sender, receiver) { 3 | if(receiver.bot === true) return message.channel.send(`:cookie: • **${sender.username}** gave a cookie to **<@${receiver.id}>**.. Oh... You're alone ? I'm sorry for you Q_Q`); 4 | else if(receiver.id === sender.id) return message.channel.send(`:cookie: • Do you like your own cookies **<@${sender.id}>** ?`); 5 | else return message.channel.send(`:cookie: • **${sender.username}** gave a cookie to **<@${receiver.id}>**`); 6 | } 7 | 8 | if(message.mentions.users.first()) return sendCookie(message.channel, message.author, message.mentions.users.first()); 9 | else if(args && system.getUser(message, args)) return sendCookie(message.channel, message.author, system.getUser(message, args).user); 10 | else return message.channel.send(`Try with : \`$$cookie \``); 11 | }; 12 | 13 | exports.conf = { 14 | enabled: true, 15 | guildOnly: false, 16 | aliases: [], 17 | permLevel: 1, 18 | type: 4 19 | }; 20 | 21 | exports.help = { 22 | name: `cookie`, 23 | description: `Give a cookie to someone!`, 24 | usage: `${client.settings.prefix}cookie ` 25 | }; 26 | -------------------------------------------------------------------------------- /src/ressources/Commands/cubs.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message) => { 2 | var img = system.findImage("cubs"); 3 | message.channel.send({ 4 | file: { 5 | attachment: img[0], 6 | name: `photo.${img[1]}` 7 | } 8 | }); 9 | }; 10 | 11 | exports.conf = { 12 | enabled: true, 13 | guildOnly: false, 14 | aliases: [], 15 | permLevel: 1, 16 | type: 4 17 | }; 18 | 19 | exports.help = { 20 | name: `cubs`, 21 | description: `Random cubs pictures.`, 22 | usage: `${client.settings.prefix}cubs` 23 | }; 24 | -------------------------------------------------------------------------------- /src/ressources/Commands/donate.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message) => { 2 | message.author.send({ 3 | embed: { 4 | author: { name: `Make a donation!` }, 5 | description: ` 6 | Hi, i'm AkaNeko, the creator of System. 7 | 8 | I'm a student and maintaining this bot is not free, I need to pay the server, the domain for the website, and I'm not talking about the amount of time I'm spending on it everyday. 9 | I do not want to be paid to make money, i just need money to maintain my bot.\nIf you want to support me and my bot(s). I have Paypal and Patreon. 10 | 11 | Thanks you for all. Thanks you for use my bot and support me :3 :D 12 | 13 | You can pledge money on my Patreon (link below). All the donations are used for System and for improve it. 14 | All donation (>1$) will give something back like the donators role on the System Lounge (More information on the Patreon page). 15 | 16 | ======================= 17 | [Patreon](https://www.patreon.com/Shiigehiro) 18 | [Paypal](https://www.paypal.me/Shigehiro) 19 | [Support server invite](${client.settings.support}) 20 | =======================`, 21 | color: 0xFFFFFF 22 | } 23 | }); 24 | message.channel.send(":white_check_mark: I have sent my donation information to you through Direct Messages."); 25 | }; 26 | 27 | exports.conf = { 28 | enabled: true, 29 | guildOnly: false, 30 | aliases: [], 31 | permLevel: 1, 32 | type: 1 33 | }; 34 | 35 | exports.help = { 36 | name: `donate`, 37 | description: `Get my donation information.`, 38 | usage: `${client.settings.prefix}donate` 39 | }; 40 | -------------------------------------------------------------------------------- /src/ressources/Commands/donators.js: -------------------------------------------------------------------------------- 1 | const { RichEmbed } = require("discord.js"); 2 | 3 | const donators = [ 4 | { 5 | name: "Renard#9638", 6 | amount: "15.00" 7 | }, { 8 | name: "Pepit0Mc#5118", 9 | amount: "16.00" 10 | }, { 11 | name: "Emad", 12 | amount: "10.00" 13 | }, { 14 | name: "Werewolf#6101", 15 | amount: "8.40" 16 | }, { 17 | name: "Feuri#8528", 18 | amount: "5.10" 19 | }, { 20 | name: "Chomusuke", 21 | amount: "4.00" 22 | }, { 23 | name: "ShiiroNeko#0398", 24 | amount: "3.34" 25 | }, { 26 | name: "Loupio#0296", 27 | amount: "2.83" 28 | } 29 | ]; 30 | 31 | var txt = ""; 32 | donators.sort((a, b) => { 33 | return b.amount - a.amount; 34 | }).forEach(donator => { 35 | txt += `• ${donator.name} = ${donator.amount}$\n`; 36 | }); 37 | 38 | exports.run = (client, message) => { 39 | const embed = new RichEmbed() 40 | .setAuthor("Big thanks to:") 41 | .setDescription(txt) 42 | .setColor("#ffffff"); 43 | 44 | message.channel.send({ embed }); 45 | }; 46 | 47 | exports.conf = { 48 | enabled: true, 49 | guildOnly: false, 50 | aliases: [], 51 | permLevel: 1, 52 | type: 1 53 | }; 54 | 55 | exports.help = { 56 | name: `donators`, 57 | description: `Show all donators.`, 58 | usage: `${client.settings.prefix}donators` 59 | }; 60 | -------------------------------------------------------------------------------- /src/ressources/Commands/eval.js: -------------------------------------------------------------------------------- 1 | var now = require("performance-now"); 2 | exports.run = (client, message, args) => { 3 | const clean = text => { 4 | if(typeof text === "string") return text.replace(/`/g, `\`${String.fromCharCode(8203)}`).replace(/@/g, `@${String.fromCharCode(8203)}`); 5 | else return text; 6 | }; 7 | 8 | try { 9 | var t0 = now(); 10 | let evaled = eval(args); 11 | var t1 = now(); 12 | 13 | if(typeof evaled !== "string") evaled = require("util").inspect(evaled); 14 | 15 | message.channel.send({ 16 | embed: { 17 | description: `${clean(evaled)}`, 18 | footer: { text: `${(t1 - t0).toFixed(2)}ms` }, 19 | color: 0xE7A727 20 | } 21 | }); 22 | } catch(err) { 23 | message.channel.send(`\`ERROR\` \`\`\`xl\n${clean(err)}\n\`\`\``); 24 | } 25 | }; 26 | 27 | exports.conf = { 28 | enabled: true, 29 | guildOnly: false, 30 | aliases: [], 31 | permLevel: 31, 32 | type: 1 33 | }; 34 | 35 | exports.help = { 36 | name: `eval`, 37 | description: ``, 38 | usage: `${client.settings.prefix}eval ` 39 | }; 40 | -------------------------------------------------------------------------------- /src/ressources/Commands/exec.js: -------------------------------------------------------------------------------- 1 | var mail = require("nodemailer").mail; 2 | var exec = require("child_process").exec; 3 | 4 | exports.run = (client, message, args) => { 5 | exec(args, (err, stdout, stderr) => { 6 | if(stderr) return system.log(stderr, "error"); 7 | if(!err) message.channel.send(`\`\`\`bash\n${stdout}\n\`\`\``); 8 | 9 | return true; 10 | }); 11 | }; 12 | 13 | exports.conf = { 14 | enabled: true, 15 | guildOnly: false, 16 | aliases: [], 17 | permLevel: 31, 18 | type: 1 19 | }; 20 | 21 | exports.help = { 22 | name: `exec`, 23 | description: ``, 24 | usage: `${client.settings.prefix}exec ` 25 | }; 26 | -------------------------------------------------------------------------------- /src/ressources/Commands/facepalm.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message) => { 2 | var img = system.findImage("facepalm"); 3 | message.channel.send({ 4 | file: { 5 | attachment: img[0], 6 | name: `photo.${img[1]}` 7 | } 8 | }); 9 | }; 10 | 11 | exports.conf = { 12 | enabled: true, 13 | guildOnly: false, 14 | aliases: [], 15 | permLevel: 1, 16 | type: 4 17 | }; 18 | 19 | exports.help = { 20 | name: `facepalm`, 21 | description: `:facepalm:.`, 22 | usage: `${client.settings.prefix}facepalm` 23 | }; 24 | -------------------------------------------------------------------------------- /src/ressources/Commands/food.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message) => { 2 | var img = system.findImage("food"); 3 | message.channel.send({ 4 | file: { 5 | attachment: img[0], 6 | name: `photo.${img[1]}` 7 | } 8 | }); 9 | }; 10 | 11 | exports.conf = { 12 | enabled: true, 13 | guildOnly: false, 14 | aliases: [], 15 | permLevel: 1, 16 | type: 4 17 | }; 18 | 19 | exports.help = { 20 | name: `food`, 21 | description: `Random food pictures.`, 22 | usage: `${client.settings.prefix}food` 23 | }; 24 | -------------------------------------------------------------------------------- /src/ressources/Commands/fox.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message) => { 2 | var img = system.findImage("fox"); 3 | message.channel.send({ 4 | file: { 5 | attachment: img[0], 6 | name: `photo.${img[1]}` 7 | } 8 | }); 9 | }; 10 | 11 | exports.conf = { 12 | enabled: true, 13 | guildOnly: false, 14 | aliases: [], 15 | permLevel: 1, 16 | type: 4 17 | }; 18 | 19 | exports.help = { 20 | name: `fox`, 21 | description: `Random foxes pictures.`, 22 | usage: `${client.settings.prefix}fox` 23 | }; 24 | -------------------------------------------------------------------------------- /src/ressources/Commands/goodbye.js: -------------------------------------------------------------------------------- 1 | const Discord = require('discord.js'); 2 | 3 | exports.run = (client, message, args) => { 4 | client.mysql.query(`SELECT * FROM goodbye WHERE gID = '${message.guild.id}'`, function(err, rows) { 5 | var state = false; 6 | if (rows && rows[0]) state = true; 7 | 8 | const embed = new Discord.RichEmbed() 9 | .setColor('#fffffe') 10 | .setTitle('Choose an action !') 11 | .setDescription(`[A] ${state ? "Disable" : "Enable"} goodbye message\n${state ? "[B] Edit goodbye message\n[C] Test goodbye message" : ""}`); 12 | message.channel.send({ embed }).then(msg => { 13 | msg.react('🇦').then(em => { 14 | if (state) msg.react('🇧').then(em => { 15 | if (state) msg.react('🇨') 16 | }) 17 | }); 18 | const filter = (reaction, user) => (reaction.emoji.name === '🇦' || reaction.emoji.name === '🇧' || reaction.emoji.name === '🇨') && user.id === message.author.id 19 | const collector = msg.createReactionCollector(filter, { time: 15000 }); 20 | collector.on('collect', r => { 21 | if (r.emoji.name === "🇦") { 22 | if (state) { 23 | // If goodbye message is already enabled, disable it 24 | client.mysql.query(`DELETE FROM goodbye WHERE gID = '${message.guild.id}'`); 25 | } else { 26 | // If goodbye message isn't already enabled, enable it 27 | client.mysql.query(`INSERT INTO goodbye SET ?`, {gID: message.guild.id, cID: message.channel.id, message: ":cry: Goodbye **{{username}}**, see you later in **{{servername}}**"}); 28 | } 29 | const embed = new Discord.RichEmbed() 30 | .setColor('#fffffe') 31 | .setDescription(`Goodbye is now ${state ? 'disable' : 'enable'} in **#${message.channel.name}**`); 32 | 33 | message.channel.send({ embed }); 34 | msg.delete() 35 | collector.stop() 36 | } else if (r.emoji.name === "🇧") { 37 | const embed = new Discord.RichEmbed() 38 | .setColor('#fffffe') 39 | .setTitle('Edit goodbye message') 40 | .addField('Old goodbye message', rows[0].message) 41 | .addField('New goodbye message', "Type the new message"); 42 | message.channel.send({ embed }); 43 | 44 | const msg_filter = m => m.author.id === message.author.id && m.channel.id === message.channel.id; 45 | const msg_collector = message.channel.createMessageCollector(msg_filter, { time: 120000 }); 46 | msg_collector.on('collect', m => { 47 | msg.delete() 48 | const embed = new Discord.RichEmbed() 49 | .setColor('#fffffe') 50 | .setTitle(':white_check_mark: Message updated') 51 | .addField('New goodbye message', m.content); 52 | message.channel.send({ embed }); 53 | client.mysql.query(`UPDATE goodbye SET message = '${m.content}' WHERE gID = '${message.guild.id}'`) 54 | msg_collector.stop(); 55 | }); 56 | 57 | msg_collector.on('end', collected => {if (collected.size === 0) return message.channel.send(':x: Menu has closed due to inactivity.')}); 58 | collector.stop() 59 | } else if (r.emoji.name === "🇨") { 60 | msg.delete() 61 | goodbye = rows[0].message.split('{{user}}').join(`<@${message.author.id}>`).split('{{servername}}').join(message.guild.name).split('{{username}}').join(message.author.username); 62 | message.channel.send(goodbye); 63 | collector.stop() 64 | } 65 | }); 66 | 67 | collector.on('end', collected => {if (collected.size === 0) return message.channel.send(':x: Menu has closed due to inactivity.')}); 68 | }); 69 | }); 70 | }; 71 | 72 | exports.conf = { 73 | enabled: true, 74 | guildOnly: false, 75 | aliases: [], 76 | permLevel: 9, 77 | type: 2 78 | }; 79 | 80 | exports.help = { 81 | name: `goodbye`, 82 | description: `Add/Edit/Remove goodbye message.`, 83 | usage: `${client.settings.prefix}goodbye` 84 | }; 85 | -------------------------------------------------------------------------------- /src/ressources/Commands/help.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message, args) => { 2 | let types = { 3 | 1: "Core", 4 | 2: "Moderative", 5 | 3: "Social", 6 | 4: "Fun", 7 | 5: "Utilities", 8 | 6: "NSFW" 9 | }; 10 | let core = []; 11 | let moderative = []; 12 | let social = []; 13 | let fun = []; 14 | let utilities = []; 15 | let nsfw = []; 16 | if(!args) { 17 | for(var i = 0; i < client.commands.array().length; i++) { 18 | if(system.permission(client.commands.array()[i].conf.permLevel)[1] !== "DEV") { 19 | let type = client.commands.array()[i].conf.type; 20 | let name = client.commands.array()[i].help.name; 21 | if(type === 1) core.push(name); 22 | else if(type === 2) moderative.push(name); 23 | else if(type === 3) social.push(name); 24 | else if(type === 4) fun.push(name); 25 | else if(type === 5) utilities.push(name); 26 | else if(type === 6) nsfw.push(name); 27 | else return false; 28 | } 29 | } 30 | message.author.send({ 31 | embed: { 32 | fields: [ 33 | { name: "Core:", value: core.join(", "), inline: false }, 34 | { name: "Moderative:", value: moderative.join(", "), inline: false }, 35 | // { name: "Social:", value: social.join(", "), inline: false }, 36 | { name: "Fun:", value: fun.join(", "), inline: false }, 37 | { name: "Utilities:", value: utilities.join(", "), inline: false }, 38 | { name: "NSFW:", value: nsfw.join(", "), inline: false }, 39 | { name: "-------", value: `[Patreon](https://www.patreon.com/Shiigehiro)\n[Website](${client.settings.website})\n[Commands](${client.settings.website}/commands.html)\n[Invite](${client.settings.invite})\n[Support](${client.settings.support})`, inline: false } 40 | ], 41 | footer: { text: `Do ${client.settings.prefix}help for command usage.` }, 42 | color: 0xFEFCF9 43 | } 44 | }); 45 | message.channel.send("All commands have been sent, look in your DM."); 46 | } else if(args) { 47 | if(!client.commands.find(val => val.help.name === args)) return false; 48 | 49 | let info = client.commands.find(val => val.help.name === args); 50 | message.channel.send({ 51 | embed: { 52 | author: { name: `Command: ${types[info.conf.type]} > ${info.help.name}` }, 53 | fields: [{ 54 | name: "Description", 55 | value: info.help.description 56 | }, { 57 | name: "Usage", 58 | value: info.help.usage 59 | }] 60 | } 61 | }); 62 | } 63 | return true; 64 | }; 65 | 66 | exports.conf = { 67 | enabled: true, 68 | guildOnly: false, 69 | aliases: [], 70 | permLevel: 1, 71 | type: 1 72 | }; 73 | 74 | exports.help = { 75 | name: "help", 76 | description: "Show the commands list.", 77 | usage: `${client.settings.prefix}help [command]` 78 | }; 79 | -------------------------------------------------------------------------------- /src/ressources/Commands/info.js: -------------------------------------------------------------------------------- 1 | const { RichEmbed } = require("discord.js"); 2 | 3 | exports.run = (client, message) => { 4 | var unit = ["", "K", "M", "G", "T", "P"]; 5 | function bytesToSize(input, precision) { 6 | var index = Math.floor(Math.log(input) / Math.log(1024)); 7 | if(unit >= unit.length) return `${input} B`; 8 | return `${(input / Math.pow(1024, index)).toFixed(precision)} ${unit[index]}B`; 9 | } 10 | 11 | client.shard.fetchClientValues("guilds.size").then(guilds => { 12 | client.shard.fetchClientValues("channels.size").then(channels => { 13 | client.shard.fetchClientValues("users.size").then(users => { 14 | const embed = new RichEmbed() 15 | .setColor("#FFFFFE") 16 | .setDescription(`●▬▬ **${client.user.username} statistics** ▬▬●`) 17 | .addField("❯ Guilds", guilds.reduce((prev, val) => prev + val, 0), true) 18 | .addField("❯ Channels", channels.reduce((prev, val) => prev + val, 0), true) 19 | .addField("❯ Users", users.reduce((prev, val) => prev + val, 0), true) 20 | .addField("❯ RAM", bytesToSize(process.memoryUsage().rss, 3), true) 21 | .addField("❯ Links", `[Website](${client.settings.website})\n[Support](${client.settings.support})\n[Invite](${client.settings.invite})`, true) 22 | .setFooter(`© ${new Date().getFullYear()} ${client.settings.author}`) 23 | .setTimestamp(); 24 | message.channel.send({ embed }); 25 | }); 26 | }); 27 | }); 28 | }; 29 | 30 | exports.conf = { 31 | enabled: true, 32 | guildOnly: false, 33 | aliases: ["stats"], 34 | permLevel: 1, 35 | type: 1 36 | }; 37 | 38 | exports.help = { 39 | name: "info", 40 | description: "Show all statistics of the bot.", 41 | usage: `${client.settings.prefix}info` 42 | }; 43 | -------------------------------------------------------------------------------- /src/ressources/Commands/invite.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message) => { 2 | message.channel.send(`Click the following link to add me to your server: ${client.settings.invite}`); 3 | }; 4 | 5 | exports.conf = { 6 | enabled: true, 7 | guildOnly: false, 8 | aliases: [], 9 | permLevel: 1, 10 | type: 1 11 | }; 12 | 13 | exports.help = { 14 | name: `invite`, 15 | description: `Invite me in your server.`, 16 | usage: `${client.settings.prefix}invite` 17 | }; 18 | -------------------------------------------------------------------------------- /src/ressources/Commands/joinlog.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message) => { 2 | client.mysql.query(`SELECT * FROM guilds WHERE g_id = "${message.guild.id}"`, (err, rows) => { 3 | if(err) return system.log(err, "error"); 4 | 5 | if(rows[0].joinlog) { 6 | if(rows[0].joinlog === message.channel.id) { 7 | client.mysql.query(`UPDATE guilds SET joinlog = NULL WHERE g_id = "${message.guild.id}"`); 8 | message.channel.send(`Join log is now **disable** in this channel **${message.guild.channels.get(message.channel.id)}**.`); 9 | } else { 10 | client.mysql.query(`UPDATE guilds SET joinlog = "${message.channel.id}" WHERE g_id = "${message.guild.id}"`); 11 | message.channel.send(`Join log is now **disable** in the channel **${message.guild.channels.get(rows[0].joinlog)}**.`); 12 | message.channel.send(`Join log is now **enable** in this channel **${message.guild.channels.get(message.channel.id)}**.`); 13 | } 14 | } else { 15 | client.mysql.query(`UPDATE guilds SET joinlog = "${message.channel.id}" WHERE g_id = "${message.guild.id}"`); 16 | message.channel.send(`Join log is now **enable** in this channel **${message.guild.channels.get(message.channel.id)}**.`); 17 | } 18 | return true; 19 | }); 20 | }; 21 | 22 | exports.conf = { 23 | enabled: true, 24 | guildOnly: false, 25 | aliases: [], 26 | permLevel: 8, 27 | type: 2 28 | }; 29 | 30 | exports.help = { 31 | name: `joinlog`, 32 | description: `Enable/disable join-log.`, 33 | usage: `${client.settings.prefix}joinlog` 34 | }; 35 | -------------------------------------------------------------------------------- /src/ressources/Commands/kick.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message) => { 2 | if(!message.guild.me.hasPermission("KICK_MEMBERS")) return system.shortsend(message.channel, `I need the \`Kick members\` permission for do that action.`); 3 | 4 | if(!message.mentions.users.first()) return system.shortsend(message.channel, `:warning: You need mention someone.`); 5 | 6 | message.mentions.users.map(u => { 7 | message.guild.member(u).kick({"reason": `Kicked by ${message.author.username}#${message.author.discriminator}`}); 8 | message.channel.send(`Kicked **${u.username}**.`); 9 | }); 10 | return true; 11 | }; 12 | 13 | exports.conf = { 14 | enabled: true, 15 | guildOnly: false, 16 | aliases: [], 17 | permLevel: 5, 18 | type: 2 19 | }; 20 | 21 | exports.help = { 22 | name: `kick`, 23 | description: `Kick a user.`, 24 | usage: `${client.settings.prefix}kick ` 25 | }; 26 | -------------------------------------------------------------------------------- /src/ressources/Commands/lenny.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message) => { 2 | message.channel.send(`( ͡° ͜ʖ ͡°)`); 3 | }; 4 | 5 | exports.conf = { 6 | enabled: true, 7 | guildOnly: false, 8 | aliases: [], 9 | permLevel: 1, 10 | type: 4 11 | }; 12 | 13 | exports.help = { 14 | name: `lenny`, 15 | description: `( ͡° ͜ʖ ͡°)`, 16 | usage: `${client.settings.prefix}lenny` 17 | }; 18 | -------------------------------------------------------------------------------- /src/ressources/Commands/love.js: -------------------------------------------------------------------------------- 1 | var querystring = require("querystring"); 2 | var curl = require("curlrequest"); 3 | 4 | exports.run = (client, message) => { 5 | if(!message.mentions.users.first()) return message.channel.send(`You need mention someone`); 6 | 7 | var sname = message.mentions.users.array()[1] ? querystring.escape(message.mentions.users.array()[1].username) : querystring.escape(message.author.username); 8 | 9 | var options = { 10 | url: `https://love-calculator.p.mashape.com/getPercentage?fname=${querystring.escape(message.mentions.users.array()[0].username)}&sname=${sname}`, 11 | headers: { 12 | "X-Mashape-Key": client.settings.mashape, 13 | Accept: "application/json" 14 | } 15 | }; 16 | curl.request(options, (err, parts) => { 17 | if(err) return system.log(err, "error"); 18 | 19 | message.channel.send({ 20 | embed: { 21 | author: { name: `Love test - ${message.mentions.users.array()[0].username} X ${message.mentions.users.array()[1] ? message.mentions.users.array()[1].username : message.author.username}` }, 22 | description: `${JSON.parse(parts).result}\n**${JSON.parse(parts).percentage}** ❤️`, 23 | color: 0xFFFFFF 24 | } 25 | }); 26 | return true; 27 | }); 28 | return true; 29 | }; 30 | 31 | exports.conf = { 32 | enabled: true, 33 | guildOnly: false, 34 | aliases: [], 35 | permLevel: 1, 36 | type: 4 37 | }; 38 | 39 | exports.help = { 40 | name: `love`, 41 | description: `Love meter.`, 42 | usage: `${client.settings.prefix}love [user]` 43 | }; 44 | -------------------------------------------------------------------------------- /src/ressources/Commands/modlist.js: -------------------------------------------------------------------------------- 1 | const isStaff = (msg) => { 2 | let permissions = msg.permissions.serialize(); 3 | return permissions.KICK_MEMBERS || 4 | permissions.BAN_MEMBERS || 5 | permissions.ADMINISTRATOR || 6 | permissions.MANAGE_CHANNELS || 7 | permissions.MANAGE_GUILD || 8 | permissions.MANAGE_MESSAGES; 9 | }; 10 | 11 | const statusMap = { 12 | online: "<:online:313956277808005120>", 13 | streaming: "<:straming:313956277132853248>", 14 | idle: "<:away:313956277220802560>", 15 | dnd: "<:dnd:313956276893646850>", 16 | offline: "<:offline:313956277237710868>" 17 | }; 18 | 19 | const sortMap = { online: 1, idle: 2, streaming: 3, dnd: 4, offline: 5 }; 20 | 21 | const getStatus = (msg, map = true) => { 22 | let status = msg.guild.presences.get(msg.user.id) ? msg.guild.presences.get(msg.user.id).status : "offline"; 23 | return map ? statusMap[status] : status; 24 | }; 25 | 26 | exports.run = (client, message) => { 27 | let mods = message.guild.members.array().filter(msg => isStaff(msg) && !msg.user.bot).sort((a, b) => sortMap[getStatus(a, false)] > sortMap[getStatus(b, false)]); 28 | mods = mods.map(msg => `${getStatus(msg)} **${msg.user.username}#${msg.user.discriminator}**`); 29 | message.channel.send([`Moderators for **${message.guild.name}** :\n`].concat(mods)); 30 | }; 31 | 32 | exports.conf = { 33 | enabled: true, 34 | guildOnly: false, 35 | aliases: [], 36 | permLevel: 1, 37 | type: 5 38 | }; 39 | 40 | exports.help = { 41 | name: `modlist`, 42 | description: `List all servers moderators and their status.`, 43 | usage: `${client.settings.prefix}modlist` 44 | }; 45 | -------------------------------------------------------------------------------- /src/ressources/Commands/neko.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message) => { 2 | var img = system.findImage("neko"); 3 | message.channel.send({ 4 | file: { 5 | attachment: img[0], 6 | name: `photo.${img[1]}` 7 | } 8 | }); 9 | }; 10 | 11 | exports.conf = { 12 | enabled: true, 13 | guildOnly: false, 14 | aliases: [], 15 | permLevel: 1, 16 | type: 4 17 | }; 18 | 19 | exports.help = { 20 | name: `neko`, 21 | description: `Random neko pictures.`, 22 | usage: `${client.settings.prefix}neko` 23 | }; 24 | -------------------------------------------------------------------------------- /src/ressources/Commands/osu.js: -------------------------------------------------------------------------------- 1 | const { RichEmbed } = require("discord.js"); 2 | 3 | var mod = { 4 | "": "0", 5 | basic: "0", 6 | taiko: "1", 7 | CTB: "2", 8 | mania: "3" 9 | }; 10 | 11 | exports.run = (client, message, args) => { 12 | const embed = new RichEmbed() 13 | .setImage(`http://lemmmy.pw/osusig/sig.php?colour=hexffcc22&uname=${args.split(" ")[0]}&mode=${mod[args.split(" ")[1]]}&pp=0&flagshadow&flagstroke&darkheader&avatarrounding=4&onlineindicator=2&xpbar`); 14 | message.channel.send({ embed }); 15 | }; 16 | 17 | exports.conf = { 18 | enabled: true, 19 | guildOnly: false, 20 | aliases: [], 21 | permLevel: 1, 22 | type: 5 23 | }; 24 | 25 | exports.help = { 26 | name: `osu`, 27 | description: `Get osu account informations.`, 28 | usage: `${client.settings.prefix}osu [taiko|CTB|mania]` 29 | }; 30 | 31 | -------------------------------------------------------------------------------- /src/ressources/Commands/painting.js: -------------------------------------------------------------------------------- 1 | var Jimp = require("jimp"); 2 | 3 | exports.run = (client, message) => { 4 | if(message.mentions.users.first() && message.mentions.users.first().avatarURL) { 5 | var avatar = message.mentions.users.first().avatarURL; 6 | } else if(message.mentions.users.first()) { 7 | avatar = `${process.cwd()}/src/ressources/images/default.png`; 8 | } else if(message.author.avatarURL) { 9 | avatar = message.author.avatarURL; 10 | } else { 11 | avatar = `${process.cwd()}/src/ressources/images/default.png`; 12 | } 13 | 14 | Jimp.read(`${process.cwd()}/src/ressources/images/600x400white.jpg`, (err, lenna) => { 15 | if(err) return system.log(err, "error"); 16 | Jimp.read(avatar, (err, image) => { 17 | if(err) return system.log(err, "error"); 18 | image.resize(175, 135); 19 | lenna.composite(image, 213, 110); 20 | Jimp.read(`${process.cwd()}/src/ressources/images/tableau2.png`, (err, image2) => { 21 | if(err) return system.log(err, "error"); 22 | lenna.composite(image2, 0, 0); 23 | lenna.getBuffer(Jimp.MIME_PNG, (err, buffer) => { 24 | if(err) return system.log(err, "error"); 25 | message.channel.send({ 26 | file: { 27 | attachment: buffer, 28 | name: "image.png" 29 | } 30 | }); 31 | return true; 32 | }); 33 | return true; 34 | }); 35 | return true; 36 | }); 37 | return true; 38 | }); 39 | }; 40 | 41 | exports.conf = { 42 | enabled: true, 43 | guildOnly: false, 44 | aliases: [], 45 | permLevel: 1, 46 | type: 4 47 | }; 48 | 49 | exports.help = { 50 | name: `painting`, 51 | description: `Make a painting of you.`, 52 | usage: `${client.settings.prefix}painting [user]` 53 | }; 54 | -------------------------------------------------------------------------------- /src/ressources/Commands/ping.js: -------------------------------------------------------------------------------- 1 | const { RichEmbed } = require("discord.js"); 2 | 3 | exports.run = (client, message) => { 4 | let author = message.author; 5 | 6 | const embed = new RichEmbed() 7 | .setAuthor(author.username, author.avatarURL) 8 | .addField("Time of response", `${client.pings[0]} ms`) 9 | .setColor('#ffffff'); 10 | 11 | message.channel.send({ embed }); 12 | }; 13 | 14 | exports.conf = { 15 | enabled: true, 16 | guildOnly: false, 17 | aliases: [], 18 | permLevel: 1, 19 | type: 1 20 | }; 21 | 22 | exports.help = { 23 | name: "ping", 24 | description: "Pong.", 25 | usage: `${client.settings.prefix}ping` 26 | }; 27 | -------------------------------------------------------------------------------- /src/ressources/Commands/prefix.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message) => { 2 | let prefix = message.content.split(" ")[1]; 3 | if(!prefix) return system.shortsend(message.channel, `Try with : \`$$prefix [the prefix you want]\``); 4 | if(prefix.length > 20) return system.shortsend(message.channel, `Prefix can't contain more than 20 letters.`); 5 | 6 | client.mysql.query(`SELECT * FROM guilds WHERE g_id = ${message.guild.id}`, (err, rows) => { 7 | if(err) return system.log(err, "error"); 8 | 9 | client.mysql.query(`UPDATE guilds SET prefix = "${prefix}" WHERE g_id = ${message.guild.id}`); 10 | message.channel.send({ 11 | embed: { 12 | author: { name: `Prefix changed` }, 13 | description: `${rows[0].prefix} => ${prefix}`, 14 | color: 0xFFFFFF 15 | } 16 | }); 17 | return true; 18 | }); 19 | return true; 20 | }; 21 | 22 | exports.conf = { 23 | enabled: true, 24 | guildOnly: false, 25 | aliases: [], 26 | permLevel: 7, 27 | type: 2 28 | }; 29 | 30 | exports.help = { 31 | name: `prefix`, 32 | description: `Change the basic command prefix.`, 33 | usage: `${client.settings.prefix}prefix ` 34 | }; 35 | -------------------------------------------------------------------------------- /src/ressources/Commands/punch.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message, args) => { 2 | function punch(channel, sender, receiver) { 3 | var img = system.findImage("punch"); 4 | return channel.send(`<@${receiver.id}>, you got punched by **${sender.username}**`, { 5 | file: { 6 | attachment: img[0], 7 | name: `photo.${img[1]}` 8 | } 9 | }); 10 | } 11 | function selfpunch(channel, sender) { 12 | var img = system.findImage("punch_self"); 13 | 14 | return channel.send(`<@${sender.id}>, you got punched by **yourself**`, { 15 | file: { 16 | attachment: img[0], 17 | name: `photo.${img[1]}` 18 | } 19 | }); 20 | } 21 | 22 | if(message.mentions.users.first() && message.mentions.users.first().id === message.author.id) return selfpunch(message.channel, message.author); 23 | else if(message.mentions.users.first()) return punch(message.channel, message.author, message.mentions.users.first()); 24 | else if(args && system.getUser(message, args)) return punch(message.channel, message.author, system.getUser(message, args).user); 25 | else return message.channel.send(`Try with : \`$$punch \``); 26 | }; 27 | 28 | exports.conf = { 29 | enabled: true, 30 | guildOnly: false, 31 | aliases: [], 32 | permLevel: 1, 33 | type: 4 34 | }; 35 | 36 | exports.help = { 37 | name: `punch`, 38 | description: `Punch someone.`, 39 | usage: `${client.settings.prefix}punch ` 40 | }; 41 | -------------------------------------------------------------------------------- /src/ressources/Commands/purge.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message) => { 2 | if(!message.content.split(" ")[1]) return false; 3 | if(!Number.isInteger(Number(message.content.split(" ")[1]))) return false; 4 | let count = Number(message.content.split(" ")[1]); 5 | if(count < 2) return false; 6 | if(count > 99) count = 99; 7 | message.delete(); 8 | message.channel.bulkDelete(count + 1, true).then( 9 | system.shortsend(message.channel, `:ok_hand: ${message.content.split(" ")[1]} messages has been deleted.`) 10 | ).catch(err => { 11 | if(err.code === 10008) { 12 | return message.channel.send(":x: - A bot can only bulk delete messages that are under 14 days old."); 13 | } else { 14 | return system.log(err, "error"); 15 | } 16 | }); 17 | return true; 18 | }; 19 | 20 | exports.conf = { 21 | enabled: true, 22 | guildOnly: false, 23 | aliases: [], 24 | permLevel: 14, 25 | type: 2 26 | }; 27 | 28 | exports.help = { 29 | name: `purge`, 30 | description: `Delete x messages.`, 31 | usage: `${client.settings.prefix}purge ` 32 | }; 33 | -------------------------------------------------------------------------------- /src/ressources/Commands/reload.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message, args) => { 2 | let command; 3 | if(client.commands.has(args)) { 4 | command = args; 5 | } else if(client.aliases.has(args)) { 6 | command = client.aliases.get(args); 7 | } 8 | if(!command) { 9 | return message.channel.send(`I cannot find the command: ${args[0]}`); 10 | } else { 11 | message.channel.send(`Reloading: ${command}`).then(msg => { 12 | client.reload(command).then(() => { 13 | msg.edit(`Successfully reloaded: ${command}`); 14 | system.log(`Command reloaded: ${command}`, "debug"); 15 | }).catch(err => { 16 | msg.edit(`Command reload failed: ${command}\n\`\`\`${err.stack}\`\`\``); 17 | return system.log(err, "error"); 18 | }); 19 | }); 20 | } 21 | return true; 22 | }; 23 | 24 | exports.conf = { 25 | enabled: true, 26 | guildOnly: false, 27 | aliases: [`r`], 28 | permLevel: 31, 29 | type: 5 30 | }; 31 | 32 | exports.help = { 33 | name: `reload`, 34 | description: `Reloads the command file, if it\'s been updated or modified.`, 35 | usage: `${client.settings.prefix}reload ` 36 | }; 37 | -------------------------------------------------------------------------------- /src/ressources/Commands/reverse.js: -------------------------------------------------------------------------------- 1 | var flip = require("flip-text"); 2 | 3 | exports.run = (client, message, args) => { 4 | if(args) return message.channel.send(flip(args)); 5 | else return false; 6 | }; 7 | 8 | exports.conf = { 9 | enabled: true, 10 | guildOnly: false, 11 | aliases: [], 12 | permLevel: 1, 13 | type: 5 14 | }; 15 | 16 | exports.help = { 17 | name: `reverse`, 18 | description: `Reverse a text.`, 19 | usage: `${client.settings.prefix}reverse ` 20 | }; 21 | -------------------------------------------------------------------------------- /src/ressources/Commands/roll.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message) => { 2 | var spliter = message.content.split(" "); 3 | if(!spliter[1]) { 4 | var roll = Math.round(Math.random() * (100 - 0)) + 0; 5 | message.channel.send(`:game_die: rolled **${roll}** !`); 6 | } else if(typeof parseInt(spliter[1]) === "number") { 7 | roll = Math.round(Math.random() * (spliter[1] - 0)); 8 | if(isNaN(roll)) { 9 | message.channel.send("This is not number."); 10 | } else if(spliter[1] === "0") { 11 | message.channel.send("You can't make a roll with `max = 0`."); 12 | } else { 13 | message.channel.send(`:game_die: rolled **${roll}** !`); 14 | } 15 | } 16 | }; 17 | 18 | exports.conf = { 19 | enabled: true, 20 | guildOnly: false, 21 | aliases: [], 22 | permLevel: 1, 23 | type: 5 24 | }; 25 | 26 | exports.help = { 27 | name: `roll`, 28 | description: `Rolling.`, 29 | usage: `${client.settings.prefix}roll [max]` 30 | }; 31 | -------------------------------------------------------------------------------- /src/ressources/Commands/say.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message, args) => { 2 | message.channel.send({ 3 | embed: { 4 | author: { 5 | name: `${message.author.username}`, 6 | icon_url: message.author.avatarURL 7 | }, 8 | description: `${args}`, 9 | color: 0x337AB7 10 | } 11 | }).then(message.delete()); 12 | }; 13 | 14 | exports.conf = { 15 | enabled: true, 16 | guildOnly: false, 17 | aliases: [], 18 | permLevel: 1, 19 | type: 1 20 | }; 21 | 22 | exports.help = { 23 | name: `say`, 24 | description: `Make the bot say something.`, 25 | usage: `${client.settings.prefix}say ` 26 | }; 27 | -------------------------------------------------------------------------------- /src/ressources/Commands/serverinfo.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message) => { 2 | message.channel.send({ 3 | embed: { 4 | author: { name: `${message.guild.name}'s informations` }, 5 | fields: [{ 6 | name: "Name", 7 | value: message.guild.name, 8 | inline: true 9 | }, { 10 | name: "Owner", 11 | value: `${message.guild.owner.user.username}#${message.guild.owner.user.discriminator}`, 12 | inline: true 13 | }, { 14 | name: "ID", 15 | value: message.guild.id, 16 | inline: true 17 | }, { 18 | name: "Region", 19 | value: message.guild.region, 20 | inline: true 21 | }, { 22 | name: "Members", 23 | value: `${message.guild.members.filter(mb => mb.user.bot === false).size} users/${message.guild.members.filter(mb => mb.user.bot === true).size} bots`, 24 | inline: true 25 | }, { 26 | name: "Text Channels", 27 | value: message.guild.channels.findAll("type", "text").length, 28 | inline: true 29 | }, { 30 | name: "Voice Channels", 31 | value: message.guild.channels.findAll("type", "voice").length, 32 | inline: true 33 | }, { 34 | name: "Roles", 35 | value: `${message.guild.roles.size}`, 36 | inline: true 37 | }, { 38 | name: "Emojis", 39 | value: `${message.guild.emojis.size}`, 40 | inline: true 41 | }], 42 | thumbnail: { url: `${message.guild.iconURL ? message.guild.iconURL : ""}` }, 43 | color: 0xFFFFFF 44 | } 45 | }); 46 | }; 47 | 48 | exports.conf = { 49 | enabled: true, 50 | guildOnly: false, 51 | aliases: ["sinfo"], 52 | permLevel: 1, 53 | type: 5 54 | }; 55 | 56 | exports.help = { 57 | name: "serverinfo", 58 | description: "Server information.", 59 | usage: `${client.settings.prefix}serverinfo` 60 | }; 61 | -------------------------------------------------------------------------------- /src/ressources/Commands/shards.js: -------------------------------------------------------------------------------- 1 | var unit = ['', 'K', 'M', 'G', 'T', 'P']; 2 | function bytesToSize(input, precision) { 3 | var index = Math.floor(Math.log(input) / Math.log(1024)); 4 | if (unit >= unit.length) return input + ' B'; 5 | return (input / Math.pow(1024, index)).toFixed(precision) + ' ' + unit[index] + 'B'; 6 | }; 7 | 8 | exports.run = (client, message, args) => { 9 | var txt = ""; 10 | 11 | client.shard.broadcastEval(`process.memoryUsage().rss`).then(resp => { 12 | client.shard.fetchClientValues('guilds.size').then(guilds => { 13 | client.shard.fetchClientValues('channels.size').then(channels => { 14 | client.shard.fetchClientValues('users.size').then(users => { 15 | let shardsfields = []; 16 | for (var i=0;i { 2 | message.channel.send(`${client.settings.support}`); 3 | }; 4 | 5 | exports.conf = { 6 | enabled: true, 7 | guildOnly: false, 8 | aliases: [], 9 | permLevel: 1, 10 | type: 1 11 | }; 12 | 13 | exports.help = { 14 | name: `support`, 15 | description: `Join my home.`, 16 | usage: `${client.settings.prefix}support` 17 | }; 18 | -------------------------------------------------------------------------------- /src/ressources/Commands/tag.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message, args) => { 2 | if(!args.split(" ")[0]) { 3 | message.channel.send(":grey_question: $$tag \n:grey_question: $$tagadd \n:grey_question: $$tagdelete \n:grey_question: $$taglist\n:grey_question: $$taginfo "); 4 | } else { 5 | client.mysql.query(`SELECT * FROM tags WHERE g_id = "${message.guild.id}" AND name = "${args.split(" ")[0]}"`, (err, rows) => { 6 | if(err) return system.log(err, "error"); 7 | 8 | if(rows[0]) { 9 | var text = rows[0].content; 10 | text = text.split("{u-name}").join(message.author.username); 11 | text = text.split("{u-id}").join(message.author.id); 12 | text = text.split("{u-mention}").join(`<@${message.author.id}>`); 13 | text = text.split("{u-disc}").join(message.author.discriminator); 14 | text = text.split("{c-name}").join(message.channel.name); 15 | text = text.split("{c-id}").join(message.channel.id); 16 | text = text.split("{c-mention}").join(`#${message.channel.name}`); 17 | text = text.split("{c-topic}").join(message.channel.topic); 18 | message.channel.send(text); 19 | } 20 | return true; 21 | }); 22 | } 23 | }; 24 | 25 | exports.conf = { 26 | enabled: true, 27 | guildOnly: false, 28 | aliases: [], 29 | permLevel: 1, 30 | type: 5 31 | }; 32 | 33 | exports.help = { 34 | name: `tag`, 35 | description: `Show a tag.`, 36 | usage: `${client.settings.prefix}tag ` 37 | }; 38 | -------------------------------------------------------------------------------- /src/ressources/Commands/tagadd.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message, args) => { 2 | if(!args.split(" ")[1]) { 3 | return system.shortsend(message.channel, ":grey_question: $$tagadd "); 4 | } else { 5 | client.mysql.query(`SELECT * FROM tags WHERE g_id = "${message.guild.id}" AND name = "${args.split(" ")[0]}"`, (err, rows) => { 6 | if(err) system.log(err, "error"); 7 | if(rows[0]) { 8 | message.channel.send(":no_entry_sign: This tag already exist.").then(msg => msg.delete(7000)); 9 | } else { 10 | client.mysql.query("INSERT INTO tags SET ?", { 11 | g_id: message.guild.id, 12 | u_id: message.author.id, 13 | name: args.split(" ")[0], 14 | content: args.substr(args.split(" ")[0].length + 1), 15 | timestamp: message.createdTimestamp 16 | }); 17 | message.channel.send(`:white_check_mark: Tag \`${args.split(" ")[0]}\` successful created`).then(message.delete()); 18 | } 19 | }); 20 | } 21 | return true; 22 | }; 23 | 24 | exports.conf = { 25 | enabled: true, 26 | guildOnly: false, 27 | aliases: [], 28 | permLevel: 1, 29 | type: 5 30 | }; 31 | 32 | exports.help = { 33 | name: `tagadd`, 34 | description: `Create a tag.`, 35 | usage: `${client.settings.prefix}tagadd ` 36 | }; 37 | -------------------------------------------------------------------------------- /src/ressources/Commands/tagdelete.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message, args) => { 2 | if(!args.split(" ")[0]) { 3 | return system.shortsend(message.channel, `:grey_question: $$tagdelete `); 4 | } else { 5 | client.mysql.query(`SELECT * FROM tags WHERE g_id = "${message.guild.id}" AND name = "${args.split(" ")[0]}"`, (err, rows) => { 6 | if(err) return system.log(err, "error"); 7 | 8 | if(rows[0]) { 9 | if(rows[0].u_id === message.author.id || message.member.hasPermission("ADMINISTRATOR")) { 10 | client.mysql.query(`DELETE FROM tags WHERE g_id = "${message.guild.id}" AND name = "${args.split(" ")[0]}"`); 11 | message.channel.send(`:white_check_mark: Tag \`${args.split(" ")[0]}\` has been deleted !`).then(message.delete()); 12 | } else { 13 | return system.shortsend(message.channel, `:no_entry_sign: You are not the creator of this tag.`); 14 | } 15 | } else { 16 | return system.shortsend(message.channel, `:no_entry_sign: This tag doesn't exist.`); 17 | } 18 | return true; 19 | }); 20 | } 21 | return true; 22 | }; 23 | 24 | exports.conf = { 25 | enabled: true, 26 | guildOnly: false, 27 | aliases: [], 28 | permLevel: 1, 29 | type: 5 30 | }; 31 | 32 | exports.help = { 33 | name: `tagdelete`, 34 | description: `Delete a tag.`, 35 | usage: `${client.settings.prefix}tagdelete ` 36 | }; 37 | -------------------------------------------------------------------------------- /src/ressources/Commands/taginfo.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message, args) => { 2 | client.mysql.query(`SELECT * FROM tags WHERE g_id = "${message.guild.id}" AND name = "${args.split(' ')[0]}"`, function(err, rows, fields) { 3 | if (rows[0]) { 4 | message.channel.send(`Author of \`${args.split(' ')[0]}\` is **${client.users.get(rows[0].u_id) ? client.users.get(rows[0].u_id).username : "Unknown (**"+rows[0].u_id+"**)"}**`) 5 | } else { 6 | message.channel.send(`This tag doesn't exist.`); 7 | } 8 | }); 9 | }; 10 | 11 | exports.conf = { 12 | enabled: true, 13 | guildOnly: false, 14 | aliases: [], 15 | permLevel: 1, 16 | type: 5 17 | }; 18 | 19 | exports.help = { 20 | name: `taginfo`, 21 | description: `Info about a tag.`, 22 | usage: `${client.settings.prefix}taginfo ` 23 | }; 24 | -------------------------------------------------------------------------------- /src/ressources/Commands/taglist.js: -------------------------------------------------------------------------------- 1 | exports.run = (client, message, args) => { 2 | let tagtext = ''; 3 | client.mysql.query(`SELECT * FROM tags WHERE g_id = "${message.guild.id}"`, function(err, rows, fields) { 4 | for(var i=0;i', 3 | 'streaming': '<:straming:313956277132853248>', 4 | 'idle': '<:away:313956277220802560>', 5 | 'dnd': '<:dnd:313956276893646850>', 6 | 'offline': '<:offline:313956277237710868>' 7 | } 8 | const colorMap = { 9 | 'online': 0x157c13, 10 | 'streaming': 0x7c135a, 11 | 'idle': 0xdfb616, 12 | 'dnd': 0xab2317, 13 | 'offline': 0x000000 14 | }; 15 | 16 | exports.run = (client, m, args) => { 17 | function uinfo(channel, user, member) { 18 | channel.send({ 19 | embed: { 20 | author: {name: user.username+'\'s information'}, 21 | fields: [{ 22 | name: 'Username', 23 | value: user.username, 24 | inline: true 25 | }, { 26 | name: 'Nickname', 27 | value: member.nickname ? member.nickname : "None", 28 | inline: true 29 | },{ 30 | name: 'ID', 31 | value: user.id, 32 | inline: true 33 | },{ 34 | name: 'Discriminator', 35 | value: '#'+user.discriminator, 36 | inline: true 37 | },{ 38 | name: 'Status', 39 | value: statusMap[user.presence.status], 40 | inline: true 41 | },{ 42 | name: 'Playing', 43 | value: user.presence.game ? user.presence.game.name : "None", 44 | inline: true 45 | },{ 46 | name: 'Registered', 47 | value: new Date(user.createdAt).toISOString().replace(/T/, ' ').replace(/\..+/, ''), 48 | inline: true 49 | },{ 50 | name: 'Joined', 51 | value: new Date(member.joinedAt).toISOString().replace(/T/, ' ').replace(/\..+/, ''), 52 | inline: true 53 | }], 54 | thumbnail: { 55 | url: `${user.avatarURL ? user.avatarURL : ""}` 56 | }, 57 | color: colorMap[user.presence.status] 58 | } 59 | }); 60 | } 61 | 62 | if (m.mentions.users.first()) return uinfo(m.channel, m.mentions.users.first(), m.guild.member(m.mentions.users.first())) 63 | else if (args && system.getUser(m, args)) return uinfo(m.channel, system.getUser(m, args).user, system.getUser(m, args)) 64 | else return uinfo(m.channel, m.author, m.member); 65 | }; 66 | 67 | exports.conf = { 68 | enabled: true, 69 | guildOnly: false, 70 | aliases: ['uinfo'], 71 | permLevel: 1, 72 | type: 5 73 | }; 74 | 75 | exports.help = { 76 | name: 'userinfo', 77 | description: 'User information.', 78 | usage: `${client.settings.prefix}userinfo [user]` 79 | }; 80 | -------------------------------------------------------------------------------- /src/ressources/Commands/weather.js: -------------------------------------------------------------------------------- 1 | var weather = require('weather-js'); 2 | 3 | exports.run = (client, message, args) => { 4 | weather.find({search: args, degreeType: 'C'}, function(err, result) { 5 | if(err) console.log(err); 6 | //console.log(JSON.stringify(result, null, 2)); 7 | if (!result) return message.channel.send(`This city doesn't exist.`) 8 | if (!result[0]) return message.channel.send(`This city doesn't exist.`) 9 | message.channel.send({ 10 | embed: { 11 | thumbnail: { 12 | url: result[0].current.imageUrl 13 | }, 14 | title: ` - Currently - `, 15 | description: `Location : ${result[0].location.name}\nTemperature : ${result[0].current.temperature}°C\nHumidity : ${result[0].current.humidity}%\nWindspeed : ${result[0].current.windspeed}`, 16 | color: 0xFFFFFF 17 | } 18 | }); 19 | }); 20 | }; 21 | 22 | exports.conf = { 23 | enabled: true, 24 | guildOnly: false, 25 | aliases: [], 26 | permLevel: 1, 27 | type: 5 28 | }; 29 | 30 | exports.help = { 31 | name: `weather`, 32 | description: `Get the weather of a city.`, 33 | usage: `${client.settings.prefix}weather ` 34 | }; 35 | -------------------------------------------------------------------------------- /src/ressources/Commands/welcome.js: -------------------------------------------------------------------------------- 1 | const Discord = require('discord.js'); 2 | 3 | exports.run = (client, message, args) => { 4 | client.mysql.query(`SELECT * FROM welcome WHERE gID = '${message.guild.id}'`, function(err, rows) { 5 | var state = false; 6 | if (rows && rows[0]) state = true; 7 | 8 | const embed = new Discord.RichEmbed() 9 | .setColor('#fffffe') 10 | .setTitle('Choose an action !') 11 | .setDescription(`[A] ${state ? "Disable" : "Enable"} welcome message\n${state ? "[B] Edit welcome message\n[C] Test welcome message" : ""}`); 12 | message.channel.send({ embed }).then(msg => { 13 | msg.react('🇦').then(em => { 14 | if (state) msg.react('🇧').then(em => { 15 | if (state) msg.react('🇨') 16 | }) 17 | }); 18 | const filter = (reaction, user) => (reaction.emoji.name === '🇦' || reaction.emoji.name === '🇧' || reaction.emoji.name === '🇨') && user.id === message.author.id 19 | const collector = msg.createReactionCollector(filter, { time: 15000 }); 20 | collector.on('collect', r => { 21 | if (r.emoji.name === "🇦") { 22 | if (state) { 23 | // If welcome message is already enabled, disable it 24 | client.mysql.query(`DELETE FROM welcome WHERE gID = '${message.guild.id}'`); 25 | } else { 26 | // If welcome message isn't already enabled, enable it 27 | client.mysql.query(`INSERT INTO welcome SET ?`, {gID: message.guild.id, cID: message.channel.id, message: "<:welcome:408337102779056131> Welcome **{{user}}** in **{{servername}}** !"}); 28 | } 29 | const embed = new Discord.RichEmbed() 30 | .setColor('#fffffe') 31 | .setTitle(`Welcome is now ${state ? 'disable' : 'enable'} in **#${message.channel.name}**`); 32 | 33 | message.channel.send({embed}); 34 | msg.delete() 35 | collector.stop() 36 | } else if (r.emoji.name === "🇧") { 37 | const embed = new Discord.RichEmbed() 38 | .setColor('#fffffe') 39 | .setTitle('Edit welcome message') 40 | .addField('Old welcome message', rows[0].message) 41 | .addField('New welcome message', "Type the new message"); 42 | 43 | message.channel.send({embed}); 44 | const msg_filter = m => m.author.id === message.author.id && m.channel.id === message.channel.id 45 | const msg_collector = message.channel.createMessageCollector(msg_filter, { time: 120000 }); 46 | msg_collector.on('collect', m => { 47 | msg.delete() 48 | const embed = new Discord.RichEmbed() 49 | .setColor('#fffffe') 50 | .setTitle(':white_check_mark: Message updated') 51 | .addField('New welcome message', m.content); 52 | 53 | message.channel.send({embed}); 54 | client.mysql.query(`UPDATE welcome SET message = '${m.content}' WHERE gID = '${message.guild.id}'`) 55 | msg_collector.stop(); 56 | }); 57 | 58 | msg_collector.on('end', collected => {if (collected.size === 0) return message.channel.send(':x: Menu has closed due to inactivity.')}); 59 | collector.stop() 60 | } else if (r.emoji.name === "🇨") { 61 | msg.delete() 62 | welcome = rows[0].message.split('{{user}}').join(`<@${message.author.id}>`).split('{{servername}}').join(`${message.guild.name}`); 63 | message.channel.send(welcome); 64 | collector.stop() 65 | } 66 | }); 67 | 68 | collector.on('end', collected => {if (collected.size === 0) return message.channel.send(':x: Menu has closed due to inactivity.')}); 69 | }); 70 | }); 71 | }; 72 | 73 | exports.conf = { 74 | enabled: true, 75 | guildOnly: false, 76 | aliases: [], 77 | permLevel: 9, 78 | type: 2 79 | }; 80 | 81 | exports.help = { 82 | name: `welcome`, 83 | description: `Add/Edit/Remove welcome message.`, 84 | usage: `${client.settings.prefix}welcome` 85 | }; 86 | -------------------------------------------------------------------------------- /src/ressources/Commands/wolf.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | 3 | exports.run = (client, message, args) => { 4 | var img = system.findImage('wolf'); 5 | message.channel.send({ 6 | file: { 7 | attachment: img[0], 8 | name: `photo.${img[1]}` 9 | } 10 | }); 11 | }; 12 | 13 | exports.conf = { 14 | enabled: true, 15 | guildOnly: false, 16 | aliases: [], 17 | permLevel: 1, 18 | type: 4 19 | }; 20 | 21 | exports.help = { 22 | name: `wolf`, 23 | description: `Random wolves pictures.`, 24 | usage: `${client.settings.prefix}wolf` 25 | }; 26 | -------------------------------------------------------------------------------- /src/ressources/Commands/yomama.js: -------------------------------------------------------------------------------- 1 | var http = require('http') 2 | 3 | exports.run = (client, message, args) => { 4 | message.channel.startTyping(); 5 | var url = 'http://api.yomomma.info'; 6 | 7 | http.get(url, function(res){ 8 | var yomama = ''; 9 | res.on('data', function(chunk){ 10 | yomama += chunk; 11 | }); 12 | res.on('end', function(){ 13 | message.channel.send(JSON.parse(yomama).joke); 14 | message.channel.stopTyping(); 15 | }); 16 | }).on('error', function(e){ 17 | console.log("Got an error: ", e); 18 | }); 19 | }; 20 | 21 | exports.conf = { 22 | enabled: true, 23 | guildOnly: false, 24 | aliases: [], 25 | permLevel: 1, 26 | type: 4 27 | }; 28 | 29 | exports.help = { 30 | name: `yomama`, 31 | description: `Yomama joke.`, 32 | usage: `${client.settings.prefix}yomama` 33 | }; 34 | -------------------------------------------------------------------------------- /src/ressources/Events/debug.js: -------------------------------------------------------------------------------- 1 | module.exports = (info) => { 2 | if(info.startsWith("Authenticated using token")) return false; 3 | 4 | system.log(info, "debug"); 5 | return true; 6 | }; 7 | -------------------------------------------------------------------------------- /src/ressources/Events/disconnect.js: -------------------------------------------------------------------------------- 1 | module.exports = (event) => { 2 | system.log(event, "error"); 3 | }; 4 | -------------------------------------------------------------------------------- /src/ressources/Events/error.js: -------------------------------------------------------------------------------- 1 | module.exports = (error) => { 2 | system.log(error, "error"); 3 | }; 4 | -------------------------------------------------------------------------------- /src/ressources/Events/guildCreate.js: -------------------------------------------------------------------------------- 1 | module.exports = (guild) => { 2 | client.mysql.query(`SELECT * FROM guilds WHERE g_id = "${guild.id}"`, (err, rows) => { 3 | if(err) return system.log(err, "error"); 4 | 5 | if(!rows[0]) client.mysql.query("INSERT INTO guilds SET ?", { g_id: guild.id, prefix: "$$", levelup: "1" }); 6 | return true; 7 | }); 8 | system.updateGuild(); 9 | system.post.newguild(guild); 10 | 11 | system.log(`New guild : ${guild.name} (${guild.id})`, "info"); 12 | }; 13 | -------------------------------------------------------------------------------- /src/ressources/Events/guildDelete.js: -------------------------------------------------------------------------------- 1 | module.exports = (guild) => { 2 | client.mysql.query(`SELECT * FROM guilds WHERE g_id = "${guild.id}"`, (err, rows) => { 3 | if(err) return system.log(err, "error"); 4 | 5 | if(rows[0]) client.mysql.query(`DELETE FROM guilds WHERE g_id = "${guild.id}"`); 6 | return true; 7 | }); 8 | system.updateGuild(); 9 | system.post.deleteguild(guild); 10 | 11 | system.log(`Remove guild : ${guild.name} (${guild.id})`, "info"); 12 | }; 13 | -------------------------------------------------------------------------------- /src/ressources/Events/guildMemberAdd.js: -------------------------------------------------------------------------------- 1 | var moment = require("moment"); 2 | 3 | module.exports = (member) => { 4 | system.log(`New user ${member.user.username} in ${member.guild.name}(${member.guild.id})`, "info"); 5 | 6 | client.mysql.query(`SELECT * FROM guilds WHERE g_id = "${member.guild.id}"`, (err, rows) => { 7 | if(err) return system.log(err, "error"); 8 | 9 | if(rows && rows[0] && rows[0].joinlog && member.guild.channels.get(rows[0].joinlog)) { 10 | var logchannel = client.channels.get(rows[0].joinlog); 11 | logchannel.send({ 12 | embed: { 13 | author: { name: member.user.username, icon_url: member.user.avatarURL }, 14 | description: "New member.", 15 | timestamp: moment(), 16 | color: 0x00990d 17 | } 18 | }); 19 | } 20 | return true; 21 | }); 22 | client.mysql.query(`SELECT * FROM welcome WHERE gID = "${member.guild.id}"`, function(err, rows) { 23 | if (err) return system.log(err, "error"); 24 | 25 | if (rows && rows[0]) { 26 | console.log("welcomed !") 27 | var welcome = rows[0].message 28 | .split('{{servername}}') 29 | .join(member.guild.name) 30 | .split('{{user}}') 31 | .join(`<@${member.id}>`) 32 | .split('{{username}}') 33 | .join(member.user.username); 34 | 35 | member.guild.channels.get(rows[0].cID).send(welcome); 36 | } 37 | return true; 38 | }); 39 | 40 | if(member.guild.id === "229664634808958986") { 41 | member.addRole("241575048937340929"); 42 | } 43 | }; 44 | -------------------------------------------------------------------------------- /src/ressources/Events/guildMemberRemove.js: -------------------------------------------------------------------------------- 1 | var moment = require("moment"); 2 | 3 | module.exports = (member) => { 4 | system.log(`Remove user ${member.user.username} in ${member.guild.name}(${member.guild.id})`, "info"); 5 | 6 | client.mysql.query(`SELECT * FROM guilds WHERE g_id = "${member.guild.id}"`, (err, rows) => { 7 | if(err) return system.log(err, "error"); 8 | 9 | if(rows && rows[0] && rows[0].joinlog && member.guild.channels.get(rows[0].joinlog)) { 10 | var logchannel = client.channels.get(rows[0].joinlog); 11 | logchannel.send({ 12 | embed: { 13 | author: { name: member.user.username, icon_url: member.user.avatarURL }, 14 | description: "Remove member.", 15 | timestamp: moment(), 16 | color: 0xcc3333 17 | } 18 | }); 19 | } 20 | 21 | return true; 22 | }); 23 | client.mysql.query(`SELECT * FROM goodbye WHERE gID = "${member.guild.id}"`, function(err, rows) { 24 | if (err) return system.log(err, "error"); 25 | 26 | if (rows && rows[0]) { 27 | console.log("goodbyed !"); 28 | var goodbye = rows[0].message 29 | .split('{{servername}}') 30 | .join(member.guild.name) 31 | .split('{{user}}') 32 | .join(`<@${member.id}>`) 33 | .split('{{username}}') 34 | .join(member.user.username); 35 | 36 | member.guild.channels.get(rows[0].cID).send(goodbye); 37 | } 38 | return true; 39 | }); 40 | }; 41 | -------------------------------------------------------------------------------- /src/ressources/Events/message.js: -------------------------------------------------------------------------------- 1 | let lastcmd = {}; 2 | 3 | module.exports = message => { 4 | if(message.author.bot) return false; 5 | if(message.channel.type === "dm") { 6 | return message.channel.send("I do not respond to Direct Message.\nSo you can join my support for testing my commands ! :smile: https://discord.gg/wfTrpkg"); 7 | } 8 | if(!message.guild.member(client.user).hasPermission("SEND_MESSAGES")) return message.author.send(`I don"t have permission to send message here. Please ask an administrator.`); 9 | 10 | var patt = new RegExp("((http:\/\/)||(https://))(discord.gg/)"); 11 | if(patt.test(message.content) === true) { 12 | if(message.guild.id === "229664634808958986" && message.owner.id !== client.settings.ownerid) { 13 | message.delete(); 14 | message.channel.send(`<@${message.author.id}>, Sending invite is not allowed`); 15 | message.member.addRole("298499431081312256"); 16 | } 17 | } 18 | 19 | 20 | client.mysql.query(`SELECT * FROM guilds WHERE g_id = "${message.guild.id}"`, (err, rows) => { 21 | if(err) return system.log(err, "error"); 22 | 23 | if(rows && rows[0]) { 24 | if(rows[0].active === 0) { 25 | client.mysql.query(`UPDATE guilds SET active = 1 WHERE g_id = ${message.guild.id}`); 26 | } 27 | if(rows[0].prefix === "$$") var replace = "$$$"; 28 | else replace = rows[0].prefix; 29 | if(message.content.startsWith(`<@${client.user.id}>`)) message.content = message.content.replace(`<@${client.user.id}> `, replace); 30 | if(!message.content.startsWith(rows[0].prefix)) return false; 31 | let command = message.content.split(" ")[0].slice(rows[0].prefix.length); 32 | let params = message.content.split(" ").slice(1).join(" "); 33 | let cmd; 34 | 35 | if(client.commands.has(command)) { 36 | system.log(`[${message.guild.name}] ${command}`, "info"); 37 | cmd = client.commands.get(command); 38 | } else if(client.aliases.has(command)) { 39 | system.log(`[${message.guild.name}] ${command}`, "info"); 40 | cmd = client.commands.get(client.aliases.get(command)); 41 | } 42 | if(cmd) { 43 | if(lastcmd[message.author.id] && message.createdTimestamp - lastcmd[message.author.id] < 2000) return system.shortsend(message.channel, "Wait 2 seconds between your commands", 2000); 44 | lastcmd[message.author.id] = message.createdTimestamp; 45 | 46 | if(cmd.conf.type === 6 && !message.channel.nsfw) return system.shortsend(message.channel, "This command is not enable in this channel."); 47 | 48 | if(system.permission(cmd.conf.permLevel)[1] === "DEV" && message.author.id !== client.settings.ownerid) return false; 49 | 50 | if(system.permission(cmd.conf.permLevel)[1] === "DEV" && message.author.id === client.settings.ownerid) { 51 | cmd.run(client, message, params, rows[0]); 52 | } else if(system.permission(cmd.conf.permLevel)[1] === false || 53 | !system.permission(cmd.conf.permLevel)[1] || 54 | message.member.hasPermission(system.permission(cmd.conf.permLevel)[1])) { 55 | cmd.run(client, message, params, rows[0]); 56 | } else if(!message.member.hasPermission(system.permission(cmd.conf.permLevel)[1])) { 57 | system.shortsend(message.channel, `:x: - You need \`${system.permission(cmd.conf.permLevel)[1]}\` permission to do this.`); 58 | } 59 | } 60 | } else { 61 | client.mysql.query("INSERT INTO guilds SET ?", { g_id: message.guild.id, prefix: "$$" }); 62 | system.log("Need upgrade DB", "error"); 63 | } 64 | 65 | return true; 66 | }); 67 | 68 | return true; 69 | }; 70 | -------------------------------------------------------------------------------- /src/ressources/Events/ready.js: -------------------------------------------------------------------------------- 1 | module.exports = async (client) => { 2 | system.log("Shard started", "info"); 3 | 4 | 5 | setTimeout(() => { 6 | system.post.datadog(); 7 | }, 30000); 8 | 9 | setInterval(() => { 10 | system.updateGuild(); 11 | system.log("Stats send to bots list", "debug") 12 | }, 1800000); 13 | 14 | function rotateGames(i) { 15 | client.shard.fetchClientValues("guilds.size").then(results => { 16 | let games = [ 17 | ` Need Help ? ${client.settings.prefix}help`, 18 | ` with ${client.settings.author}`, 19 | ` in ${results.reduce((prev, val) => prev + val, 0)} servers` 20 | ]; 21 | 22 | if(i >= games.length) i = 0; 23 | client.user.setPresence({ 24 | status: "dnd", 25 | game: { 26 | name: games[i], 27 | type: "PLAYING" 28 | } 29 | }); 30 | }); 31 | 32 | setTimeout(() => { 33 | rotateGames(++i); 34 | }, 10000); 35 | } 36 | rotateGames(0); 37 | }; 38 | -------------------------------------------------------------------------------- /src/ressources/Events/warn.js: -------------------------------------------------------------------------------- 1 | module.exports = (info) => { 2 | system.log(info, "warn"); 3 | }; 4 | -------------------------------------------------------------------------------- /system-client.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const mysql = require("mysql"); 3 | const Discord = require("discord.js"); 4 | var mail = require("nodemailer").mail; 5 | 6 | global.client = new Discord.Client(); 7 | client.settings = require(`${__dirname}/src/core/settings.json`); 8 | global.system = require(`${__dirname}/src/core/utils.js`); 9 | require(`${__dirname}/src/core/EventLoader`)(client); 10 | 11 | client.mysql = mysql.createConnection({ 12 | host: client.settings.mysql.host, 13 | user: client.settings.mysql.user, 14 | password: client.settings.mysql.password, 15 | database: client.settings.mysql.database 16 | }); 17 | 18 | client.dd = new system.DataDog(client.settings.datadog.user, client.settings.datadog.pass); 19 | 20 | client.commands = new Discord.Collection(); 21 | client.aliases = new Discord.Collection(); 22 | fs.readdir(`${__dirname}/src/ressources/Commands/`, (err, files) => { 23 | if(err) console.error(err); 24 | files.forEach(file => { 25 | let props = require(`${__dirname}/src/ressources/Commands/${file}`); 26 | client.commands.set(props.help.name, props); 27 | props.conf.aliases.forEach(alias => { 28 | client.aliases.set(alias, props.help.name); 29 | }); 30 | }); 31 | }); 32 | 33 | client.reload = command => new Promise((resolve, reject) => { 34 | try { 35 | delete require.cache[require.resolve(`${__dirname}/src/ressources/Commands/${command}`)]; 36 | let cmd = require(`${__dirname}/src/ressources/Commands/${command}`); 37 | client.commands.delete(command); 38 | client.aliases.forEach((cmd, alias) => { 39 | if(cmd === command) client.aliases.delete(alias); 40 | }); 41 | client.commands.set(command, cmd); 42 | cmd.conf.aliases.forEach(alias => { 43 | client.aliases.set(alias, cmd.help.name); 44 | }); 45 | resolve(); 46 | } catch(err) { 47 | reject(err); 48 | } 49 | }); 50 | 51 | process.on("unhandledRejection", err => { 52 | if(err.stack.indexOf("Still spawning shards.") > -1) return; 53 | system.log(err.stack, "error"); 54 | }); 55 | 56 | client.login(client.settings.token); 57 | -------------------------------------------------------------------------------- /system.js: -------------------------------------------------------------------------------- 1 | console.log("\x1Bc"); 2 | 3 | const Discord = require("discord.js"); 4 | const sharder = new Discord.ShardingManager(`${__dirname}/system-client.js`, { totalShards: 4, respawn: true }); 5 | 6 | sharder.spawn(4); 7 | --------------------------------------------------------------------------------