Giter Club home page Giter Club logo

chatidbot's Introduction

Telegram Bot - Replying with chat id / group id

Sample Telegram Bot.

Available Commands

  • /mychatid: returns the user chat id if sent directly or, if sent from a group, the group id

Can be extended to implement other commands.

How to install

  • Deploy the application / Docker container online (it must be available on https)
  • Create a new Bot using BotFather, using the command /newbot and take note of your token
  • Add the available commands using the BotFather command /setcommands, sending a content like the one below
mychatid - Send me back the chat id / group id
  • Set a webhook POSTing the payload below to https://api.telegram.org/bot<your bot token>/setWebhook
{
  "url": "https://<server><path>"
}

How to use it

  • to get a chat id:
    • write directly to your bot
    • you can now delete the chat with your bot (optional)
  • to get a group id:
    • create a group, including your bot
    • send a message /mychatid@<your bot> within the group
    • you can now remove your bot from the group (optional)

Environment variables

You can export the following environment variables, to customize the bot:

  • HTTP_PORT: http port to listen to. Defaults to 8080.
  • ENDPOINT: url path invoked by Telegram webhooks. Must be the same <path> used in setWebhook. Defaults to '/'.

Docker usage

With default values

Listening on https://<your server>:8080

docker run -p 8080:8080 paolodenti/chatidbot

With custom values

Listening on https://<your server>:443/mysecretpath

docker run -p 443:8888 -e HTTP_PORT=8888 -e ENDPOINT="/mysecretpath" paolodenti/chatidbot

chatidbot's People

Contributors

paolodenti avatar

Stargazers

Alberto avatar

Watchers

 avatar James Cloos avatar

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.