Giter Site home page Giter Site logo

Comments (4)

pevdh avatar pevdh commented on May 20, 2024

Simply provide a string instead of an actual file.
bot.send_sticker(chat_id, "<SOME_ID>")

from pytelegrambotapi.

gashish1n avatar gashish1n commented on May 20, 2024

Simply provide a string instead of an actual file.
bot.send_sticker(chat_id, "<SOME_ID>")

I get an error:

user@server:~$ python3 fdsfds.py
2019-07-03 03:41:20,925 (util.py:65 WorkerThread1) ERROR - TeleBot: "AttributeError occurred, args=("'TeleBot' object has no attribute 'photo'",)
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/telebot/util.py", line 59, in run
    task(*args, **kwargs)
  File "fdsfds.py", line 43, in photo
    bot.photo(message.from_user.id, "AgADAgADbqsxG7kKcUi_CjymHgiEtX_Utw8ABNTJB6A9-S3OhCcAAgI")
AttributeError: 'TeleBot' object has no attribute 'photo'
"
Traceback (most recent call last):
  File "fdsfds.py", line 50, in <module>
    bot.polling(none_stop = True)
  File "/usr/local/lib/python3.5/dist-packages/telebot/__init__.py", line 389, in polling
    self.__threaded_polling(none_stop, interval, timeout)
  File "/usr/local/lib/python3.5/dist-packages/telebot/__init__.py", line 413, in __threaded_polling
    self.worker_pool.raise_exceptions()
  File "/usr/local/lib/python3.5/dist-packages/telebot/util.py", line 108, in raise_exceptions
    six.reraise(self.exc_info[0], self.exc_info[1], self.exc_info[2])
  File "/usr/lib/python3/dist-packages/six.py", line 686, in reraise
    raise value
  File "/usr/local/lib/python3.5/dist-packages/telebot/util.py", line 59, in run
    task(*args, **kwargs)
  File "fdsfds.py", line 43, in photo
    bot.photo(message.from_user.id, "AgADAgADbqsxG7kKcUi_CjymHgiEtX_Utw8ABNTJB6A9-S3OhCcAAgI")
AttributeError: 'TeleBot' object has no attribute 'photo'

Even if you add <>, nothing changes.

from pytelegrambotapi.

Badiboy avatar Badiboy commented on May 20, 2024

bot.photo(message.from_user.id, ...)

Lol, you got AttributeError: 'TeleBot' object has no attribute 'photo' because... 'TeleBot' object has no attribute 'photo'.

Even if you take a look on the main page (https://github.com/eternnoir/pyTelegramBotAPI) and search for the word "photo" you'll see...

# All send_xyz functions which can take a file as an argument, can also take a file_id instead of a file.
# sendPhoto
photo = open('/tmp/photo.png', 'rb')
tb.send_photo(chat_id, photo)
tb.send_photo(chat_id, "FILEID")

from pytelegrambotapi.

gashish1n avatar gashish1n commented on May 20, 2024

Apparently I accidentally deleted the "send_". Here is what I am trying to send:

if message.text == "Hello":
            bot.send_message(message.from_user.id, "Hello!")
            bot.send_video(message.from_user.id, "BAADAgADRAMAAvlk-Ejjn4i0OUcDewI")

It produces error 400.

from pytelegrambotapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.