Help me figure out how to send it.gif or url c.gif telebot / python / telegram library

Help send the user a small gif + text lg.hello7u, after clicking lg.rbtn5u.

There is a gif url, also C:\Test\x1, but it is not thrown in any way from either the url or the directory. Thanks!

# main.py
import telebot, cfg, kb, lg
from telebot import types
from requests import get
import requests

bot = telebot.TeleBot(cfg.token)

@bot.message_handler(content_types=['text, url, document'])
def cbreply(message):
   if message.text == lg.rbtn5u:
        img = open(r'C:\Test\x1\1.gif', 'rb')
        bot.send_video(message.chat.id, img, None, 'Text')
        img.close()
        bot.send_message(message.chat.id, lg.hello7u, reply_markup=kb.kbsu)

# cfg.py
url = "https://...."


# lg.py
rbtn1u = "В начало"
rbtn5u = "Начать поиск"
hello7u = "Благодарю"


# kb.py
import telebot, lg, cfg
from telebot import types

trkm = types.ReplyKeyboardMarkup

#endcontact kb
rkbu4 = trkm(row_width=1, resize_keyboard=True)
rkbu4.add(lg.rbtn5u)

#End keyboard
kbsu = trkm(True, True, row_width=1)
kbsu.add(lg.rbtn1u)

1 answers

I went through the methods for a long time, and finally settled on send_video:

img = open('/opt/bot/files/GIF/file.gif', 'rb')
bot.send_video(message.chat.id, img, None, 'Text')
img.close()
 1
Author: Violet, 2020-12-04 12:03:38