Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
rking32 committed Sep 27, 2020
1 parent 43440ac commit f697a91
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,28 @@
## Example Plugin 🤨

```python
from userge import userge, Message
from userge import userge, Message, filters

LOG = userge.getLogger(__name__) # logger object

CHANNEL = userge.getCLogger(__name__) # channel logger object

@userge.on_cmd("test", about="help text to this command") # adding handler and help text to .test command
async def testing(message: Message):
# add command handler
@userge.on_cmd("test", about="help text to this command")
async def test_cmd(message: Message):
LOG.info("starting test command...") # log to console

# some other stuff
await message.edit("testing...", del_in=5) # this will be automatically deleted after 5 sec

# some other stuff
await CHANNEL.log("testing completed!") # log to channel

# add filters handler
@userge.on_filters(filters.me & filters.private) # filter my private messages
async def test_filter(message: Message):
LOG.info("starting filter command...")
# some other stuff
await message.reply(f"you typed - {message.text}", del_in=5)
# some other stuff
await CHANNEL.log("filter executed!")
```

## Requirements 🥴
Expand Down

0 comments on commit f697a91

Please sign in to comment.