Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
shayanheidari01 authored Jan 9, 2024
1 parent 748e231 commit 45aebd8
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 45aebd8

Please sign in to comment.