1

trying to explore telegram python and create an automation that can send data, but for now I'am trying to connect my server with centOS to telegram during my testing I received an error when I run the python script, is there someone know what I need to check or modify to my script?

Error:

Request caused struct.error: required argument is not an integer: SendMessageRequest(peer=InputPeerUser(user_id='user_id', access_hash='user_hash'), message='Testing...', no_webpage=False, silent=None, background=None, clear_draft=False, reply_to_msg_id=None, random_id=57746331822001234, reply_markup=None, entities=[], schedule_date=None)

api_id = 'telegram app id'
api_hash = 'telegram hash'
token = 'telegram token'
message = "Testing..."
phone = '213phoneNumber'


client = TelegramClient('session', api_id, api_hash)


client.connect()

if not client.is_user_authorized():

        client.send_code_request(phone)

    
        client.sign_in(phone, input('Enter the code:'))


try:
        receiver = InputPeerUser('user_id', 'user_hash')

     
        client.send_message(receiver, message, parse_mode='html')
except Exception as e:

        print(e);


client.disconnect()
rodskies
  • 119
  • 1
  • 11

0 Answers0