Could not find the input entity for <telethon.tl.types.PeerUser object at
Asked Answered
J

1

7

I am getting the error ValueError: Could not find the input entity for . Please read https://docs.telethon.dev/en/latest/concepts/entities.html to find out more details.. This error comes from client.send_message(bot_id, 'reset').

def run_test(self,name,bot_id):
        self.start = time.time()
        api_id = 10*****
        api_hash = 'c1*********************************'

        with TelegramClient('anon', api_id, api_hash) as client:
            #breakpoint()
            results = {'results':[], 'start': time.asctime(time.localtime(self.start)), 'conversations': len(self.conversations['tests'])}

            Button(self, text='Cancel', width=20, font=("Lucinda Sans", 12),command=self.cancel(client)).pack()

            statusintro = 'Bot Instance ' + name +': '
            testtitle = ""

            self.show_output(statusintro + testtitle)

            if self.conversationReset is False:
                client.send_message(bot_id, self.conversations['tests'][self.test_counter]['questions'][self.question_counter])
            else:
                print (bot_id)                
                client.send_message(bot_id, 'reset')
                self.conversationReset = False
Johnnyjumpup answered 18/11, 2019 at 9:49 Comment(5)
Did you read the link from the error? docs.telethon.dev/en/latest/concepts/entities.htmlAverett
Yes I did. Still can't figure out how to resolve thisJohnnyjumpup
read the summaryBrazilin
Can you include the imports of your program so it's easier to replicate?Flotation
You are probably sending a message to an entity that is still "unseen". Please read: docs.telethon.dev/en/latest/concepts/entities.htmlLaufer
R
1

I don't know if anyone still needs this. But I had this issue a few minutes ago the fix was to use bot name in place of bot ID.

client.send_message(client.get_entity('enter bot name here'),"Message")
Roy answered 3/11, 2021 at 11:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.