Skip to content

A simple bot to show JSON raw data of Telegram messages, which comes with a nice UI to navigate through the data.

License

Notifications You must be signed in to change notification settings

Asenaabiniz/showjsonbot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Show JSON Bot

A Telegram Bot for printing out the JSON data of a message sent or forwarded with support of navigating through the data and selecting individual data.

Telegram bot that can show the JSON raw data of a sent message, appended with functioning buttons to navigate through the JSON object. This bot's working flow is inspired by JSONShowBot which is not working as of November 2021.

The code is not perfect. Still have minor (major?) bugs.

Built Using

Screenshots

1

2

Running Locally

  • Clone this repository: git clone https://github.com/dcdunkan/show-json-bot
  • Install dependencies: npm install.
  • Create a .env file and set ENV variables except DOMAIN - Like in .env.example file. Set optionals if you want to.
  • Add the following to the end of src/bot.js
    bot.start();
  • Run: npm run local.

Deploy

You don't really have to deploy this. Running one, here - @jsoonbot. See the environment variable section for deploying details.

You can deploy to Heroku or Railway. Both of them has a free plan with some limits. The demo bot is running on Heroku.

Environment Variables

2 kinds of environmental variables. You must to set required ENV vars. You can set optionals if you want the additional features(?) as said in the descriptions.

Required Environment Variables

This is all you need to setup this bot basically. Don't care about DB_ENABLE and CHAT_LOG if you only want basic (main focus of this bot) things to work.

Variable Description
BOT_TOKEN You can get a Telegram Bot token by chatting with the BotFather here: BotFather
DOMAIN This bot uses Webhooks to recieve updates from Telegram. Set this to your app's domain without https:// or http:// or an / at the end. For example, on heroku, <appname>.herokuapp.com

Optional Environment Variables

Variable Required? Description
DB_ENABLE Optional. Defaults to false. Set this to true if you want the bot to store user IDs and user count to Deta.sh Bases. You have to configure DETA_KEY also.
DETA_KEY Required, if DB_ENABLE is true. Deta.sh project key. Create a free account in deta, and create a new project from dashboard, copy it's project key and set it here.
CHAT_LOG Optional. Defaults to false. Set to true, if you want to log errors, up status, total user count and total number of JSON showed to a Telegram Chat.
CHAT_ID Required, if CHAT_LOG is true. A Telegram Chat ID where the bot have permission to send messages. The bot will log errors, up status in this chat.
USERS_MSG_ID Required, if both DB_ENABLE and CHAT_LOG is set to true. Set this to a valid id of an existing message in your CHAT ID. Bot should have permission to edit message. Set this if you want the bot to update user count in the log chat.
SHOWED_JSON_MSG_ID Required, if both DB_ENABLE and CHAT_LOG is set to true. Set this to a valid id of an existing message in your CHAT ID. Bot should have permission to edit message. Set this if you want the bot to update total json showed count in the log chat.

If you liked this repo or the bot, please consider giving ⭐️ Star. Also, join our channel for more bot updates: Bots.DC

About

A simple bot to show JSON raw data of Telegram messages, which comes with a nice UI to navigate through the data.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.1%
  • Shell 2.9%