0
import telebot

token = "8xxxxxxx7:AAElU-XhG1of3VaZMexdDIE-M2aY71CRIFk" 
bot = telebot.TeleBot(token)
bot.send_document(5xxxxxxx4, open(file.txt, 'rb'))

TypeError: send_document() takes 1 positional argument but 3 were given

1
  • .send_document only takes self as an argument. Therefore, to pass arguments correctly, you'd need to just bot.send_document() (bot is self, that is exactly 1 argument). But as @vurmux says in their answer, it will break again because the method is not implemented in the base class, you need to inherit from it and implement it yourself. Commented Jun 10, 2019 at 15:25

1 Answer 1

1

send_document is not implemented in the base Telebot class:

def send_document(self):
    raise NotImplemented("send_document needs work")

So if you want to use it, you should create the derived class and implement it manually.

Sign up to request clarification or add additional context in comments.

2 Comments

What i can write?? This? def send_document(self): raise NotImplemented("send_document needs work")
You should use send_message or write the new class that is derived from TeleBot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.