Skip to content

Instantly share code, notes, and snippets.

@steevehook
Forked from dideler/bot.rb
Created August 11, 2023 18:31
Show Gist options
  • Save steevehook/adc828cf207182b1948eec6aa0730916 to your computer and use it in GitHub Desktop.
Save steevehook/adc828cf207182b1948eec6aa0730916 to your computer and use it in GitHub Desktop.

Revisions

  1. @dideler dideler revised this gist Apr 20, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@
    ```
    b. OR, run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb) and @-mention your bot in the chat. The chat id will appear in `bot.rb`'s output.
    The bot may need temporary message access: `@BotFather > Bot Settings > Group Privacy > Turn off`
    4. Send a message via their HTTP API: https://core.telegram.org/bots/api#sendmessage
    4. Send a message using the HTTP API: https://core.telegram.org/bots/api#sendmessage
    ```shell
    curl -X POST \
    -H 'Content-Type: application/json' \
  2. @dideler dideler revised this gist Apr 20, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    1. [Create a bot](https://core.telegram.org/bots#6-botfather)
    2. Get the bot's API token via [@BotFather](https://telegram.me/BotFather)
    2. Get the bot's API token from [@BotFather](https://telegram.me/BotFather)
    3. Add your bot to the chat you'll be sending messages to
    3. Get the ID of the chat
    a. Fetch bot updates and look for the chat id:
  3. @dideler dideler revised this gist Apr 20, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    1. [Create a bot](https://core.telegram.org/bots#6-botfather)
    2. Gets its API token (via [@BotFather](https://telegram.me/BotFather))
    2. Get the bot's API token via [@BotFather](https://telegram.me/BotFather)
    3. Add your bot to the chat you'll be sending messages to
    3. Get the ID of the chat
    a. Fetch bot updates and look for the chat id:
  4. @dideler dideler revised this gist Apr 20, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    1. [Create a bot](https://core.telegram.org/bots#6-botfather)
    2. Gets its API token (via [@BotFather](https://telegram.me/BotFather))
    3. Add your bot to the chat you'll be sending messages to
    3. Get the ID of the chat
    3. Get the ID of the chat
    a. Fetch bot updates and look for the chat id:
    ```
    curl https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/getUpdates | jq .message.chat.id
  5. @dideler dideler revised this gist Apr 20, 2020. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,12 @@
    1. [Create a bot](https://core.telegram.org/bots#6-botfather)
    2. Gets its API token (via [@BotFather](https://telegram.me/BotFather))
    3. Add your bot to the chat you'll be sending messages to
    3. Get the ID of the chat
    1. Add your bot to the chat
    2. Fetch bot updates and look for the chat id:
    a. Fetch bot updates and look for the chat id:
    ```
    curl https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/getUpdates | jq .message.chat.id
    ```
    3. OR, run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb) and @-mention your bot in the chat. The chat id will appear in `bot.rb`'s output.
    b. OR, run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb) and @-mention your bot in the chat. The chat id will appear in `bot.rb`'s output.
    The bot may need temporary message access: `@BotFather > Bot Settings > Group Privacy > Turn off`
    4. Send a message via their HTTP API: https://core.telegram.org/bots/api#sendmessage
    ```shell
  6. @dideler dideler revised this gist Apr 20, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    1. [Create a bot](https://core.telegram.org/bots#6-botfather)
    2. Gets its API token (via @BotFather)
    2. Gets its API token (via [@BotFather](https://telegram.me/BotFather))
    3. Get the ID of the chat
    1. Add your bot to the chat
    2. Fetch bot updates and look for the chat id:
  7. @dideler dideler revised this gist Apr 20, 2020. No changes.
  8. @dideler dideler revised this gist Jun 16, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    1. Add your bot to the chat
    2. Fetch bot updates and look for the chat id:
    ```
    curl https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/getUpdates
    curl https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/getUpdates | jq .message.chat.id
    ```
    3. OR, run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb) and @-mention your bot in the chat. The chat id will appear in `bot.rb`'s output.
    The bot may need temporary message access: `@BotFather > Bot Settings > Group Privacy > Turn off`
  9. @dideler dideler revised this gist Jun 16, 2019. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,9 @@
    3. Get the ID of the chat
    1. Add your bot to the chat
    2. Fetch bot updates and look for the chat id:
    `curl https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/getUpdates`
    ```
    curl https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/getUpdates
    ```
    3. OR, run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb) and @-mention your bot in the chat. The chat id will appear in `bot.rb`'s output.
    The bot may need temporary message access: `@BotFather > Bot Settings > Group Privacy > Turn off`
    4. Send a message via their HTTP API: https://core.telegram.org/bots/api#sendmessage
  10. @dideler dideler revised this gist Jun 16, 2019. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,8 @@
    2. Gets its API token (via @BotFather)
    3. Get the ID of the chat
    1. Add your bot to the chat
    2. Fetch bot updates and look for the chat id: `curl https://api.telegram.org/bot$$TELEGRAM_BOT_TOKEN/getUpdates`
    2. Fetch bot updates and look for the chat id:
    `curl https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/getUpdates`
    3. OR, run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb) and @-mention your bot in the chat. The chat id will appear in `bot.rb`'s output.
    The bot may need temporary message access: `@BotFather > Bot Settings > Group Privacy > Turn off`
    4. Send a message via their HTTP API: https://core.telegram.org/bots/api#sendmessage
  11. @dideler dideler revised this gist Jun 16, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    2. Gets its API token (via @BotFather)
    3. Get the ID of the chat
    1. Add your bot to the chat
    2. Fetch bot updates and look for the chat id: `curl https://api.telegram.org/bot<bot_api_token>/getUpdates`
    2. Fetch bot updates and look for the chat id: `curl https://api.telegram.org/bot$$TELEGRAM_BOT_TOKEN/getUpdates`
    3. OR, run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb) and @-mention your bot in the chat. The chat id will appear in `bot.rb`'s output.
    The bot may need temporary message access: `@BotFather > Bot Settings > Group Privacy > Turn off`
    4. Send a message via their HTTP API: https://core.telegram.org/bots/api#sendmessage
  12. @dideler dideler revised this gist Jun 16, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@
    2. Fetch bot updates and look for the chat id: `curl https://api.telegram.org/bot<bot_api_token>/getUpdates`
    3. OR, run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb) and @-mention your bot in the chat. The chat id will appear in `bot.rb`'s output.
    The bot may need temporary message access: `@BotFather > Bot Settings > Group Privacy > Turn off`
    4. Send a POST request via their HTTP API: https://core.telegram.org/bots/api#sendmessage
    4. Send a message via their HTTP API: https://core.telegram.org/bots/api#sendmessage
    ```shell
    curl -X POST \
    -H 'Content-Type: application/json' \
  13. @dideler dideler revised this gist Jun 16, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@
    2. Fetch bot updates and look for the chat id: `curl https://api.telegram.org/bot<bot_api_token>/getUpdates`
    3. OR, run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb) and @-mention your bot in the chat. The chat id will appear in `bot.rb`'s output.
    The bot may need temporary message access: `@BotFather > Bot Settings > Group Privacy > Turn off`
    4. Send a POST request via their HTTP API https://core.telegram.org/bots/api#sendmessage
    4. Send a POST request via their HTTP API: https://core.telegram.org/bots/api#sendmessage
    ```shell
    curl -X POST \
    -H 'Content-Type: application/json' \
  14. @dideler dideler revised this gist Jun 16, 2019. 1 changed file with 6 additions and 7 deletions.
    13 changes: 6 additions & 7 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -5,11 +5,10 @@
    2. Fetch bot updates and look for the chat id: `curl https://api.telegram.org/bot<bot_api_token>/getUpdates`
    3. OR, run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb) and @-mention your bot in the chat. The chat id will appear in `bot.rb`'s output.
    The bot may need temporary message access: `@BotFather > Bot Settings > Group Privacy > Turn off`
    4. Send a POST request via their HTTP API
    4. Send a POST request via their HTTP API https://core.telegram.org/bots/api#sendmessage
    ```shell
    $ curl -X POST \
    -H 'Content-Type: application/json' \
    -d '{"chat_id": "123456789", "text": "This is a test from curl", "disable_notification": true}' \
    https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage
    ```
    - Docs for sending a message: https://core.telegram.org/bots/api#sendmessage
    curl -X POST \
    -H 'Content-Type: application/json' \
    -d '{"chat_id": "123456789", "text": "This is a test from curl", "disable_notification": true}' \
    https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage
    ```
  15. @dideler dideler revised this gist Jun 16, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    1. Add your bot to the chat
    2. Fetch bot updates and look for the chat id: `curl https://api.telegram.org/bot<bot_api_token>/getUpdates`
    3. OR, run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb) and @-mention your bot in the chat. The chat id will appear in `bot.rb`'s output.
    For groups, the bot needs temporary message access: `@BotFather > Bot Settings > Group Privacy > Turn off`
    The bot may need temporary message access: `@BotFather > Bot Settings > Group Privacy > Turn off`
    4. Send a POST request via their HTTP API
    ```shell
    $ curl -X POST \
  16. @dideler dideler revised this gist Jun 16, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    1. Add your bot to the chat
    2. Fetch bot updates and look for the chat id: `curl https://api.telegram.org/bot<bot_api_token>/getUpdates`
    3. OR, run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb) and @-mention your bot in the chat. The chat id will appear in `bot.rb`'s output.
    For groups, the bot needs temporary access to messages: `@BotFather > Bot Settings > Group Privacy > Turn off`
    For groups, the bot needs temporary message access: `@BotFather > Bot Settings > Group Privacy > Turn off`
    4. Send a POST request via their HTTP API
    ```shell
    $ curl -X POST \
  17. @dideler dideler revised this gist Jun 16, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    1. Add your bot to the chat
    2. Fetch bot updates and look for the chat id: `curl https://api.telegram.org/bot<bot_api_token>/getUpdates`
    3. OR, run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb) and @-mention your bot in the chat. The chat id will appear in `bot.rb`'s output.
    For group chat, the bot needs temporary access to messages: `@BotFather > Bot Settings > Group Privacy > Turn off`
    For groups, the bot needs temporary access to messages: `@BotFather > Bot Settings > Group Privacy > Turn off`
    4. Send a POST request via their HTTP API
    ```shell
    $ curl -X POST \
  18. @dideler dideler revised this gist Jun 16, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    1. Add your bot to the chat
    2. Fetch bot updates and look for the chat id: `curl https://api.telegram.org/bot<bot_api_token>/getUpdates`
    3. OR, run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb) and @-mention your bot in the chat. The chat id will appear in `bot.rb`'s output.
    For group chat, the bot needs temporary access to messages: @BotFather > Bot Settings > Group Privacy > Turn off
    For group chat, the bot needs temporary access to messages: `@BotFather > Bot Settings > Group Privacy > Turn off`
    4. Send a POST request via their HTTP API
    ```shell
    $ curl -X POST \
  19. @dideler dideler revised this gist Jun 16, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    1. Add your bot to the chat
    2. Fetch bot updates and look for the chat id: `curl https://api.telegram.org/bot<bot_api_token>/getUpdates`
    3. OR, run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb) and @-mention your bot in the chat. The chat id will appear in `bot.rb`'s output.
    For group chat, the bot will need temporary access to messages: @BotFather > Bot Settings > Group Privacy > Turn off
    For group chat, the bot needs temporary access to messages: @BotFather > Bot Settings > Group Privacy > Turn off
    4. Send a POST request via their HTTP API
    ```shell
    $ curl -X POST \
  20. @dideler dideler revised this gist Jun 16, 2019. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,8 @@
    3. Get the ID of the chat
    1. Add your bot to the chat
    2. Fetch bot updates and look for the chat id: `curl https://api.telegram.org/bot<bot_api_token>/getUpdates`
    3. OR, run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb) and @-mention your bot in the chat that you want the id for. The chat id will appear in `bot.rb`'s output. For group chat, the bot will need temporary access to messages: @BotFather > Bot Settings > Group Privacy > Turn off
    3. OR, run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb) and @-mention your bot in the chat. The chat id will appear in `bot.rb`'s output.
    For group chat, the bot will need temporary access to messages: @BotFather > Bot Settings > Group Privacy > Turn off
    4. Send a POST request via their HTTP API
    ```shell
    $ curl -X POST \
  21. @dideler dideler revised this gist Jun 16, 2019. 1 changed file with 1 addition and 4 deletions.
    5 changes: 1 addition & 4 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -3,10 +3,7 @@
    3. Get the ID of the chat
    1. Add your bot to the chat
    2. Fetch bot updates and look for the chat id: `curl https://api.telegram.org/bot<bot_api_token>/getUpdates`
    3. OR, run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb)
    4. For group chat, ensure bot has access to messages: @BotFather > Bot Settings > Group Privacy > Turn off
    For a write-only bot (i.e. does not respond to commands), re-enable group privacy after getting the chat id
    5. Ping your bot in the chat that you want the id for
    3. OR, run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb) and @-mention your bot in the chat that you want the id for. The chat id will appear in `bot.rb`'s output. For group chat, the bot will need temporary access to messages: @BotFather > Bot Settings > Group Privacy > Turn off
    4. Send a POST request via their HTTP API
    ```shell
    $ curl -X POST \
  22. @dideler dideler revised this gist Jun 16, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -14,4 +14,4 @@
    -d '{"chat_id": "123456789", "text": "This is a test from curl", "disable_notification": true}' \
    https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage
    ```
    - Docs for sending a message: https://core.telegram.org/bots/api#sendmessage
    - Docs for sending a message: https://core.telegram.org/bots/api#sendmessage
  23. @dideler dideler revised this gist Jun 16, 2019. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -8,10 +8,10 @@
    For a write-only bot (i.e. does not respond to commands), re-enable group privacy after getting the chat id
    5. Ping your bot in the chat that you want the id for
    4. Send a POST request via their HTTP API
    ```shell
    $ curl -X POST \
    -H 'Content-Type: application/json' \
    -d '{"chat_id": "123456789", "text": "This is a test from curl", "disable_notification": true}' \
    https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage
    ```
    ```shell
    $ curl -X POST \
    -H 'Content-Type: application/json' \
    -d '{"chat_id": "123456789", "text": "This is a test from curl", "disable_notification": true}' \
    https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage
    ```
    - Docs for sending a message: https://core.telegram.org/bots/api#sendmessage
  24. @dideler dideler revised this gist Jun 16, 2019. 1 changed file with 5 additions and 6 deletions.
    11 changes: 5 additions & 6 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,12 @@
    1. [Create a bot](https://core.telegram.org/bots#6-botfather)
    2. Gets its API token (via @BotFather)
    3. Get the ID of the chat
    1. Add your bot to the chat
    2. Fetch bot updates and look for the chat id: `curl https://api.telegram.org/bot<bot_api_token>/getUpdates`
    3. OR, run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb)
    4. For group chat, ensure bot has access to messages: @BotFather > Bot Settings > Group Privacy > Turn off
    1. Add your bot to the chat
    2. Fetch bot updates and look for the chat id: `curl https://api.telegram.org/bot<bot_api_token>/getUpdates`
    3. OR, run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb)
    4. For group chat, ensure bot has access to messages: @BotFather > Bot Settings > Group Privacy > Turn off
    For a write-only bot (i.e. does not respond to commands), re-enable group privacy after getting the chat id
    5. Ping your bot in the chat that you want the id for

    5. Ping your bot in the chat that you want the id for
    4. Send a POST request via their HTTP API
    ```shell
    $ curl -X POST \
  25. @dideler dideler revised this gist Jun 16, 2019. 1 changed file with 15 additions and 12 deletions.
    27 changes: 15 additions & 12 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,18 @@
    1. [Create a bot](https://core.telegram.org/bots#6-botfather)
    2. Gets its API token (via @BotFather)
    3. Get the ID of the channel
    1. Run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb)
    2. If it's a group chat, ensure bot has access to messages: @BotFather > Bot Settings > Group Privacy > Turn off
    If your bot is write-only (i.e. does not respond to commands), re-enable group privacy after getting the chat id
    3. Ping your bot in the chat that you want the id for
    3. Get the ID of the chat
    1. Add your bot to the chat
    2. Fetch bot updates and look for the chat id: `curl https://api.telegram.org/bot<bot_api_token>/getUpdates`
    3. OR, run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb)
    4. For group chat, ensure bot has access to messages: @BotFather > Bot Settings > Group Privacy > Turn off
    For a write-only bot (i.e. does not respond to commands), re-enable group privacy after getting the chat id
    5. Ping your bot in the chat that you want the id for

    API Docs for sending a message: https://core.telegram.org/bots/api#sendmessage
    ```shell
    $ curl -X POST \
    -H 'Content-Type: application/json' \
    -d '{"chat_id": "123456789", "text": "This is a test from curl", "disable_notification": true}' \
    https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage
    ```
    4. Send a POST request via their HTTP API
    ```shell
    $ curl -X POST \
    -H 'Content-Type: application/json' \
    -d '{"chat_id": "123456789", "text": "This is a test from curl", "disable_notification": true}' \
    https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage
    ```
    - Docs for sending a message: https://core.telegram.org/bots/api#sendmessage
  26. @dideler dideler revised this gist Feb 12, 2019. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,8 @@
    2. Gets its API token (via @BotFather)
    3. Get the ID of the channel
    1. Run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb)
    2. If it's a group chat, ensure bot has access to messages: @BotFather Bot Settings >> Group Privacy >> Turn off
    2. If it's a group chat, ensure bot has access to messages: @BotFather > Bot Settings > Group Privacy > Turn off
    If your bot is write-only (i.e. does not respond to commands), re-enable group privacy after getting the chat id
    3. Ping your bot in the chat that you want the id for

    API Docs for sending a message: https://core.telegram.org/bots/api#sendmessage
  27. @dideler dideler revised this gist Feb 12, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,8 @@
    2. Gets its API token (via @BotFather)
    3. Get the ID of the channel
    1. Run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb)
    2. Ping your bot in the chat that you want the id for
    3. If it's a group chat, ensure bot has access to messages: @BotFather Bot Settings >> Group Privacy >> Turn off
    2. If it's a group chat, ensure bot has access to messages: @BotFather Bot Settings >> Group Privacy >> Turn off
    3. Ping your bot in the chat that you want the id for

    API Docs for sending a message: https://core.telegram.org/bots/api#sendmessage
    ```shell
  28. @dideler dideler revised this gist Feb 12, 2019. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion bot.rb
    Original file line number Diff line number Diff line change
    @@ -11,11 +11,12 @@
    # Send a message to the bot to get the current chat's ID in the console output.
    # If it's a group chat, invite them to the chat first.

    require 'logger'
    require 'telegram_bot'

    TELEGRAM_BOT_TOKEN = "YOUR_BOT_API_TOKEN"

    bot = TelegramBot.new(token: TELEGRAM_BOT_TOKEN)
    bot = TelegramBot.new(token: TELEGRAM_BOT_TOKEN, logger: Logger.new(STDOUT))

    bot.get_updates(fail_silently: true) do |message|
    puts "@#{message.from.username}: #{message.text}"
  29. @dideler dideler revised this gist Feb 12, 2019. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,9 @@
    1. [Create a bot](https://core.telegram.org/bots#6-botfather)
    2. Gets its API token (via @BotFather)
    3. Get the ID of the channel
    1. Run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb)
    2. Ping your bot in the chat that you want the id for
    3. If it's a group chat, ensure bot has access to messages: @BotFather Bot Settings >> Group Privacy >> Turn off
    1. Run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb)
    2. Ping your bot in the chat that you want the id for
    3. If it's a group chat, ensure bot has access to messages: @BotFather Bot Settings >> Group Privacy >> Turn off

    API Docs for sending a message: https://core.telegram.org/bots/api#sendmessage
    ```shell
  30. @dideler dideler revised this gist Feb 12, 2019. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,9 @@
    1. [Create a bot](https://core.telegram.org/bots#6-botfather)
    2. Gets its API token (via botfather)
    3. Get the ID of the channel (run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb) and ping your bot in the chat that you want the id for)
    2. Gets its API token (via @BotFather)
    3. Get the ID of the channel
    1. Run [bot.rb](https://gist.github.com/dideler/85de4d64f66c1966788c1b2304b9caf1#file-bot-rb)
    2. Ping your bot in the chat that you want the id for
    3. If it's a group chat, ensure bot has access to messages: @BotFather Bot Settings >> Group Privacy >> Turn off

    API Docs for sending a message: https://core.telegram.org/bots/api#sendmessage
    ```shell