konerld.github.io

View My GitHub Profile

Posts (Latest 10 updated) :
Read all

Telegram bot

Installing

apt-get update && apt-get upgrade
apt-get install python3

sudo python3 get-pip.py
sudo pip install telepot
sudo apt-get install python3-psutil
apt-get install python3-matplotlib -y
sudo apt-get install git
git clone https://github.com/geekbeard/ServerStatsBot.git
cd ServerStatsBot

pip install pyTelegramBotAPI

BASH

#!/bin/bash

TOKEN=<ТОКЕН> CHAT_ID= MESSAGE="Hello World" URL="https://api.telegram.org/bot$TOKEN/sendMessage" curl -s -X POST $URL -d chat_id=$CHAT_ID -d text="$MESSAGE"

Q > Как отправить сообщение curl’ом A > example: curl -s -X POST https://api.telegram.org/bot/sendMessage -d chat_id= -d text="Hello World"

Рассылка опроса

TOKEN=”xxxxxxxxxx:xxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxx” URL=”https://api.telegram.org/bot$TOKEN/sendPoll”

curl -X POST $URL
-H ‘Content-Type: application/json’
-d ‘{“chat_id”:”902547”, “question”:”Кто здесь?”, “is_anonymous”:false, “options”:[“Уже работаю!”, “Сплю, вчера ночью работал.”, “Приболел / COVID-19”] }’