diff --git a/README.md b/README.md index 01764af..868754f 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,20 @@ # tcb-opus -A discord bot to get the latest manga chapters as soon as they comes out. +## What is it? + +`tcb-opus` is a Discord bot you can use to get the latest manga chapters from **TCBScans** as soon as they come out! + +To work properly, you first need to configure one of the channels in your Discord server to follow updates from the `#releases` text channel on the official TCB Discord server. This will cause any message posted by the original TCB bot in the `#releases` channel to be forwarded to your own channel on your Discord server. + +Once a message is forwarded to your Discord channel, `tcb-opus` will analyse it and determine to what manga it corresponds. Once a valid manga has been recognized, `tcb-opus` will attempt to fetch the URL of the latest chapter for that manga from TCBScans. It will then send a message containing the chapter URL to whatever channel you like on your Discord server. + +## Prequisites + +Please make sure you have both [npm](https://www.npmjs.com/) and [Node.js](https://nodejs.org/) **v16.6+** installed otherwise this bot will not work. ## Installation -Simply run the following command to install to install the required packages: +Simply run the following command to install to install the required dependencies on your system: ```sh npm i @@ -12,7 +22,7 @@ npm i ## Configuration -Before running the bot for the first, you need to modify its configuration in [config.json](config.json). Here is what the default configuration file looks like: +Before running the bot for the first time, you need to modify its configuration in [config.json](config.json). Here is what the default configuration file looks like: ```json { @@ -29,7 +39,9 @@ Before running the bot for the first, you need to modify its configuration in [c } } ``` + Here is the list of keys you can set: + - token: The token of your discord bot - opus: - mangas: The names of the mangas you are interested in diff --git a/data.json b/data.json index 50f6a9d..ed97337 100644 --- a/data.json +++ b/data.json @@ -3,7 +3,7 @@ { "name": "One Piece", "chapter": "1039", - "url": "https://onepiecechapters.com//chapters/391/one-piece-chapter-1039" + "url": "https://onepiecechapters.com/chapters/391/one-piece-chapter-1039" } ] } diff --git a/package.json b/package.json index f285cab..b957e2f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tcb-opus", - "version": "1.0.0", - "description": "A discord bot to get the latest manga chapters as soon as they comes out.", + "version": "1.0.1", + "description": "A discord bot to get the latest manga chapters from TCBScans as soon as they come out.", "main": "index.js", "scripts": { "start": "node index.js", diff --git a/scraper.js b/scraper.js index a67ab06..d700ea8 100644 --- a/scraper.js +++ b/scraper.js @@ -32,7 +32,7 @@ async function fetchLatestChapter(manga, website) { if (chapNumStart === -1) { return { // Remove excess slashes from the URL - url: (website + url).replace(/\/+/g, "/"), + url: (website + url).replace(/([^:]\/)\/+/g, "$1"), }; } @@ -45,7 +45,8 @@ async function fetchLatestChapter(manga, website) { return { chapter: chapNum, - url: website + url, + // Remove excess slashes from the URL + url: (website + url).replace(/([^:]\/)\/+/g, "$1"), }; } }