I want that some one can add my bot to his channel. For that I want to save the webhook (chat.id) of the channel in a database.
My code:
async with bot.conversation(chat.id) as conv:
await conv.send_message("Which channel you want add? (invite link of the channel):")
resp = await conv.get_response()
hookName = resp.message
hook = await bot.get_entity(hookName)
print(hook)
print(hook.chat_id)
print(hook.user_id)
I get this error at the line with get_entity when I use the invite link:
telethon.errors.rpcerrorlist.BotMethodInvalidError: The API access for bot users is restricted. The method you tried to invoke cannot be executed as a bot (caused by CheckChatInviteRequest)
And this error when I use the channelname:
ValueError: No user has "channelname" as username
Im wondering why it works when I hardcode the channel name but not as an response...
Would be nice if a user could just enter the chat name or channel name or the invite links and I get the id from that.
Is there any way to do that?
Thanks :)