Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from telethon.tl.types.payments import GiveawayInfoResults
- from telethon.tl.functions.payments import GetGiveawayInfoRequest
- def giveaway_info(client, chat, msg_id):
- format = "%Y-%m-%d %H:%M:%S %Z"
- result = client(GetGiveawayInfoRequest(chat, msg_id))
- created = result.start_date.strftime(format)
- print('Giveaway created at', created)
- if isinstance(result, GiveawayInfoResults):
- finished_at = result.finish_date.strftime(format)
- won = result.winner
- print('Giveaway already finished at:', finished_at)
- print('Our result:', "Won" if won else "Lost")
- else:
- finish_date = client.get_messages(chat, ids=msg_id).media.until_date.strftime(format)
- participant = result.participating
- print('Giveaway starting at:', finish_date)
- print('We are:', 'Participating' if participant else 'Not participating')
- with TelegramClient(...) as client:
- giveaway_info(client, "@one_vampi", 171)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement