async def send_message(self, client: TelegramClient, chat_id: int, target: Message = None) -> Message: return await client.send_message( chat_id, file=InputMediaVenue(InputGeoPoint(0.0, 0.0), "Location name", f"Address {uuid4()}", "", "", ""), reply_to=target )
async def send_message(self, client: TelegramClient, chat_id: int, target: Message = None) -> Message: return await client.send_message( chat_id, file=InputMediaGeoLive( InputGeoPoint(random.uniform(0.0, 90.0), random.uniform(0.0, 90.0)), stopped=False, period=3600), reply_to=target )
async def send_message(self, client: TelegramClient, chat_id: int, target: Message = None) -> Message: return await client.send_message(chat_id, file=InputMediaGeoPoint( InputGeoPoint(0.0, 0.0)), reply_to=target)
def send_location(self, to, lat, long, first_name, last_name=None, title=None, address=None, provider=None, venue_id=None): contactModel = self.get_or_create_new_contact(to, first_name, last_name=last_name) if contactModel is None: return None peer_user = InputPeerUser(int(contactModel.user_id), int(contactModel.access_hash)) input_media = None if title is None and address is None: input_media = InputMediaGeoPoint(InputGeoPoint(lat, long)) else: geo = InputGeoPoint(lat, long) title = title if title is not None else '' address = address if address is not None else '' provider = provider if provider is not None else '' venue_id = venue_id if venue_id is not None else '' input_media = InputMediaVenue(geo, title, address, provider, venue_id) msg_id = self.send_media_file(input_media, peer_user) logging.debug('Contact sent!') logging.info('Send message id {}'.format(msg_id)) return msg_id
async def edit_message(self, client: TelegramClient, message: Message) -> Optional[Message]: return await message.edit( file=InputMediaGeoLive( InputGeoPoint(-random.uniform(0.0, 90.0), -random.uniform(0.0, 90.0)), stopped=True) )