Telegram бот для постинга записей в каналы, где бот находится или в личку.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Vladimir Smagin ba68d01c9b Изменить 'bot.py' 2 weeks ago
helpers import 1 month ago
bot.py Изменить 'bot.py' 2 weeks ago
readme.md Изменить 'readme.md' 2 weeks ago
requirements.txt import 1 month ago
run import 1 month ago
telegram-post-bot.service import 1 month ago

readme.md

Telegram-post-bot

Telegram bot to forward anything from socket file (or port if you change few lines) to Telegram channel, group or person chat.

Requires python 3 libs:

  • wheel
  • python-telegram-bot
  • raven (if you using Sentry)

Best results if you install it to venv.

Sample alert script for Zabbix

See more here https://blindage.org/?p=9548

#!/bin/bash
source /etc/profile

json_escape () {
    printf '%s' "$1" | python -c 'import json,sys; print(json.dumps(sys.stdin.read()).strip("\""))'
}

chat_id="-3459475309874"
post_title=$(json_escape "$1")
post_body=$(json_escape "$2")

echo "{\"chatID\":\"${chat_id}\",\"message\":\"${post_title}\n\n${post_body}\"}" | nc -U /run/telegram-GrapeBlessedBot.sock

You can also use Docker image https://hub.docker.com/r/iam21h/telegram-post-bot/