Add basic telegram sending to myself.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import telebot
|
||||
from telethon.sync import TelegramClient
|
||||
from telethon.tl.types import InputPeerUser, InputPeerChannel
|
||||
from telethon import TelegramClient, sync, events
|
||||
@@ -36,17 +35,14 @@ if not client.is_user_authorized():
|
||||
try:
|
||||
# receiver user_id and access_hash, use
|
||||
# my user_id and access_hash for reference
|
||||
print(client.get_me().stringify())
|
||||
print("A")
|
||||
#receiver = InputPeerUser('user_id', 'user_hash')
|
||||
receiver = InputPeerUser('1463709677', '4835783730631176464')
|
||||
#print(client.get_me().stringify())
|
||||
# send message to self...
|
||||
receiver = InputPeerUser( str(client.get_me().id), str(client.get_me().access_hash))
|
||||
|
||||
print("B ")
|
||||
print(receiver)
|
||||
#print(receiver)
|
||||
# sending message using telegram client
|
||||
#client.send_message(receiver, message, parse_mode='html')
|
||||
client.send_message(1463709677, "test message", parse_mode='html')
|
||||
print("C")
|
||||
except Exception as e:
|
||||
|
||||
# there may be many error coming in while like peer
|
||||
|
||||
Reference in New Issue
Block a user