telethon

How to search for groups and channel in telegram using telethon?

会有一股神秘感。 提交于 2020-08-26 13:40:38
问题 I use telethon for sending messages to telegram using python script. I did not find anything in telethon to search for groups and channels I like used to search on telegram app. Please see iamge. How can I get such list using telethon? 回答1: Create file with your secrets: config.ini [Telegram] # no need for quotes # you can get telegram development credentials in telegram API Development Tools api_id = 1234 api_hash = 1234 # use full phone number including + and country code phone =

How to search for groups and channel in telegram using telethon?

↘锁芯ラ 提交于 2020-08-26 13:37:55
问题 I use telethon for sending messages to telegram using python script. I did not find anything in telethon to search for groups and channels I like used to search on telegram app. Please see iamge. How can I get such list using telethon? 回答1: Create file with your secrets: config.ini [Telegram] # no need for quotes # you can get telegram development credentials in telegram API Development Tools api_id = 1234 api_hash = 1234 # use full phone number including + and country code phone =

How to stop telethon conversation on receiving a specific message

◇◆丶佛笑我妖孽 提交于 2020-07-23 10:01:20
问题 I have made a telegram bot using telethon library which takes reponses from user using button.inline and button.text methods. But I want to stop the conversation as soon as a specific message(like bye) is entered by the user. @bot.on(events.NewMessage(incoming=True, pattern='Hi')) async def main(event): global SENDER MSG = event.raw_text SENDER=event.chat_id async with bot.conversation(SENDER) as conv: await conv.send_message('choose', buttons=[[Button.inline('Yes'), Button.inline('No')] ])

How to stop telethon conversation on receiving a specific message

旧巷老猫 提交于 2020-07-23 09:59:10
问题 I have made a telegram bot using telethon library which takes reponses from user using button.inline and button.text methods. But I want to stop the conversation as soon as a specific message(like bye) is entered by the user. @bot.on(events.NewMessage(incoming=True, pattern='Hi')) async def main(event): global SENDER MSG = event.raw_text SENDER=event.chat_id async with bot.conversation(SENDER) as conv: await conv.send_message('choose', buttons=[[Button.inline('Yes'), Button.inline('No')] ])

How to stop telethon conversation on receiving a specific message

吃可爱长大的小学妹 提交于 2020-07-23 09:58:46
问题 I have made a telegram bot using telethon library which takes reponses from user using button.inline and button.text methods. But I want to stop the conversation as soon as a specific message(like bye) is entered by the user. @bot.on(events.NewMessage(incoming=True, pattern='Hi')) async def main(event): global SENDER MSG = event.raw_text SENDER=event.chat_id async with bot.conversation(SENDER) as conv: await conv.send_message('choose', buttons=[[Button.inline('Yes'), Button.inline('No')] ])

Is it possible to create a telethon client starting from auth_key only?

泪湿孤枕 提交于 2020-06-28 09:39:08
问题 The hello world of telethon looks like: from telethon import TelegramClient client = TelegramClient(name, api_id, api_hash) async def main(): # Now you can use all client methods listed below, like for example... await client.send_message('me', 'Hello to myself!') with client: client.loop.run_until_complete(main()) Like this it will ask me to sign in the first time, by providing phone and confirmation code. Next time it will reuse information stored locally. What i want is to give it a auth

How to correct “ 'coroutine' object has no attribute 'data'” Error when using Telethon for Telegram?

落爺英雄遲暮 提交于 2020-06-17 01:43:11
问题 I am trying to code a simple thing in Python to automatically download some media from a Channel on Telegram. I am using Telethon for this. I keep getting an error that I cannot solve and for which I do not understand the reason. "'coroutine' object has no attribute 'data'" I have tried to use asyncio as well, but it didn't work. Here below my latest code # In[1]: import asyncio loop = asyncio.get_event_loop() import telethon.sync from telethon import TelegramClient from telethon.sync import

How to correct “ 'coroutine' object has no attribute 'data'” Error when using Telethon for Telegram?

不羁岁月 提交于 2020-06-17 01:41:05
问题 I am trying to code a simple thing in Python to automatically download some media from a Channel on Telegram. I am using Telethon for this. I keep getting an error that I cannot solve and for which I do not understand the reason. "'coroutine' object has no attribute 'data'" I have tried to use asyncio as well, but it didn't work. Here below my latest code # In[1]: import asyncio loop = asyncio.get_event_loop() import telethon.sync from telethon import TelegramClient from telethon.sync import

Telegram get chat messages /posts - python Telethon

强颜欢笑 提交于 2020-04-10 18:45:13
问题 I am using Telethon and Python 3.6xx Been able to retreive message from groups, no problem but when it comes to channels I am stuck. dialogs = client(get_dialogs) for chat in dialogs.chats: getmessage = client.get_messages(chat.id, limit=400) for message in getmessage: print(message.message) I've searched the telethon documentation but most answers were in response to the old get_message_history . When I'm trying with the following chat.id = 1097988869 (news.bitcoin.com) I'm getting an error

Telegram get chat messages /posts - python Telethon

僤鯓⒐⒋嵵緔 提交于 2020-04-10 18:45:07
问题 I am using Telethon and Python 3.6xx Been able to retreive message from groups, no problem but when it comes to channels I am stuck. dialogs = client(get_dialogs) for chat in dialogs.chats: getmessage = client.get_messages(chat.id, limit=400) for message in getmessage: print(message.message) I've searched the telethon documentation but most answers were in response to the old get_message_history . When I'm trying with the following chat.id = 1097988869 (news.bitcoin.com) I'm getting an error