Giter VIP home page Giter VIP logo

nhentai-telegram-bot's Introduction

Features:

  • Inline search - search manga in any chat. Search
  • Favorites - like the manga so you can easily open or share it. Favorites
  • Read manga directly in the telegram app, no need to open a browser. Instant preview
  • Discover new doujins with /rand command.
  • Open doujins using code or link, send multiple codes in one message.
  • Database - Bot works even if nhentai is down (more than 500k doujins are saved). Database screnshot
  • Translated into Russian and Spanish https://i.imgur.com/eh69bTA.png Language selection

One-Click Deploy Button

Pre-reqs for deploying this project to Heroku or replit.com:

On replit.com you may need to run npm install node && npm install && npm run build before starting for the first time

Run on replit.com

Deploy

Development progress:

  • User-related features
    • ability to set filter and random only in specific tags
    • ability to exclude tags from random
    • button to delete all user data in settings
    • button to clear history in settings
    • redesign settings
    • add answerCallbackQuery() to prevent infinite loading on buttons
  • instance features
    • support for readonly connection with database
    • ability to connect to multiple databases
    • generate webhook urls automatically from built in env variables on perl.it and heroku
  • Tanslations
    • Finish translations in the search
    • Indonesian
    • German
  • add actual logging
  • proxy
  • switch from telegraf to grammy
  • typescript!
    • inline search
    • random
    • text handler (by code)
    • likes
    • help & settings
    • "fix" button
    • /zip command
  • find alternative for telegra.ph and implement as a fallback (for hosting images)
  • create new website with fancy stats

nhentai-telegram-bot's People

Contributors

dependabot[bot] avatar sleroq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

nhentai-telegram-bot's Issues

How to deploy

I hope to get some help on deployment, such as how to set it up in repl.it

Can't find any manga

Hi, I launched bot and when I started bot and clicked on "Random Manga", it didn't responed, checked the log and it said:
Werror [Error]: Handling callback_query: Handling Random:next button: Getting random manga: Couldn't find manga with such tags
looks like it can't connect to manga source or something like that.

error when deploy

  src/bot/commands/like.ts(4,2): error TS6133: 'CallbackQuery' is declared but its value is never read.
       src/bot/commands/like.ts(16,64): error TS2702: 'CallbackQuery' only refers to a type, but is being used as a namespace here.
       src/bot/commands/settings/buttons_handler.ts(4,10): error TS6133: 'CallbackQuery' is declared but its value is never read.
       src/bot/commands/settings/buttons_handler.ts(26,85): error TS2702: 'CallbackQuery' only refers to a type, but is being used as a namespace here.
       src/bot/commands/fix_instant_view.ts(18,10): error TS6133: 'CallbackQuery' is declared but its value is never read.
       src/bot/commands/fix_instant_view.ts(22,18): error TS2702: 'CallbackQuery' only refers to a type, but is being used as a namespace here.
       src/bot/commands/fix_instant_view.ts(33,18): error TS2702: 'CallbackQuery' only refers to a type, but is being used as a namespace here.
       src/bot/commands/fix_instant_view.ts(235,18): error TS2702: 'CallbackQuery' only refers to a type, but is being used as a namespace here.
       src/bot/callback_handler.ts(4,18): error TS6133: 'CallbackQuery' is declared but its value is never read.
       src/bot/callback_handler.ts(13,85): error TS2702: 'CallbackQuery' only refers to a type, but is being used as a namespace here.
-----> Build failed

heroku deploy.

Bot does not respond? Heroku deploy

I did setup with heroku deploy.
did Follow the pre-requisite from this link and filled in the Required field it says successfully deployed
but the bot won't respond to any command?

Could you help me? am I missing something maybe?

Edit:
heroku[web.1]: Process exited with status 1
heroku[web.1]: State changed from starting to crashed

Could you maybe tell me steps I should follow?

Unable to open favorites

Unable to open favorites, just buffering and nothing happend, around half year ago favorite still able to open, but now unable

English language

every time I put the English language and try to look for something, it always returns to the language previous to the one I had put in (to do some tests I saw that it does it only with English).
I don't know if it's just my problem but on other devices I find myself with the same thing. Now I try to see if it is only tied to my account but if it could be fixed the bot is perfect.

[Feature Request] add Cookie option to pass Cloudflare protection

Hi, I launched bot and when I started bot and clicked on "Random Manga", it didn't responed, checked the log and it said: Werror [Error]: Handling callback_query: Handling Random:next button: Getting random manga: Couldn't find manga with such tags looks like it can't connect to manga source or something like that.

Cause of this problem is Cloudflare protection.

I don't want to solve captchas, and using headless browser won't help with number of requests to big bots.

But If you want to run your own instance, you can pass Cloudflare protection manually and set Cookie header in requests. If you want me to add Cookie option to make this easier - let me know. It will fix the issue till cookie expires.

Hi,

Firstly I want to thank you for your great project sir.๐Ÿ‘

I'm having the same problem as you mentioned above Here and I would appreciate it if Could you add the Cookie option you were talking about?

The language change by itself

The language randomly change by itself, unable to change back to english, sometime change to russian, sometime change to spainish

Bot returns random manga.

I've deployed the bot successfully on Heroku. It's working as expected, the only issue is when I choose a manga in the inline mode (not from a search result but from the favorites or history menu), the bot sends a bunch of random manga and at the end, it sends the requested manga.

Here's the issue recorded as a GIF - https://i.imgur.com/0l8tZXN.gif

Issue with Heroku

I was hoping if you could help regarding with Heroku. Followed the pre-requisite and filled in the necessary token and database URL and Heroku returned a 'Postdeploy exit code was not 0' error.

Unless I am genuinely stupid and missed something, is there anyway to fix this?

Build fails

Some error with callback query happens and the build fails

heroku build failed

Hello, I tried to deploy to Heroku and input all the vars required, but the deploy failed.
This is the build log:

-----> Building on the Heroku-20 stack
-----> Determining which buildpack to use for this app
-----> Node.js app detected
       
-----> Creating runtime environment
       
       NPM_CONFIG_LOGLEVEL=error
       NODE_VERBOSE=false
       NODE_ENV=production
       NODE_MODULES_CACHE=true
       
-----> Installing binaries
       engines.node (package.json):  >=14.x
       engines.npm (package.json):   unspecified (use default)
       
       Resolving node version >=14.x...
       Downloading and installing node 18.3.0...
       Using default npm version: 8.11.0
       
-----> Installing dependencies
       Installing node modules (package.json)
       
       added 301 packages, and audited 302 packages in 12s
       
       58 packages are looking for funding
         run `npm fund` for details
       
       found 0 vulnerabilities
       
-----> Build
       Running build
       
       > [email protected] build
       > tsc --build tsconfig.json
       
       src/db/save_and_get_user.ts(27,3): error TS2322: Type 'Document<unknown, any, MergeType<UserSchema, { _id: number; username: string | undefined; first_name: string; last_name: string | undefined; language_code: string | undefined; search_sorting: string; search_type: string; ignored_random_tags: string[]; random_localy: boolean; can_repeat_in_random: boolean; }>> & Omit...' is not assignable to type '(UserSchema & Document<any, any, UserSchema>) | null'.
         Type 'Document<unknown, any, MergeType<UserSchema, { _id: number; username: string | undefined; first_name: string; last_name: string | undefined; language_code: string | undefined; search_sorting: string; search_type: string; ignored_random_tags: string[]; random_localy: boolean; can_repeat_in_random: boolean; }>> & Omit...' is not assignable to type 'UserSchema & Document<any, any, UserSchema>'.
           Type 'Document<unknown, any, MergeType<UserSchema, { _id: number; username: string | undefined; first_name: string; last_name: string | undefined; language_code: string | undefined; search_sorting: string; search_type: string; ignored_random_tags: string[]; random_localy: boolean; can_repeat_in_random: boolean; }>> & Omit...' is not assignable to type 'UserSchema'.
             Types of property '_id' are incompatible.
               Type 'number & ObjectId' is not assignable to type 'string'.
       src/db/save_and_get_user.ts(41,10): error TS2531: Object is possibly 'null'.
       src/db/save_and_get_user.ts(48,6): error TS2531: Object is possibly 'null'.
       src/db/save_and_get_user.ts(51,6): error TS2531: Object is possibly 'null'.
       src/db/save_and_get_user.ts(54,2): error TS2322: Type '(UserSchema & Document<any, any, UserSchema>) | null' is not assignable to type 'UserSchema & Document<any, any, UserSchema>'.
         Type 'null' is not assignable to type 'UserSchema & Document<any, any, UserSchema>'.
           Type 'null' is not assignable to type 'UserSchema'.
       src/bot/commands/random.ts(42,4): error TS2322: Type 'Document<unknown, any, MergeType<MessageSchema, { chat_id: string; message_id: string; current: number; history: never[]; }>> & Omit<MessageSchema, "history" | ... 2 more ... | "current"> & { ...; } & { ...; }' is not assignable to type 'Message | null'.
         Type 'Document<unknown, any, MergeType<MessageSchema, { chat_id: string; message_id: string; current: number; history: never[]; }>> & Omit<MessageSchema, "history" | ... 2 more ... | "current"> & { ...; } & { ...; }' is not assignable to type 'Message'.
           Type 'Document<unknown, any, MergeType<MessageSchema, { chat_id: string; message_id: string; current: number; history: never[]; }>> & Omit<MessageSchema, "history" | ... 2 more ... | "current"> & { ...; } & { ...; }' is not assignable to type 'MessageSchema'.
             Types of property 'message_id' are incompatible.
               Type 'string' is not assignable to type 'number'.
       src/bot/commands/random.ts(45,3): error TS2322: Type 'Document<unknown, any, MergeType<MessageSchema, { chat_id: string; message_id: string; current: number; history: never[]; }>> & Omit<MessageSchema, "history" | ... 2 more ... | "current"> & { ...; } & { ...; }' is not assignable to type 'Message | null'.
       src/bot/commands/random.ts(55,7): error TS2531: Object is possibly 'null'.
       src/bot/commands/random.ts(59,40): error TS2531: Object is possibly 'null'.
       src/bot/commands/random.ts(59,56): error TS2531: Object is possibly 'null'.
       src/bot/commands/random.ts(63,3): error TS2531: Object is possibly 'null'.
       src/bot/commands/random.ts(69,6): error TS2531: Object is possibly 'null'.
       src/bot/commands/random.ts(69,26): error TS2531: Object is possibly 'null'.
       src/bot/commands/random.ts(75,3): error TS2531: Object is possibly 'null'.
       src/bot/commands/random.ts(76,7): error TS2531: Object is possibly 'null'.
       src/bot/commands/random.ts(78,17): error TS2531: Object is possibly 'null'.
       src/bot/commands/random.ts(79,5): error TS2531: Object is possibly 'null'.
       src/bot/commands/random.ts(82,8): error TS2531: Object is possibly 'null'.
       src/bot/commands/random.ts(83,5): error TS2531: Object is possibly 'null'.
       src/bot/commands/random.ts(91,3): error TS2531: Object is possibly 'null'.
       src/bot/commands/random.ts(93,40): error TS2531: Object is possibly 'null'.
       src/bot/commands/random.ts(93,56): error TS2531: Object is possibly 'null'.
       src/bot/commands/random.ts(106,9): error TS2531: Object is possibly 'null'.
       src/bot/commands/random.ts(122,6): error TS2531: Object is possibly 'null'.
       src/bot/text_handler.ts(107,24): error TS2345: Argument of type 'any' is not assignable to parameter of type 'never'.
-----> Build failed
       
       We're sorry this build is failing! You can troubleshoot common issues here:
       https://devcenter.heroku.com/articles/troubleshooting-node-deploys
       
       Some possible problems:
       
       - Dangerous semver range (>) in engines.node
         https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
       
       Love,
       Heroku
       
 !     Push rejected, failed to compile Node.js app.
 !     Push failed

Persistent instant view issue with a certain comic.

No matter how much I try, I can't get the comic 178983 as instant view. It returns as a normal Telegraph link without the instant view button (mobile version screenshot). It doesn't even show up in the search (by name, author or tag). Here's what I tried ~

  • fixing the instant view using the 'fix' feature (returns error, see below)
  • clearing the MongoDB database
  • shifting to a new database
  • changing the telegraph access token
  • changing the bot token / shifting to a new bot
  • shifting to a completely new hosting instance (both Heroku and Repl.it)

None of them worked. The fixing feature throws this error (not only for this comic) ~

Repl.it :

(node:253) UnhandledPromiseRejectionWarning: ReferenceError: manga is not defined
    at module.exports.fixInstantView (/home/runner/nhentai-telegram-bot/bot/buttons/fix_instant_view.js:28:20)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async module.exports.cb_query (/home/runner/nhentai-telegram-bot/bot/buttons/index.js:37:5)
    at async /home/runner/nhentai-telegram-bot/server.js:85:43
    at async execute (/home/runner/nhentai-telegram-bot/node_modules/telegraf/lib/composer.js:458:17)
    at async /home/runner/nhentai-telegram-bot/node_modules/telegraf/lib/composer.js:459:21
    at async execute (/home/runner/nhentai-telegram-bot/node_modules/telegraf/lib/composer.js:458:17)
    at async /home/runner/nhentai-telegram-bot/node_modules/telegraf/lib/composer.js:459:21
    at async execute (/home/runner/nhentai-telegram-bot/node_modules/telegraf/lib/composer.js:458:17)
    at async /home/runner/nhentai-telegram-bot/node_modules/telegraf/lib/composer.js:459:21
    at async execute (/home/runner/nhentai-telegram-bot/node_modules/telegraf/lib/composer.js:458:17)
    at async /home/runner/nhentai-telegram-bot/node_modules/telegraf/lib/composer.js:459:21
    at async execute (/home/runner/nhentai-telegram-bot/node_modules/telegraf/lib/composer.js:458:17)
    at async /home/runner/nhentai-telegram-bot/node_modules/telegraf/lib/composer.js:459:21
    at async execute (/home/runner/nhentai-telegram-bot/node_modules/telegraf/lib/composer.js:458:17)
    at async /home/runner/nhentai-telegram-bot/node_modules/telegraf/lib/composer.js:459:21
(node:253) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:253) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Heroku :

2021-06-20T05:43:12.598686+00:00 app[web.1]: ReferenceError: manga is not defined

2021-06-20T05:43:12.598687+00:00 app[web.1]:     at module.exports.fixInstantView (/app/bot/buttons/fix_instant_view.js:28:20)

2021-06-20T05:43:12.598687+00:00 app[web.1]:     at runMicrotasks (<anonymous>)

2021-06-20T05:43:12.598688+00:00 app[web.1]:     at processTicksAndRejections (node:internal/process/task_queues:94:5)

2021-06-20T05:43:12.598688+00:00 app[web.1]:     at async module.exports.cb_query (/app/bot/buttons/index.js:37:5)

2021-06-20T05:43:12.598689+00:00 app[web.1]:     at async /app/server.js:85:43

2021-06-20T05:43:12.598689+00:00 app[web.1]:     at async execute (/app/node_modules/telegraf/lib/composer.js:458:17)

2021-06-20T05:43:12.598689+00:00 app[web.1]:     at async /app/node_modules/telegraf/lib/composer.js:459:21

2021-06-20T05:43:12.598690+00:00 app[web.1]:     at async execute (/app/node_modules/telegraf/lib/composer.js:458:17)

2021-06-20T05:43:12.598690+00:00 app[web.1]:     at async /app/node_modules/telegraf/lib/composer.js:459:21

2021-06-20T05:43:12.598690+00:00 app[web.1]:     at async execute (/app/node_modules/telegraf/lib/composer.js:458:17)

2021-06-20T05:43:12.598691+00:00 app[web.1]:     at async /app/node_modules/telegraf/lib/composer.js:459:21

2021-06-20T05:43:12.598691+00:00 app[web.1]:     at async execute (/app/node_modules/telegraf/lib/composer.js:458:17)

2021-06-20T05:43:12.598692+00:00 app[web.1]:     at async /app/node_modules/telegraf/lib/composer.js:459:21

2021-06-20T05:43:12.598692+00:00 app[web.1]:     at async execute (/app/node_modules/telegraf/lib/composer.js:458:17)

2021-06-20T05:43:12.598692+00:00 app[web.1]:     at async /app/node_modules/telegraf/lib/composer.js:459:21

2021-06-20T05:43:12.598693+00:00 app[web.1]:     at async execute (/app/node_modules/telegraf/lib/composer.js:458:17)

2021-06-20T05:43:12.684623+00:00 heroku[web.1]: Process exited with status 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.