From 784849f547debdb50e73bfea6f7dafbe24febc82 Mon Sep 17 00:00:00 2001 From: Soheab Date: Wed, 12 Aug 2020 16:53:27 +0200 Subject: [PATCH] docs.md and README.md improvements. --- README.md | 19 ++++++++----------- changelog.md | 3 +++ docs.md | 24 ++++++++++++++---------- setup.py | 12 ++++++------ vacefron/client.py | 2 +- 5 files changed, 32 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 126d3cd..16a954c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ [![Downloads](https://pepy.tech/badge/vacefron-py)](https://pepy.tech/project/vacefron-py) [![MIT License](https://img.shields.io/apm/l/atomic-design-ui.svg?)](https://github.com/tterb/atomic-design-ui/blob/master/LICENSEs) - # VACEfron.py A Wrapper for [vacefron.nl/api](https://vacefron.nl/api/) written in Python. @@ -26,7 +25,7 @@ See the changelog for each [version here](https://github.com/Soheab/vacefron.py/ # Examples -Generate a [Rank card](https://github.com/Soheab/vacefron.py/blob/master/docs.md#await-vac_apirank_cardusername-avatar--level-rank-current_xp-next_level_xp-previous_level_xp-custom_background-xp_color-is_boosting) with [discord.py](https://github.com/Rapptz/discord.py): +Generate a [Rank card](docs.md#rank-card) with [discord.py](https://github.com/Rapptz/discord.py): ```python import vacefron import json @@ -42,7 +41,7 @@ async def rank(ctx): with open("ranks.json") as f: ranks = json.load(f) - info = ranks[f"{ctx.author.id}"] + info = ranks[str(ctx.author.id)] boosting = True if ctx.author.premium_since else False gen_card = await vac_api.rank_card( username = ctx.author, @@ -54,15 +53,13 @@ async def rank(ctx): previous_level_xp = 50, is_boosting = boosting ) - rank_bytes = await gen_card.read() - await ctx.send(f"{ctx.author.name}'s rank in {ctx.guild.name}", - file = discord.File(rank_bytes, "rank.png") - ) + rank_image = discord.File(fp = await gen_card.read(), filename = f"{ctx.author}_rank.png") + await ctx.send(f"{ctx.author.name}'s rank in {ctx.guild.name}", file = rank_image) # is_boosting, custom_background and xp_color are optional, see more in the docs. ``` -[I can milk you meme](https://github.com/Soheab/vacefron.py/blob/master/docs.md#await-vac_apii_can_milk_youuser-user2) with [discord.py](https://github.com/Rapptz/discord.py): +[I can milk you meme](docs.md#await-vac_apii_can_milk_youuser-user2) with [discord.py](https://github.com/Rapptz/discord.py): ```python import vacefron import discord @@ -73,9 +70,9 @@ vac_api = vacefron.Client() @bot.command() async def icanmilkyou(ctx, face: discord.Member, cow: discord.Member): - yes = await vac_api.i_can_milk_you(face.avatar_url, cow.avatar_url) - yes_bytes = discord.File(await yes.read(), "yes.png") - await ctx.send(file=yes_bytes) + meme = await vac_api.i_can_milk_you(face.avatar_url, cow.avatar_url) + meme_image = discord.File(fp = await meme.read(), filename = "let_me_milk_you.png") + await ctx.send(file=meme_image) ``` # Made by diff --git a/changelog.md b/changelog.md index 538c265..e3abd90 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,9 @@ # VACEfron.py | Changelog See here what changed or broke each version. +## v1.0.2 +- docs.md and README.md improvements. New version to update it on PyPi. + ## v1.0.1 - Added an optional `session` param to `vacefron.Client()`. - Renamed `_session` to `session` diff --git a/docs.md b/docs.md index 7bd8d3c..88bf661 100644 --- a/docs.md +++ b/docs.md @@ -4,9 +4,7 @@ For any questions and support, you can join [VAC Efron's server](https://discord ## Getting Started: -To begin with, you'll have -=============================== - to install the package by doing one of the following commands: +To begin with, you'll have to install the package by doing one of the following commands: - `pip install -U vacefron.py` - `python -m pip -U install vacefron.py` @@ -17,14 +15,19 @@ import vacefron vac_api = vacefron.Client() ``` -For future reference in this documentation: when referring to 'vac_api' we refer to that above! + +For future reference in this documentation: when referring to 'vac_api' we refer to that above. ## Using the wrapper: All available endpoints you can use. +All available endpoints you can use. -### await vac_api.rank_card(username, avatar, level, rank, current_xp, next_level_xp, previous_level_xp, custom_background, xp_color, is_boosting) -Generate a custom Rank card for Discord bots! +### Rank card + +--- +#### await vac_api.rank_card(username, avatar, level, rank, current_xp, next_level_xp, previous_level_xp, custom_background, xp_color, is_boosting) +Generate a Rank card for Discord bots! **Parameters**: - username `string` | The user's name. @@ -35,15 +38,16 @@ Generate a custom Rank card for Discord bots! - next_level_xp `int` | The user's next XP amount. - previous_level_xp `int` | The user's previous XP amount. - custom_background `string` | A optional background for the rank card. -- xp_color `string` | The color for the XP bar. Default to #FCBA41. -- is_boosting `bool` | If True, a boost badge will be displayed next to user's name +- xp_color `string` | The color for the XP bar. Defaults to #FCBA41. +- is_boosting `bool` | If True, a boost badge will be displayed next to user's name. Defaults to False. **Return type**: [Image](docs.md#image "Image object attributes") --- ### await vac_api.car_reverse(text) Generate that "car reverse" meme with your own text. - + + **Parameters**: - text `string` | Your text. @@ -88,7 +92,7 @@ Generate that "I am speed" meme with someone's avatar. --- ### await vac_api.i_can_milk_you(user, user2) Generate that "I can milk you" meme from Markiplier with someone's avatar. - + **Parameters**: - user `string` | Avatar of user. ~~on Markiplier~~ - user1 `string` | Avatar of user. ~~on the Cow~~ diff --git a/setup.py b/setup.py index acc4725..f298155 100644 --- a/setup.py +++ b/setup.py @@ -8,20 +8,20 @@ description = 'A Wrapper for vacefron.nl/api written in Python.', long_description = readme, long_description_content_type = 'text/markdown', - version = '1.0.1', + version = '1.0.2', packages = ['vacefron'], url = 'https://github.com/Soheab/vacefron.py', - download_url = 'https://github.com/Soheab/vacefron.py/archive/v1.0.1.tar.gz', + download_url = 'https://github.com/Soheab/vacefron.py/archive/v1.0.2.tar.gz', license = 'MIT', author = 'Soheab_', install_requires = ['aiohttp'], keywords = ['vacefron', 'discord', 'api'], project_urls = { - "Discord": "https://discord.gg/xJ2HRxZ", - "Source": "https://github.com/Soheab/vacefron.py", + "Discord": "https://discord.gg/xJ2HRxZ", + "Source": "https://github.com/Soheab/vacefron.py", "Documentation": "https://github.com/Soheab/vacefron.py/blob/master/docs.md", "Issue tracker": "https://github.com/Soheab/vacefron.py/issues", - }, + }, python_requires = '>=3.6', - ) +) diff --git a/vacefron/client.py b/vacefron/client.py index 69c1967..7dd9cb9 100644 --- a/vacefron/client.py +++ b/vacefron/client.py @@ -33,7 +33,7 @@ def _parse_text(text: str) -> str: "^": "%CB%86", "_": "%5F", "©": "%C2%A9" - } + } return text.translate(str.maketrans(replacements))