diff --git a/LICENSE b/LICENSE index 798964a..a612ad9 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,373 @@ -MIT License - -Copyright (c) 2020 nate - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/README.md b/README.md index faa280d..10907da 100644 --- a/README.md +++ b/README.md @@ -1,71 +1,120 @@

-🔑 ward +🔑 PristisVerify

-A Discord verification bot using reCAPTCHA v2. +Un bot de vérification Discord utilisant reCAPTCHA v2. +Complètement en français !

-## Requirements +## Fonctionnalités du bot PristisVerify -- [Node.js v16.9.0 or higher](https://nodejs.org/en/) -- [Google reCaptcha Key](https://www.google.com/recaptcha/admin/create) +

🟢 Traduction en français 100%
La version originale de Nates a été reprise par xb3n6e, modifiée et publiée par OxiWan.

-## Setup +### 1. **Vérification des utilisateurs via reCAPTCHA** + - Le bot utilise Google reCAPTCHA v2 pour vérifier que les nouveaux utilisateurs ne sont pas des robots. Lorsqu'un utilisateur rejoint le serveur, il reçoit un lien vers un formulaire reCAPTCHA à compléter. + - Une fois la vérification réussie, le bot attribue automatiquement un rôle "vérifié" à l'utilisateur. -- Rename your `config-example.js` file to `config.js` +### 2. **Gestion des rôles** + - **Attribution automatique du rôle vérifié** : Après avoir complété la vérification via reCAPTCHA, le bot attribue un rôle spécifique (défini dans la configuration) à l'utilisateur. + - **Suppression automatique d'un rôle** : Si activé dans la configuration (`removeRole: true`), le bot peut également retirer un rôle spécifique une fois que l'utilisateur est vérifié. + - **Rôle administrateur** : Un rôle administrateur peut être défini pour accorder des privilèges spéciaux aux administrateurs lors de certaines interactions avec le bot. -- Register your site with [reCaptcha](https://www.google.com/recaptcha/admin/create) with the domain you are currently using. If running locally, only put localhost on the domain area. ChoosereCAPTCHA v2 "I'm not a robot" for the reCaptcha Type, and copy the secret and public key into the config.js file. If you are using HTTPS, enable it in the config add your certificate and private key file with the names: `certificate.pem` and `private.pem`. +### 3. **Présence personnalisée du bot** + - Le bot peut afficher un statut personnalisé sur Discord, tel que "regarde les utilisateurs non vérifiés", "écoute", ou "en compétition". Le type de statut et le message peuvent être configurés dans le fichier `config.js`. + - **Types de statuts disponibles** : + - Jouer (PLAYING) + - Diffuser (STREAMING) + - Écouter (LISTENING) + - Regarder (WATCHING) + - Compétition (COMPETING) -- To run your own version on Repl.it, create a new project and click the `Import from Github` button and copy this repository url and paste it on the Repl.it site. +### 4. **Affichage des règles du serveur** + - Si activé (`rulesEnabled: true`), le bot peut envoyer un message contenant les règles du serveur aux nouveaux membres lorsqu'ils rejoignent. Ces règles sont présentées sous forme d'intégration (*embed*) avec un titre et une couleur personnalisables. + - Les utilisateurs doivent accepter ces règles avant de pouvoir continuer avec la vérification. + +### 5. **Système de gestion des liens d'invitation** + - Le bot peut fournir un lien d'invitation Discord personnalisé pour rejoindre le serveur, ce qui permet aux nouveaux utilisateurs d'accéder facilement au serveur pour commencer la vérification. + +### 6. **Serveur web intégré pour la vérification** + - Le bot inclut un petit serveur web qui gère les requêtes HTTP pour la vérification via reCAPTCHA. + - **HTTPS supporté** : Si activé, le serveur peut fonctionner en HTTPS avec des certificats SSL fournis par l'utilisateur (`certificate.pem` et `private.pem`). + - Les utilisateurs peuvent accéder à une page web où ils complètent le reCAPTCHA pour prouver qu'ils ne sont pas des robots. + +### 7. **Commandes slash personnalisées** + - Le bot utilise les commandes slash de Discord pour permettre aux administrateurs et aux utilisateurs d'interagir avec lui directement depuis l'interface Discord. + - **/verify** : Commande permettant aux utilisateurs de demander leur vérification manuellement. + - **/unverify** : Commande permettant aux utilisateurs de se dévérifier eux-mêmes si nécessaire. + - **/verifyembed** : Envoie une intégration avec un bouton de réaction ; lorsque l'utilisateur clique dessus, il reçoit automatiquement le rôle vérifié. + +### 8. **Journalisation avancée avec Signale** + - Le bot utilise la bibliothèque `Signale` pour journaliser les événements importants, comme : + - Les erreurs lors de l'attribution ou suppression des rôles. + - Les tentatives échouées d'envoi de messages privés (par exemple, si les DMs sont désactivés). + - Les actions réussies comme l'attribution du rôle vérifié ou la suppression d'un rôle. + - Chaque action critique est enregistrée dans la console avec différents niveaux de gravité (info, warning, error). + +### 9. **Anti-crash et gestion des erreurs** + - Le bot est équipé d'un système anti-crash pour capturer les erreurs non gérées et éviter qu'il ne plante : + - Gestion des exceptions non gérées (`uncaughtException`). + - Gestion des promesses rejetées non gérées (`unhandledRejection`). + - Cela garantit que le bot reste opérationnel même en cas d'erreurs inattendues. + + +## Prérequis + +- [Node.js v16.9.0 ou supérieur](https://nodejs.org/en/) +- [Clé Google reCaptcha](https://www.google.com/recaptcha/admin/create) + +## Configuration + +- Renommez votre fichier `config-example.js` en `config.js`. + +- Enregistrez votre site avec [reCaptcha](https://www.google.com/recaptcha/admin/create) en utilisant le domaine que vous utilisez actuellement. Si vous exécutez le bot en local, mettez simplement "localhost" dans la zone de domaine. Choisissez reCAPTCHA v2 "Je ne suis pas un robot" pour le type de reCaptcha, et copiez la clé secrète et la clé publique dans le fichier `config.js`. Si vous utilisez HTTPS, activez-le dans la configuration et ajoutez vos fichiers de certificat et de clé privée sous les noms : `certificate.pem` et `private.pem`. + +- Pour exécuter votre propre version sur Repl.it, créez un nouveau projet et cliquez sur le bouton `Importer depuis Github`, puis copiez l'URL de ce dépôt et collez-la sur le site Repl.it. + +- Voici à quoi ressemble le fichier de configuration et les éléments requis pour que le bot fonctionne correctement : -- Here is what the configuration file looks like and the things that are required for the bot to run. ```js +// Renommez-le en config.js ! module.exports = { - server: { - domain: "localhost", - https: false, - httpPort: 8080, - }, - - Discord: { - // —— Things that are required for the whole project to work. - token: "", // —— Your bot's token. - botId: "", // —— The bot's ID. - guildId: "", // —— The server ID on where the commands will be deployed. - verifiedRole: "", // —— Role that will be added to the user when they verify their account. - - // —— For users that want to have a role removed upon verification, if you want this, set remove-role to true, and set your remove role ID. - removeRole: false, - removeRoleId: "", - - // —— Set the bot's presence, for statusType see: https://discord-api-types.dev/api/discord-api-types-v10/enum/ActivityType - statusType: 3, // 1 (STREAMING), 2 (LISTENING), 3 (WATCHING), 5 (COMPETING). Default is 0 (PLAYING). - statusMsg: "unverified users!", - - // —— By default, rules are set to disabled, this means rules will be hidden. If you want to use the rules function, change disabled to your rules. Please ensure you use \n for each line break and do not use any symbols that could interfear with JSON. - rulesEnabled: true, - rules: "Type your rules here if rulesEnabled is enabled, ensure to use \n for new lines" - }, - - reCAPTCHA: { - secretKey: "", - publicKey: "" - } + "server": { + "domain": "server.example.com:00000", // Remplacez par votre domaine réel + "https": false, // Activez-le si vous utilisez HTTPS + "httpPort": 00000 // Remplacez par le port que vous souhaitez utiliser + }, + "Discord": { + "token": "", // Le token de votre bot Discord + "botId": "", // L'ID du bot + "guildId": "", // L'ID du serveur où les commandes seront déployées + "verifiedRole": "", // Le rôle qui sera attribué à l'utilisateur une fois vérifié + "discordinvite": "", // Lien d'invitation pour rejoindre le serveur Discord + "removeRole": true, // Si défini à true, un rôle sera retiré après vérification + "removeRoleId": "", // L'ID du rôle à retirer lors de la vérification + "adminRoleId": "", // L'ID du rôle administrateur (si nécessaire) + "statusType": 3, // Type de statut du bot (1: STREAMING, 2: LISTENING, 3: WATCHING, 5: COMPETING) + "statusMsg": "", // Message de statut personnalisé affiché par le bot + "status": "dnd", // Statut du bot (online, idle, dnd, invisible) + "rulesEnabled": true, // Active l'affichage des règles si défini à true + "rulestitle": "", // Titre des règles affichées dans un embed + "rulescolor": "#0099ff", // Couleur de l'encadré des règles (en hexadécimal) + "rules": "" // Texte des règles (utilisez \n pour les sauts de ligne) + }, + "reCAPTCHA": { + "secretKey": "", // Clé secrète reCAPTCHA obtenue via Google reCAPTCHA + "publicKey": "" // Clé publique reCAPTCHA utilisée pour afficher le widget sur le site + } } ``` -- Finished editing the files and ready to turn on your bot? run `npm start` in the bot folder. - -## Issues +- Une fois que vous avez terminé d'éditer les fichiers et que vous êtes prêt à lancer votre bot, exécutez `npm start` dans le dossier du bot. -**Not receiving a DM when joining my server** +## Problèmes -- If you are not receiving a DM when joining your server, Go to your Discord bot dashboard and enable both intents. Note: If your bot is more than 100 servers, you will have to verify your bot. +**Je ne reçois pas de message privé lorsque je rejoins mon serveur** -**Bot failing to login** +- Si vous ne recevez pas de message privé lorsque vous rejoignez votre serveur, allez sur le tableau de bord de votre bot Discord et activez les deux intentions (*intents*). Remarque : Si votre bot est sur plus de 100 serveurs, vous devrez vérifier votre bot. -- You must go to your Discord bot dashboard and enable both intents. Note: If your bot is more than 100 servers, you will have to verify your bot. +**Le bot échoue lors de la connexion** -## Preview -![Embed](https://i.imgur.com/zomEnpw.png) -![Website](https://i.imgur.com/tmrcyjF.png) +- Vous devez aller sur le tableau de bord de votre bot Discord et activer les deux intentions (*intents*). Remarque : Si votre bot est sur plus de 100 serveurs, vous devrez vérifier votre bot. diff --git a/assets/css/style.css b/assets/css/style.css index 84bdd4c..d3a883f 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -24,8 +24,15 @@ body { transform: translate(-50%, -50%); } -span { +p { + padding-top: 10%; font-size: 28px; font-weight: 400; color: white; -} \ No newline at end of file +} + +span { + font-size: 18px; + font-weight: 200; + color: gray; +} diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..4180c42 --- /dev/null +++ b/assets/js/main.js @@ -0,0 +1,5 @@ +window.onload = function() { + setTimeout(function() { + console.log("https://discord.gg/pristis"); + }, 4000); +}; \ No newline at end of file diff --git a/config-example.js b/config-example.js index 3cde51a..2c5bef8 100644 --- a/config-example.js +++ b/config-example.js @@ -1,32 +1,29 @@ +// Renomer le en config.js ! module.exports = { - server: { - domain: "localhost", - https: false, - httpPort: 8080, - }, - - Discord: { - // —— Things that are required for the whole project to work. - token: "", // —— Your bot's token. - botId: "", // —— The bot's ID. - guildId: "", // —— The server ID on where the commands will be deployed. - verifiedRole: "", // —— Role that will be added to the user when they verify their account. - - // —— For users that want to have a role removed upon verification, if you want this, set remove-role to true, and set your remove role ID. - removeRole: false, - removeRoleId: "", - - // —— Set the bot's presence, for statusType see: https://discord-api-types.dev/api/discord-api-types-v10/enum/ActivityType - statusType: 3, // 1 (STREAMING), 2 (LISTENING), 3 (WATCHING), 5 (COMPETING). Default is 0 (PLAYING). - statusMsg: "unverified users!", - - // —— By default, rules are set to disabled, this means rules will be hidden. If you want to use the rules function, change disabled to your rules. Please ensure you use \n for each line break and do not use any symbols that could interfear with JSON. - rulesEnabled: true, - rules: "Type your rules here if rulesEnabled is enabled, ensure to use \n for new lines" - }, - - reCAPTCHA: { - secretKey: "", - publicKey: "" - } -} + "server": { + "domain": "server.example.com:00000", + "https": false, + "httpPort": 00000 + }, + "Discord": { + "token": "", + "botId": "", + "guildId": "", + "verifiedRole": "", + "discordinvite": "", + "removeRole": true, + "removeRoleId": "", + "adminRoleId": "", + "statusType": 3, + "statusMsg": "", + "status": "dnd", + "rulesEnabled": true, + "rulestitle": "", + "rulescolor": "#0099ff", + "rules": "" + }, + "reCAPTCHA": { + "secretKey": "", + "publicKey": "" + }, +}; diff --git a/events/guildMemberAdd.js b/events/guildMemberAdd.js index 4525eb5..25f0190 100644 --- a/events/guildMemberAdd.js +++ b/events/guildMemberAdd.js @@ -1,38 +1,49 @@ - -// —— dot. -const { Signale } = require('signale'); -const { EmbedBuilder, ActionRowBuilder, ButtonBuilder } = require('discord.js'); -const logger = new Signale({ scope: 'Discord' }); -const config = require('../config.js'); -const pool = require('../pool.js'); - -module.exports = { - name: "guildMemberAdd", - - async execute(member) { - const domain = config.server.domain === 'localhost' ? `${config.server.domain}:${config.server.httpPort}` : `${config.server.domain}`; - if(config.Discord.rulesEnabled) { - const linkID = pool.createLink(member.id); - const captchaEmbed = new EmbedBuilder() - .setColor('#0099ff') - .setTitle('reCAPTCHA Verification') - .setDescription(`To gain access to this server you must solve a captcha. The link will expire in 15 minutes.\n${config.server.https ? 'https://' : 'http://'}${domain}/verify/${linkID}`) - - member.send({ embeds: [captchaEmbed] }).catch(() => { - logger.error(`Failed to send captcha to user! (Maybe they have DMs turned off?)`); - }); - - } else { - const linkID = pool.createLink(member.id); - const captchaEmbed = new EmbedBuilder() - .setColor('#0099ff') - .setTitle('reCAPTCHA Verification') - .setDescription(`To gain access to this server you must solve a captcha. The link will expire in 15 minutes.\n${config.server.https ? 'https://' : 'http://'}${domain}/verify/${linkID}`) - - member.send({ embeds: [captchaEmbed] }).catch(() => { - logger.error(`Failed to send captcha to user! (Maybe they have DMs turned off?)`); - }); - } - - }, -}; +const { Signale } = require('signale'); +const { EmbedBuilder, ActionRowBuilder, ButtonBuilder } = require('discord.js'); +const logger = new Signale({ scope: 'Discord' }); +const config = require('../config.js'); +const messages = require('../messages.js'); +const pool = require('../pool.js'); + +module.exports = { + name: "guildMemberAdd", + + async execute(member) { + const domain = config.server.domain === 'localhost' ? `${config.server.domain}:${config.server.httpPort}` : `${config.server.domain}`; + + if (config.Discord.rulesEnabled) { + const linkID = pool.createLink(member.id); + + const rulesEmbed = new EmbedBuilder() + .setColor(config.Discord.rulescolor) + .setTitle(config.Discord.rulestitle) + .setDescription(config.Discord.rules); + + const captchaEmbed = new EmbedBuilder() + .setColor(messages.verify.onjoin.captchaEmbed.color) + .setTitle(messages.verify.onjoin.captchaEmbed.title) + .setDescription(messages.verify.onjoin.captchaEmbed.description + `\n${config.server.https ? 'https://' : 'http://' }${domain}/verify/${linkID}`); + + member.send({ + content: messages.verify.onjoin.important, + embeds: [rulesEmbed, captchaEmbed] + }).catch(() => { + logger.error(`Échec de l'envoi du captcha à l'utilisateur ! (Peut-être que ses messages privés sont désactivés ?)`); + }); + + } else { + const linkID = pool.createLink(member.id); + const captchaEmbed = new EmbedBuilder() + .setColor(messages.verify.onjoin.captchaEmbed.color) + .setTitle(messages.verify.onjoin.captchaEmbed.title) + .setDescription(messages.verify.onjoin.captchaEmbed.description + `\n${config.server.https ? 'https://' : 'http://' }${domain}/verify/${linkID}`); + + member.send({ + content: messages.verify.onjoin.important, + embeds: [captchaEmbed] + }).catch(() => { + logger.error(`Échec de l'envoi du captcha à l'utilisateur ! (Peut-être que ses messages privés sont désactivés ?)`); + }); + } + }, +}; \ No newline at end of file diff --git a/events/interactionCreate.js b/events/interactionCreate.js deleted file mode 100644 index a46ae39..0000000 --- a/events/interactionCreate.js +++ /dev/null @@ -1,28 +0,0 @@ - -const { EmbedBuilder } = require('discord.js'); -const pool = require('../pool.js'); - -module.exports = { - name: "interactionCreate", - - async execute(interaction) { - - if(!interaction.isButton()) return; - if(interaction.customId === 'rules') { - logger.info('User agreed to the rules!'); - interaction.user.createDM().then(dm => { - dm.send("You have sucessfully agreed to rules.").catch(console.error); - const linkID = pool.createLink(interaction.user.id); - - const captchaEmbed = new EmbedBuilder() - .setColor('#0099ff') - .setTitle('reCAPTCHA Verification') - .setDescription(`To gain access to this server you must solve a captcha. The link will expire in 15 minutes.\n${config.https ? 'https://' : 'http://'}${config.domain}/verify/${linkID}`) - - dm.send({ embeds: [captchaEmbed] }).catch(() => { - logger.error(`Failed to send captcha to user! (Maybe they have DMs turned off?)`); - }); - }) - } - }, -}; \ No newline at end of file diff --git a/events/onReady.js b/events/onReady.js index b47897c..941b077 100644 --- a/events/onReady.js +++ b/events/onReady.js @@ -1,16 +1,22 @@ - -// —— dot. -const { Signale } = require('signale'); -const config = require('../config.js'); -const logger = new Signale({ scope: 'Discord' }); - -module.exports = { - name: "ready", - once: true, - - async execute(client) { - logger.success('Bot online!'); - client.user.setPresence({ activities: [{ type: config.Discord.statusType, name: `${config.Discord.statusMsg}` }], status: 'idle' }) - logger.success('Status Set!'); - }, +const { Signale } = require('signale'), +config = require('../config.js'), +logger = new Signale({ scope: 'Discord' }); + +module.exports = { + name: 'ready', + once: true, + async execute(client) { + logger.success(client.user.username + ' est en ligne !'); + + client.user.setPresence({ + activities: [{ + type: config.Discord.statusType, + name: '' + config.Discord.statusMsg, + }], + status: '' + config.Discord.status, + }); + + logger.success("Le statut de " + client.user.username + " a été activé !"); + logger.success("Le statut de " + client.user.username + " est : " + config.Discord.status + ' !'); + } }; \ No newline at end of file diff --git a/events/slashCreate.js b/events/slashCreate.js index cbac7fe..c776528 100644 --- a/events/slashCreate.js +++ b/events/slashCreate.js @@ -1,25 +1,23 @@ - -const { Signale } = require('signale'); -const logger = new Signale({ scope: 'Pool' }); - -module.exports = { - name: "interactionCreate", - - async execute(interaction) { - - const { client } = interaction; - if (!interaction.isChatInputCommand()) return; - - const command = client.slashCommands.get(interaction.commandName); - if (!command) return; - - try { - await command.execute(interaction); - } catch (err) { - logger.error(err); - await interaction.reply({ - content: "There was an issue while executing that command!", ephemeral: true, - }); - } - }, +const { Signale } = require('signale'), +logger = new Signale({ scope: 'slashCreate' }); + +module.exports = { + name: 'interactionCreate', + async execute(interaction) { + const { client } = interaction; + if (!interaction.isChatInputCommand()) return; + + const command = client.slashCommands.get(interaction.commandName); + if (!command) return; + + try { + await command.execute(interaction); + } catch (error) { + logger.error(error); + await interaction.reply({ + content: 'Il y a eu un problème lors de l\'exécution de cette commande !', + ephemeral: true + }); + } + } }; \ No newline at end of file diff --git a/html/invalidCaptcha.html b/html/invalidCaptcha.html index f722368..f1ca32b 100644 --- a/html/invalidCaptcha.html +++ b/html/invalidCaptcha.html @@ -1,18 +1,69 @@ - - Discord Verification - + X - Erreur - + +
- Invalid reCAPTCHA! +
+ + + +

Une erreur et survenue (ReCaptcha Error) merci de report cette erreur a X

+
+ \ No newline at end of file diff --git a/html/invalidLink.html b/html/invalidLink.html index e7c2fa9..ae0ada0 100644 --- a/html/invalidLink.html +++ b/html/invalidLink.html @@ -1,18 +1,69 @@ - - Discord Verification - + X - Erreur - + +
- Invalid link! +
+ + + +

Lien invalide

+
+ \ No newline at end of file diff --git a/html/logo.png b/html/logo.png new file mode 100644 index 0000000..c439365 Binary files /dev/null and b/html/logo.png differ diff --git a/html/style.scss b/html/style.scss new file mode 100644 index 0000000..eb10acc --- /dev/null +++ b/html/style.scss @@ -0,0 +1,60 @@ +$success__primary: #3DC480; +$success__secondary: #B8BABB; + +.success-message { + text-align: center; + + max-width: 500px; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} + +.success-message__icon { + max-width: 75px; +} + +.success-message__title { + color: $success__primary; + transform: translateY(25px); + opacity: 0; + transition: all 200ms ease; + + .active & { + transform: translateY(0); + opacity: 1; + } +} + +.success-message__content { + color: $success__secondary; + transform: translateY(25px); + opacity: 0; + transition: all 200ms ease; + transition-delay: 50ms; + + .active & { + transform: translateY(0); + opacity: 1; + } +} + +.icon-checkmark { + circle { + fill: $success__primary; + transform-origin: 50% 50%; + transform: scale(0); + transition: transform 200ms cubic-bezier(.22, .96, .38, .98); + } + path { + transition: stroke-dashoffset 350ms ease; + transition-delay: 100ms; + } + + .active & { + circle { + transform: scale(1); + } + } +} \ No newline at end of file diff --git a/html/valid.html b/html/valid.html index 9d7e5c9..2c80b7c 100644 --- a/html/valid.html +++ b/html/valid.html @@ -1,18 +1,79 @@ - - Discord Verification - + X - + +
- Verified! +
+ + + + +

Vérification réussi

+
\ No newline at end of file diff --git a/html/verify.html b/html/verify.html index 849def1..ba038e7 100644 --- a/html/verify.html +++ b/html/verify.html @@ -1,25 +1,22 @@ - - Discord Verification - + X - -
- +

Vérification:

+
-
- + +