From 45aebd84aed8a5056c8d825386aa19ff13580e42 Mon Sep 17 00:00:00 2001 From: Shayan Heidari <119259115+shayanheidari01@users.noreply.github.com> Date: Tue, 9 Jan 2024 17:43:21 +0330 Subject: [PATCH] Update README.md --- README.md | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 2f647f1..08c87e2 100644 --- a/README.md +++ b/README.md @@ -28,30 +28,31 @@ ### Async Accounts ```python -import asyncio -from rubpy import Client, handlers, Message +from rubpy import Client, filters, utils +from rubpy.types import Updates -async def main(): - async with Client(session='rubpy') as client: - @client.on(handlers.MessageUpdates()) - async def updates(message: Message): - await message.reply('`hello` __from__ **rubpy**') - await client.run_until_disconnected() +bot = Client(name='rubpy') + +@bot.on_message_updates(filters.text) +async def updates(update: Updates): + print(update) + await update.reply(utils.Code('hello') + utils.Underline('from') + utils.Bold('rubpy')) -asyncio.run(main()) +bot.run() ``` **Async Another Example:** ```python from rubpy import Client -from asyncio import run + +bot = Client(name='rubpy') async def main(): - async with Client(session='rubpy') as client: - result = await client.send_message('me', '`hello` __from__ **rubpy**') + async with bot: + result = await bot.send_message('me', '`hello` __from__ **rubpy**') print(result) -run(main()) +bot.run(main()) ``` ### Sync Accounts