diff --git a/README.md b/README.md index 7af0c72..0d7c0f0 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,17 @@ # DaftBot -![db](https://img.shields.io/badge/daftbot-v1.3.1-red) +![db](https://img.shields.io/badge/daftbot-v1.4.2-red) ![npm](https://img.shields.io/npm/v/npm/latest) -![discord.js](https://img.shields.io/badge/discord.js-v12.3.1-green) +![discord.js](https://img.shields.io/badge/discord.js-v14.7.0-green) +![tmi.js](https://img.shields.io/badge/tmi.js-v1.8.5-blue) +![json2csv](https://img.shields.io/badge/json2csv-v6.0.0.alpha.2-orange) ![GitHub repo size](https://img.shields.io/github/repo-size/vivimouret29/bot_discord?color=yellow) ## Pré-requis - Token de votre bot Discord +- Token de votre bot Twitch (optionnel) - Nodejs et npm ## Utilisation @@ -24,3 +27,23 @@ npm install # Pour lancer le bot node main.js ``` + +## Prerequisites + +- Token of your Discord bot +- Token of your Twitch bot (optional) +- Nodejs and npm + +## Usage + +After cloning the repo, simply go to the root of the project and copy the `config.json.example` file to `config.json` and put in your secret discord bot token and the prefix you will use. + +You can then run the following commands: + +```bash +# To install the necessary packages +npm install + +# To launch the bot +node main.js +``` \ No newline at end of file diff --git a/main.js b/main.js index 4e7eeb5..cd49b94 100755 --- a/main.js +++ b/main.js @@ -1,24 +1,13 @@ 'use.strict' -const tmi = require('tmi.js'); -const { parse } = require('json2csv'); -const fs = require('fs'); -const { Discord, Client, Collection, IntentsBitField, ActivityType } = require('discord.js'); -const wait = require('util').promisify(setTimeout); - -const { - clientId, - identity, - channels -} = require("./twitch_mobbot/config_mobbot.json"); -const { - prefix, - token, - owner -} = require("./config_daftbot.json"); -const { - fr, en, uk -} = require("./resx/lang.json"); +const tmi = require('tmi.js'), + { parse } = require('json2csv'), + fs = require('fs'), + { Discord, Client, Collection, IntentsBitField, ActivityType } = require('discord.js'), + wait = require('util').promisify(setTimeout), + { clientId, identity, channels } = require("./twitch_mobbot/config_mobbot.json"), + { prefix, token, owner } = require("./config_daftbot.json"), + { fr, en, uk } = require("./resx/lang.json"); var commandFile = require('./appdata/command.js'), replyFile = require('./appdata/reply.js'), @@ -346,7 +335,7 @@ function setLanguage(message, author, msg, args) { case 'en': languageChoosen = en; message.channel.send(`Language changed to English`); - + wait(1000); daftbot_client.user.setPresence({ activities: [{ @@ -356,13 +345,13 @@ function setLanguage(message, author, msg, args) { status: 'online' }); - + console.log(`[${getCurrentDatetime('comm')}] ${message.guild.name} / ${message.channel.name} # ${author} : ${msg}`); return languageChoosen; case 'uk': languageChoosen = uk; message.channel.send(`Мову змінено на українську`); - + wait(1000); daftbot_client.user.setPresence({ activities: [{ @@ -371,7 +360,7 @@ function setLanguage(message, author, msg, args) { }], status: 'online' }); - + console.log(`[${getCurrentDatetime('comm')}] ${message.guild.name} / ${message.channel.name} # ${author} : ${msg}`); return languageChoosen; default: @@ -538,7 +527,7 @@ async function resetBot(message, client, author, msg) { activities: [{ name: languageChoosen.activities, type: ActivityType.Watching - + }], status: 'online' });