RuntimeWarning: coroutine 'MessageMethods.send_message' was never awaited

import random
from telethon import TelegramClient, events


def main():
    api_id = 1234132
    api_hash = 'aewfawefawefef'

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

    @client.on(events.NewMessage(chats=('@username')))
    async def normal_handler(event):
        if event.message.button_count == 4:
            await event.message.click(random.randint(0, 3))
            client.disconnect()

    client.start()

    client.send_message('@username', 'hi')


if __name__ == '__main__':
    main()

Как избавиться от ошибки?

RuntimeWarning: coroutine 'MessageMethods.send_message' was never awaited
  client.send_message('@username', 'hi')
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Ответы (0 шт):