Code Monkey home page Code Monkey logo

showjsonbot's Introduction

Show Json Bot

An open-source JavaScript Telegram bot that returns JSON of all events triggered by user.

Demo Bot


๐Ÿ“‘ INDEX

๐Ÿ•น Direct Deployment

1.Login to your Cloudflare Dashboard.

2.Navigate to "Workers & Pages" > "Create" and create new worker.

3.Copy the content of worker.js file.

4.Paste the code in worker's code editor and fill following variables:

  • SECRET_TOKEN: Random long url safe token to protect unauthorized execution of your Cloudflare worker.

    • Send /secret 32 command to DumpJsonBot to generate it.

    • Alternatively, it can be manually created by using alphabets, numbers and by not using any special character except _ and -.

  • BOT_TOKEN: API token of your Telegram bot, can be obtained from BotFather.

5.Click deploy button, copy your worker's URL and set webhook as given here.

๐Ÿ› ๏ธ Deploy from Source

1.Install Git, Node.JS and NPM.

2.Clone repository:

git clone https://github.com/lawdakacoder/ShowJsonBot.git

3.Change Directory:

cd ShowJsonBot

4.Fill config.js file.

5.Setup Wrangler

  • Install wrangler

    npm install wrangler
    
  • Login in Wrangler

    npx wrangler login
    
  • Deploy to Cloudflare worker

    npx wrangler deploy
    

6.Setup webhook as given here.

๐Ÿช Webhook

You can set webhook using your browser until I make a script to do it more easily.

1.Set webhook:
Replace BOT_TOKEN, WORKER_URL and SECRET_TOKEN with their original values which you generated above and then open link in browser:

https://api.telegram.org/botBOT_TOKEN/setWebhook?url=WORKER_URL&allowed_updates=["message", "edited_message", "channel_post", "edited_channel_post", "message_reaction", "callback_query"]&secret_token=SECRET_TOKEN

2.Delete webhook:
Filled wrong info or need to update info? delete webhook and then you can set it again!

https://api.telegram.org/botBOT_TOKEN/deleteWebhook

๐Ÿค– Commands

List of commands that you can set in BotFather.

start - Ping the bot.
info - Show user info.
chat - Show chat info.
secret - Generate url safe token.
help - Show help text.

โค๏ธ Credits

LawdaKaCoder: Developer of ShowJsonBot and for lawda.
Cloudflare: For workers and great documentation that no one can understand.

showjsonbot's People

Contributors

lawdakacoder avatar

Stargazers

Unagi avatar  avatar Vortx avatar Nikhil avatar Dr.Caduceus avatar  avatar

Watchers

 avatar

Forkers

arinraj09 n-sudy

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.