Giter Club home page Giter Club logo

trace.moe-telegram-bot's Introduction

trace.moe-telegram-bot

License GitHub Workflow Status Docker Docker Image Size Discord

This Telegram Bot can tell the anime when you send an screenshot to it

https://telegram.me/WhatAnimeBot

WhatAnimeBot.mp4

Features

  • Show anime titles in multiple languages
  • Telegram group support
  • Image, GIF, Video, URL support (stickers are not supported)
  • Video preview

How to use

  1. Start chatting with the bot https://telegram.me/WhatAnimeBot
  2. Send anime screenshots (images, gif or video) directly to the bot
  3. You may also forward images from other chats to the bot
  4. The bot will tell you the anime, episode, and time code of it
  5. It will also send you a video preview of that scene

How to use (in group)

  1. Add the bot @WhatAnimeBot to your group
  2. Reply to any group image, mention the bot with @WhatAnimeBot
  3. Wait for the bot to reply

Note that the bot has no access to your messages before it is added to your group

How to host the bot on your own

If you have privacy concern, you can host the bot on your own.

Please read Telegram's official tutorial to create a Bot first.

You need to disable Privacy Mode if you want to use your bot in group chat.

Environment Variables

TELEGRAM_TOKEN=       # e.g. 111111111:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
TELEGRAM_WEBHOOK=     # e.g. https://your.host.com/
PORT=                 # (optional) Default: 3000
TRACE_MOE_KEY=        # (optional)
ANILIST_API_URL=      # (optional) Default: https://graphql.anilist.co/

Deploy to Heroku

Deploy

Host with docker

Docker Image available on Docker Hub or GitHub Container Registry

docker run -it --rm --name trace-moe-tg-bot \
  -e TELEGRAM_WEBHOOK=https://your.host.com/ \
  -e TELEGRAM_TOKEN=111111111:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA \
  -p 443:3000 \
  ghcr.io/soruly/trace.moe-telegram-bot:latest

Note that you need to configure a reverse proxy if you need HTTPS.

Host bare-metal with Node.js

Install Node.js 18.x, then:

git clone https://github.com/soruly/trace.moe-telegram-bot.git
cd trace.moe-telegram-bot
npm install
  • Copy .env.example to .env
  • Edit .env as you need
node server.js

Host bare-metal with pm2

You also can use pm2 to run this in background in cluster mode.

Use below commands to start / restart / stop server.

npm run start
npm run stop
npm run reload
npm run restart
npm run delete

To change the number of nodejs instances, edit ecosystem.config.json

trace.moe-telegram-bot's People

Contributors

absurdlysuspicious avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar gabeklavans avatar jasonkhew96 avatar moonlgh avatar renovate-bot avatar soruly 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

trace.moe-telegram-bot's Issues

Server crash

I'll investigate this issue later today
error log from pm2

telegram-5 (err): SyntaxError: Unexpected token < in JSON at position 0
telegram-5 (err):     at Object.parse (native)
telegram-5 (err):     at Request._callback (/home/soruly/projects/whatanime.ga-telegram-bot/index.js:70:31)
telegram-5 (err):     at Request.self.callback (/home/soruly/projects/whatanime.ga-telegram-bot/node_modules/request/request.js:187:22)
telegram-5 (err):     at emitTwo (events.js:106:13)
telegram-5 (err):     at Request.emit (events.js:191:7)
telegram-5 (err):     at Request.<anonymous> (/home/soruly/projects/whatanime.ga-telegram-bot/node_modules/request/request.js:1044:10)
telegram-5 (err):     at emitOne (events.js:96:13)
telegram-5 (err):     at Request.emit (events.js:188:7)
telegram-5 (err):     at IncomingMessage.<anonymous> (/home/soruly/projects/whatanime.ga-telegram-bot/node_modules/request/request.js:965:12)
telegram-5 (err):     at emitNone (events.js:91:20)
telegram-5 (err):     at IncomingMessage.emit (events.js:185:7)
telegram-5 (err):     at endReadableNT (_stream_readable.js:975:12)
telegram-5 (err):     at _combinedTickCallback (internal/process/next_tick.js:74:11)
telegram-5 (err):     at process._tickDomainCallback (internal/process/next_tick.js:122:9)

Count quota for each user

Please tell me I am wrong, have you same quota for all telegram users?
So, theoretically, if some user exceed the quota, all other users get You have searched too much, please wait a while and try again.

Maybe you should use token for telegram-bot and count quota for each user? Or that already fixed, just repo isn't updated?

Better tutorial

Plz make a better tutorial on how to get all the env variables and how to start or deploy the bot

"You have searched too much"

Bot responds You have searched too much, please wait a while and try again. even I have just searched just one image.
I've underestimated the amount of traffic through telegram, working on a fix right now.
I'd increase search quota for the bot.

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.