forked from chalda/DiscordBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/chalda/DiscordBot into ch…
…alda-master
- Loading branch information
Showing
35 changed files
with
7,891 additions
and
1,294 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"useTabs": false, // Indent lines with tabs instead of spaces. | ||
"printWidth": 80, // Specify the length of line that the printer will wrap on. | ||
"tabWidth": 4, // Specify the number of spaces per indentation-level. | ||
"singleQuote": false, // Use single quotes instead of double quotes. | ||
/** | ||
* Print trailing commas wherever possible. | ||
* Valid options: | ||
* - "none" - no trailing commas | ||
* - "es5" - trailing commas where valid in ES5 (objects, arrays, etc) | ||
* - "all" - trailing commas wherever possible (function arguments) | ||
*/ | ||
"trailingComma": "none", | ||
/** | ||
* Do not print spaces between brackets. | ||
* If true, puts the > of a multi-line jsx element at the end of the last line instead of being | ||
* alone on the next line | ||
*/ | ||
"jsxBracketSameLine": false, | ||
/** | ||
* Specify which parse to use. | ||
* Valid options: | ||
* - "flow" | ||
* - "babylon" | ||
*/ | ||
"parser": "babylon", | ||
/** | ||
* Do not print semicolons, except at the beginning of lines which may need them. | ||
* Valid options: | ||
* - true - add a semicolon at the end of every line | ||
* - false - only add semicolons at the beginning of lines that may introduce ASI failures | ||
*/ | ||
"noSemi": true, | ||
/** | ||
* Add additional logging from prettierrc (not prettier itself). | ||
* Defaults to false | ||
* Valid options: | ||
* - true - enable additional logging | ||
* - false - disable additional logging | ||
*/ | ||
"rcVerbose": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
language = "nodejs" | ||
run = "node discord_bot.js" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
worker: npm start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# DiscordBot | ||
Un bot Discord basé sur <a href="https://github.com/hydrabolt/discord.js/">discord.js</a>. | ||
|
||
# Fonctionnalités: | ||
- !gif query => Retourne un gif basé sur la requête. Exemple = !gif dogs | ||
- !image query => Retourne une image provenant de Google Image (attention, il n'y a pas de filtre adulte). Exemple: !image dogs | ||
- !youtube query=> Retourne un lien youtube. Exemple: !youtube Fortnite | ||
- !wiki query=> Retourne le sommaire du premier résultat de recherche sur Wikipédia. Exemple: Linus Torvalds | ||
- !wolfram query => demande à Wolfram Alpha le résulat | ||
- !meme memetype "texte1" "texte2" => Retourne un meme. Attention, les guillemets autour de text1 et text2 sont très importants. | ||
- !say texte => Envoie un message contenant le texte | ||
- !alias => Créer un raccourci de commande personnalisé dans le channel. | ||
- !join-server => Le bot rejoint le serveur demandé. | ||
- !talk => Parler avec le bot ! | ||
- @botname => Répond quand il est @mentionné | ||
- Gérer les channels! | ||
|
||
Et encore plus ! Essayez `!help` pour obtenir une liste complète des commandes | ||
|
||
# Installation | ||
|
||
Ce bot est écrit pour fonctionner avec node.js. Allez voir : https://nodejs.org/en/download/ | ||
|
||
Une fois NodeJS installé, exécutez `npm install` depuis le répertoire du bot, cela devrait installer tous les fichiers nécessaires (packages npm). Si cette commande affiche des erreurs, le bot ne fonctionnera pas! | ||
|
||
|
||
|
||
## Utilisateur windows | ||
Notez que vous devez avoir un compileur C et Python dans le répertoire pour que | ||
`npm install` fonctionne. Le bot a été testé sur Windows avec Visual Studio 2015 Community et Python 2.7, à l'exception de `!pullanddeploy`. | ||
* [Installer Node sur Windows](http://blog.teamtreehouse.com/install-node-js-npm-windows) | ||
* [Erreurs npm sur Windows](http://stackoverflow.com/questions/21365714/nodejs-error-installing-with-npm) | ||
* [Visual Studio Community 2015](https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx) | ||
* [Python 2.7](https://www.python.org/downloads/) | ||
|
||
[Tuck 64 a fait une vidéo afin d'illustrer la procédure](https://www.youtube.com/watch?v=H-82S2jFOII) | ||
|
||
## RSS | ||
Vous pouvez créer un fichier rss.json en ajoutant des flux rss sous forme de commande. Allez voir rss.json.example pour plus de détails. | ||
|
||
## Instructions spéciales pour paramétrer l'API google search et l'API youtube : | ||
|
||
(merci à @SchwererKonigstiger) | ||
|
||
1) Créez une recherche personnalisée sur : https://cse.google.com/cse/create/new | ||
|
||
2) Laissez le premier champ vide, et saisissez ce que vous souhaitez pour le nom du moteur de recherche. | ||
|
||
3) Cliquez sur "Advanced Options" et ensuite sur ImageObject. | ||
|
||
4) C'est créé. | ||
|
||
5) Sur la nouvelle page, autorisez la recherche d'image dans le menu. | ||
|
||
6) Cliquez ensuite sur "Search engine ID" sous l'en-tête des détails. | ||
|
||
7) Copiez ceci dans le fichier auth.json, dans la partie "google_custom_search". | ||
|
||
Vérifiez que vous possédiez bien la clé d'API Google server, qui est située dans la partie "youtube_api_key", ou la recherche va échouer. | ||
|
||
# Lancement | ||
Avant de lancer le bot pour la première fois, vous devez créer un fichier `auth.json`. Un token ou une adresse mail avec mot de passe d'un compte discord sont requis. Les autres informations d'identification ne sont pas requises pour que le bot s'exécute, mais elles sont vivement recommandées car les commandes qui en dépendent risquent de mal fonctionner. Voir `auth.json.example`. | ||
|
||
Pour lancer le bot, exécuter ceci : | ||
`node discord_bot.js`. | ||
|
||
# Mis à jour | ||
Si vous mettez à jour le bot, exécutez `npm update` avant de le lancer à nouveau. Si vous avez des erreurs, essayez de supprimer le dossier node_modules et exécutez de nouveau | ||
`npm install`. Allez à [Installation](#Installation). | ||
|
||
# A Faire: | ||
Paramétrer le bot ! | ||
|
||
# Help | ||
Veuillez vérifier la page des bugs GitHub de ce projet. Nous recevons beaucoup de questions similaires, et il est probable que votre problème ait déjà été résolu. | ||
|
||
|
||
Si vous avez encore besoin d’aide, n'hésitez pas à nous rejoindre sur [discord.](https://discord.gg/m29GJBN) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
var AuthDetails = {}; | ||
try { | ||
AuthDetails = require("./auth.json"); | ||
} catch (e){ | ||
console.log("Please create an auth.json like auth.json.example with a bot token or an email and password.\n"+e.stack); // send message for error - no token | ||
} | ||
|
||
if(!AuthDetails.hasOwnProperty('bot_token')) { | ||
//attempt to populate from ENV variables. useful for remote cloud deploys | ||
AuthDetails = { | ||
bot_token: process.env.bot_token, | ||
client_id: process.env.client_id, | ||
youtube_api_key: process.env.youtube_api_key, | ||
google_custom_search: process.env.youtube_api_key, | ||
imgflip_username: process.env.imgflip_username, | ||
imgflip_password: process.env.imgflip_password, | ||
wolfram_api_key: process.env.wolfram_api_key, | ||
twitch_client_id: process.env.twitch_client_id | ||
} | ||
} | ||
|
||
exports.getAuthDetails = () => { | ||
return AuthDetails; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
{ | ||
"email" : "email of the discord account here if using a user account", | ||
"password" : "password of the discord account here if using a user account", | ||
"bot_token" : "bot token if using a bot account", | ||
"client_id" : "client id if using a bot account and you want people to be able to invite it to their server", | ||
"youtube_api_key": "create one here https://console.developers.google.com", | ||
"google_custom_search": "follow instructions at https://stackoverflow.com/questions/34035422/google-image-search-says-api-no-longer-available", | ||
"imgflip_username": "https://imgflip.com/ username", | ||
"imgflip_password": "https://imgflip.com/ password", | ||
"wolfram_api_key": "go here and click sign up http://products.wolframalpha.com/api/", | ||
"twitch_client_id": "create a twitch app here https://dev.twitch.tv/dashboard/apps/create (requires a twitch account)" | ||
"email": "email of the discord account here if using a user account", | ||
"password": "password of the discord account here if using a user account", | ||
"bot_token": "bot token if using a bot account", | ||
"client_id": "client id if using a bot account and you want people to be able to invite it to their server", | ||
"youtube_api_key": "create one here https://console.developers.google.com", | ||
"google_custom_search": "follow instructions at https://stackoverflow.com/questions/34035422/google-image-search-says-api-no-longer-available", | ||
"imgflip_username": "https://imgflip.com/ username", | ||
"imgflip_password": "https://imgflip.com/ password", | ||
"wolfram_api_key": "go here and click sign up http://products.wolframalpha.com/api/", | ||
"twitch_client_id": "create a twitch app here https://dev.twitch.tv/dashboard/apps/create (requires a twitch account)", | ||
"twitch_client_secret": "get this from the twitch dev dashboard once you've created your twitch app", | ||
"worldtradingdata_api_key": "create one at https://www.worldtradingdata.com/register" | ||
} |
Oops, something went wrong.