Created
October 16, 2021 15:57
-
-
Save zhongfly/76fdb4a6cbfd37eea26d9f47c33f4203 to your computer and use it in GitHub Desktop.
auto sign by click bot's button
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
from telethon import TelegramClient | |
import re,time | |
api_id = 123456 | |
api_hash = '123456' | |
toBot="@xxxxxx_bot" | |
client = TelegramClient('telethon', api_id, api_hash) | |
async def get_latest(entity): | |
message = await client.get_messages(entity,1) | |
return message[0] | |
async def main(): | |
start = await client.send_message(toBot,"/start") | |
time.sleep(3) | |
target = await get_latest(toBot) | |
await target.click(text=re.compile(".*签到.*").match) | |
await client.delete_messages(toBot,message_ids=[start,target],revoke=True) | |
with client: | |
client.loop.run_until_complete(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment