mirror of
https://github.com/Rongronggg9/SlashBot.git
synced 2025-02-06 09:13:29 +08:00
[U] Upload MTProto testing script
This commit is contained in:
parent
5b9d1c1611
commit
6b8808ff6e
25
mtp_test.py
Normal file
25
mtp_test.py
Normal file
@ -0,0 +1,25 @@
|
||||
import asyncio
|
||||
|
||||
import socks
|
||||
from telethon import TelegramClient, functions
|
||||
|
||||
# Configuration
|
||||
proxy = (socks.SOCKS5, 'localhost', 7890)
|
||||
api_id = 7000000
|
||||
api_hash = '506828842c80ea408b94d1**********'
|
||||
bot = TelegramClient('Bot', api_id, api_hash, proxy=proxy).start(bot_token='16679*****:***hCZ-*******RNRx9BYd-Hb**********')
|
||||
|
||||
|
||||
async def main():
|
||||
# Find user by username
|
||||
user = await bot(functions.contacts.ResolveUsernameRequest(username='hykilpikonna'))
|
||||
print(user)
|
||||
print()
|
||||
user = user.users[0]
|
||||
name = user.first_name + (' ' + user.last_name if user.last_name else '')
|
||||
print(name)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.run_until_complete(main())
|
Loading…
Reference in New Issue
Block a user