Telegram Bot on Python for repost from VKontakte community pages (group, public page or event page) to Telegram Channels.
What is now implemented | How bot works | Installation & Usage
Type of VK post | Is implemented? | What bot will send to Telegram |
---|---|---|
Text post | Yes | Text post |
Text post with photo / gif | Yes | Text post with photo / gif |
Text post with photos | Yes | Text post & post with photos |
Text post with links | Yes | Text post with links |
Text post with (yt/vk) video | 50/50 | Text post with video preview > VK-API restrictions |
Text post with audios | 50/50 | Text post without audios > VK-API restrictions |
Text post with document | Yes | Text post with document |
VK reposts | Yes | Post with original post & repost text (e. g.) |
Text post with polls | Not yet | Just text post for now |
skipAdsPosts = True
- Bot sends and receives request from vk api [get.wall method]
- Then bot compares the id from last_known_id.txt with the id of the last post
- If
skipAdsPosts = True
inconfig.py
bot will skip ads posts - If id of the last post is larger than id from last_known_id.txt the bot will write a new id to file and call the function sendPosts()
- sendPosts() checks post type and
- if the post type is just text, it sends one text message to telegram
- if the post type is text with one photo, it sends message with photo to telegram
- if the post type is text with photos, it sends two messages to telegram: text message + message with images
- if the post type is text with youtube (or vk) video, it sends message with video preview to telegram (because vk_api does not support youtube video links)
- if the post type is text with audio, it sends one text message without audio to telegram (because vk_api does not support audio files)
- Then bot waits for the period set by the user and starts again
# clone the repo
$ git clone https://github.com/alcortazzo/vktgbot.git
# change the working directory to vktgbot
$ cd vktgbot
# install python3 and python3-pip if they are not installed
# install the requirements
$ python3 -m pip install -r requirements.txt
If you want to use git
# clone the repo
git clone https://github.com/alcortazzo/vktgbot.git
# change the working directory to vktgbot
cd vktgbot
# install python3 and python3-pip if they are not installed
# install the requirements
python -m pip install -r requirements.txt
If you don't want to use git
- Download vktgbot repo as ZIP
- Unzip vktgbot to your folder (for example C:\Users\%username%\bots\)
- Then open cmd or powershell
# change the working directory to vktgbot
cd c:\\users\\%username%\\bots\\vktgbot
# install the requirements
python -m pip install -r requirements.txt
tgChannel = '@aaaa'
tgBotToken = '1234567890:AAA-AaA1aaa1AAaaAa1a1AAAAA-a1aa1-Aa'
vkToken = '00a0a0ab00f0a0ab00f0a6ab0c00000b0f000f000f0a0ab0a00b000000dd00000000de0'
vkDomain = 'aaaaaaaa'
tgChannel
is the link to channel in telegramt.me/>>aaaa<<
. You must add bot to this channel as an administratortgBotToken
is the bot token from BotFathervkToken
is vk service token. HowToGet- If the group is closed you should use your personal access token! HowToGet
vkDomain
is the link to vk publicvk.com/>>aaaaaaaa<<
- Example: if link to post is
https://vk.com/wall-22822305_1070803
id of this post will be1070803
- PhotoExemple
$ python3 bot.py
python bot.py
GPLv3
Original Creator - alcortazzo