From 0a3c65654add4b73374c2130a1708541a924cfd7 Mon Sep 17 00:00:00 2001 From: grey-cat-1908 Date: Fri, 15 Apr 2022 23:09:24 +0300 Subject: [PATCH] chore(readme): Add examples and more information about melisa --- README.md | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 78 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f21a201..1d73853 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,82 @@ THIS LIBRARY IS CURRENTLY UNDER DEVELOPMENT! -## About -MelisaPy is a Python library for the [Discord API](https://discord.com/developers/docs/intro). +

Every provided example or a feature is not ready or may sbe changed in the future

+ +## About +MelisaPy is a Discord microframework for Python 3 +for the [Discord API](https://discord.com/developers/docs/intro). + +It supports Discord V10 REST API and Gateway + +We are trying to make our library optimized. +We are going to create really cool Cache configuration, so don't worry about the RAM :) + +--- + +## Events Listening + +```python +import melisa + +client = melisa.Client("your cool token...") + +@client.listen +async def on_message_create(message): + if message.content.startswith('$greet'): + await message.channel.send(f'Hello man!') + +client.run_autosharded() +``` + +Also, we should tell you, that logging is enabled automatically (evil laugh). +But do not worry, only some important things will be logged, but it can be disabled or changed. + +If you wish to specify some intents, you should do it something like that: + +```python +import melisa + +client = melisa.Client("your cool token...", + intents=[ + melisa.Intents.GUILD_MEMBERS, + melisa.Intents.GUILD_BANS + ]) +``` + +Or you can do something like this: + +```python +import melisa + +intents = melisa.Intents.all() - melisa.Intents.GUILD_PRESENCES + +client = melisa.Client("your cool token...", + intents=intents) +``` + +Also sharding is fully supported in Melisa, but it is too long to write about it here, +so feel free to read our docs! + +--- + +## Making your bot more efficient + +### Python optimization flags +You can specify some optimization flags in CPython interpreter + +1. `python bot.py` - no optimization +2. `python -O bot.py` - features such as internal assertions will be disabled. +3. `python -OO bot.py` - more features (including all docstrings) will be removed from the loaded code at runtime. + +### `melisa[speed]` +Also you can speed up some features in Melisa, like json parsing. +It will install `orjson`. + +--- + +## Want to help us? + +Contributing manual is not ready yet, but will be done in some days. +Feel free to us in [our Discord Server](https://discord.gg/QX4EG8f7aD) about contributing to the Melisa. -We are trying to make our library optimized. We are going to create really cool Cache configuration, so don't worry about the RAM :)