From 38812ae0ba36e16591accbfdf8b45c10cba93a5a Mon Sep 17 00:00:00 2001 From: Lunarmagpie Date: Tue, 28 Dec 2021 13:18:57 -0500 Subject: [PATCH 01/13] :memo: updated README --- docs/PYPI.md | 190 ------------------------------------------------- docs/README.md | 67 +++++++---------- setup.cfg | 2 +- 3 files changed, 26 insertions(+), 233 deletions(-) delete mode 100644 docs/PYPI.md diff --git a/docs/PYPI.md b/docs/PYPI.md deleted file mode 100644 index 807a2d44..00000000 --- a/docs/PYPI.md +++ /dev/null @@ -1,190 +0,0 @@ -# Pincer - -[![PyPI - Downloads](https://img.shields.io/badge/dynamic/json?label=downloads&query=%24.total_downloads&url=https%3A%2F%2Fapi.pepy.tech%2Fapi%2Fprojects%2FPincer)](https://pypi.org/project/Pincer) -![PyPI](https://img.shields.io/pypi/v/Pincer) -![PyPI - Format](https://img.shields.io/pypi/format/Pincer) -![PyPI - Python Version](https://img.shields.io/pypi/pyversions/Pincer) -[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Pincer-org/pincer/badges/quality-score.png?b=main)](https://scrutinizer-ci.com/g/Pincer-org/pincer/?branch=main) -[![Build Status](https://scrutinizer-ci.com/g/Pincer-org/Pincer/badges/build.png?b=main)](https://scrutinizer-ci.com/g/Pincer-org/Pincer/build-status/main) -[![Documentation Status](https://readthedocs.org/projects/pincer/badge/?version=latest)](https://pincer.readthedocs.io/en/latest/?badge=latest) -[![codecov](https://codecov.io/gh/Pincer-org/Pincer/branch/main/graph/badge.svg?token=T15T34KOQW)](https://codecov.io/gh/Pincer-org/Pincer) -![Lines of code](https://tokei.rs/b1/github/pincer-org/pincer?category=code&path=pincer) -![Repo Size](https://img.shields.io/github/repo-size/Pincer-org/Pincer) -![GitHub last commit](https://img.shields.io/github/last-commit/Pincer-org/Pincer) -![GitHub commit activity](https://img.shields.io/github/commit-activity/m/Pincer-org/Pincer) -![GitHub](https://img.shields.io/github/license/Pincer-org/Pincer) -![Discord](https://img.shields.io/discord/881531065859190804) -[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) - -An asynchronous Python API wrapper meant to replace discord.py - -## The package is currently within the pre-alpha phase - -## 📌 Links - -> Join the Discord server: -> The PyPI package: -> Our website: -> ReadTheDocs: - -## ☄️ Installation - -Use the following command to install Pincer into your Python environment: - -```bash -pip install pincer -``` - -
- - - ⚙️ Didn't work? - - -Depending on your Python installation, you might need to use one of the -following: - -- Python is not in PATH - - ```sh - path/to/python.exe -m pip install pincer - ``` - -- Python is in PATH but pip is not - - ```sh - python -m pip install pincer - ``` - -- Unix systems can use pip3/python3 commands - - ```sh - pip3 install pincer - ``` - - ```sh - python3 -m pip install pincer - ``` - -- Using multiple Python versions - - ```sh - py -m pip install pincer - ``` - -
- -## Current Features - -- Discord Gateway communication -- logging -- Http Client -- Events -- Event middleware -- Commands -- Command arguments *(for types: str, int, float, bool, User, Channel, Role)* -- Command argument choices -- Command argument descriptions -- Command cool downs (Using WindowSliding technique) -- Tasks -- Cogs - -**Client base class example:** - -```py -from pincer.client import Bot - -# Note that both `Bot` and `Client` are valid! -bot = Bot("...") -bot.run() -``` - -**An example on the `on_ready` event** - -```py -from time import perf_counter -from pincer.client import Client - -client = Client("...") - - -@client.event -async def on_ready(): - print(f"Logged in as {client.bot} after {perf_counter()} seconds") - - -client.run() -``` - -### Inherited client - -You have the possibility to use your own class to inherit from the Pincer bot -base. - -```py -from pincer import Client -from pincer.commands import command, CommandArg, Description - -class Bot(Client): - def __init__(self) -> None: - super(Bot, self).__init__(token="...") - - @Client.event - async def on_ready(self) -> None: - ... - - @command(description="Say something as the bot!") - async def say(self, message: str): - return message - - @command(description="Add two numbers!") - async def add( - self, - first: CommandArg[int, Description["The first number"]], - second: CommandArg[int, Description["The second number"]] - ): - return f"The addition of `{first}` and `{second}` is `{first + second}`" -``` - -For more examples you can take a look at the examples folder or check out our -bot on GitHub: - -> - -### Advanced Usage - -#### Enable the debug mode - -_If you want to see everything that is happening under the hood, either out of -curiosity or to get a deeper insight into the implementation of some features, -we provide debug logging!_ - -```py -import logging - -logging.basicConfig(level=logging.DEBUG) -``` - -**Note:** _A lot of printing can happen, including sensitive information, so -make sure to be aware of what you're doing if you're enabling it!_ - -#### Middleware - -_From version 0.4.0-dev, the middleware system has been introduced. This system -gives you the full freedom to remove the already existing middleware which has -been created by the developers and create custom events. Your custom middleware -directly receives the payload from Discord. You can't really do anything wrong -without accessing the `override` attribute, but if you access this attribute the -Pincer team will not provide any support for weird behavior. So in short, only -use this if you know what you're doing. An example of using this with a custom -`on_ready` event can be found -[in our docs](https://pincer.readthedocs.io/en/latest/pincer.html#pincer.client.middleware) -._ - -## 🏷️ License - -`© 2021 copyright Pincer` - -This repository is licensed under the MIT License. - -See LICENSE for details. diff --git a/docs/README.md b/docs/README.md index 5f799d62..879ac4bd 100644 --- a/docs/README.md +++ b/docs/README.md @@ -82,79 +82,60 @@ following: -## Current Features - -- Discord Gateway communication -- logging -- Http Client -- Events -- Event middleware -- Commands -- Command arguments *(for types: str, int, float, bool, User, Channel, Role)* -- Command argument choices -- Command argument descriptions -- Command cool downs (Using WindowSliding technique) -- Tasks -- Cogs - **Client base class example:** ```py from pincer.client import Bot # Note that both `Bot` and `Client` are valid! -bot = Bot("...") +bot = Bot("YOUR_TOKEN_HERE") bot.run() ``` **An example on the `on_ready` event** +Pincer is designed to be used by inheriting the Client. + ```py from time import perf_counter -from pincer.client import Client - -client = Client("...") - - -@client.event -async def on_ready(): - print(f"Logged in as {client.bot} after {perf_counter()} seconds") +from pincer import Bot +class Client(Bot): + @client.event + async def on_ready(): + print(f"Logged in as {client.bot} after {perf_counter()} seconds") +client = Client("YOUR_TOKEN_HERE") client.run() ``` -### Inherited client +### Interactions -You have the possibility to use your own class to inherit from the Pincer bot -base. +Pincer is designed to make developing application commands intuitive and fast. ```py from pincer import Client from pincer.commands import command, CommandArg, Description +from pincer.objects import UserMessage, User class Bot(Client): - def __init__(self) -> None: - super(Bot, self).__init__(token="...") - @Client.event async def on_ready(self) -> None: ... @command(description="Say something as the bot!") - # Pincer uses type hints to specify the argument type - # str - String - # int - Integer - # bool - Boolean - # float - Number - # pincer.objects.User - User - # pincer.objects.Channel - Channel - # pincer.objects.Role - Role - # pincer.objects.Mentionable - Mentionable async def say(self, message: str): return message + @user_command + async def user_command(self, user: User): + return f"The user is {user}" + + @message_command(name="Message command") + async def message_command(self, message: UserMessage): + return f"The message read \"{message.content}\"" + @command(description="Add two numbers!") async def add( self, @@ -162,6 +143,8 @@ class Bot(Client): second: CommandArg[int, Description["The second number"]] ): return f"The addition of `{first}` and `{second}` is `{first + second}`" + + ``` For more examples you can take a look at the examples folder or check out our @@ -169,6 +152,9 @@ bot: > +You can also read the interactions guide for more information: +> + ### Advanced Usage #### Enable the debug mode @@ -183,9 +169,6 @@ import logging logging.basicConfig(level=logging.DEBUG) ``` -**Note:** _A lot of printing can happen, including sensitive information, so -make sure to be aware of what you're doing if you're enabling it!_ - #### Middleware _From version 0.4.0-dev, the middleware system has been introduced. This system diff --git a/setup.cfg b/setup.cfg index 3eb6754b..f639768d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ name = pincer version = 0.14.0 description = Discord API wrapper rebuild from scratch. -long_description = file: docs/PYPI.md +long_description = file: docs/README.md long_description_content_type = text/markdown author = Pincer-org author_email = contact@pincer.dev From caba4e4816cfb6162ecdb81d2729fd47eb20a8bb Mon Sep 17 00:00:00 2001 From: Lunarmagpie Date: Tue, 28 Dec 2021 13:22:35 -0500 Subject: [PATCH 02/13] :art: changed import from Bot to Client --- docs/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/README.md b/docs/README.md index 879ac4bd..f7b60fa0 100644 --- a/docs/README.md +++ b/docs/README.md @@ -98,14 +98,14 @@ Pincer is designed to be used by inheriting the Client. ```py from time import perf_counter -from pincer import Bot +from pincer import Client -class Client(Bot): - @client.event +class Bot(Client): + @Client.event async def on_ready(): print(f"Logged in as {client.bot} after {perf_counter()} seconds") -client = Client("YOUR_TOKEN_HERE") +client = Bot("YOUR_TOKEN_HERE") client.run() ``` From a69c4644e3bff5fe106fe82649381d041a41b095 Mon Sep 17 00:00:00 2001 From: Lunarmagpie Date: Tue, 28 Dec 2021 16:11:48 -0500 Subject: [PATCH 03/13] :truck: restored PYPI.md --- docs/PYPI.md | 190 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100644 docs/PYPI.md diff --git a/docs/PYPI.md b/docs/PYPI.md new file mode 100644 index 00000000..807a2d44 --- /dev/null +++ b/docs/PYPI.md @@ -0,0 +1,190 @@ +# Pincer + +[![PyPI - Downloads](https://img.shields.io/badge/dynamic/json?label=downloads&query=%24.total_downloads&url=https%3A%2F%2Fapi.pepy.tech%2Fapi%2Fprojects%2FPincer)](https://pypi.org/project/Pincer) +![PyPI](https://img.shields.io/pypi/v/Pincer) +![PyPI - Format](https://img.shields.io/pypi/format/Pincer) +![PyPI - Python Version](https://img.shields.io/pypi/pyversions/Pincer) +[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Pincer-org/pincer/badges/quality-score.png?b=main)](https://scrutinizer-ci.com/g/Pincer-org/pincer/?branch=main) +[![Build Status](https://scrutinizer-ci.com/g/Pincer-org/Pincer/badges/build.png?b=main)](https://scrutinizer-ci.com/g/Pincer-org/Pincer/build-status/main) +[![Documentation Status](https://readthedocs.org/projects/pincer/badge/?version=latest)](https://pincer.readthedocs.io/en/latest/?badge=latest) +[![codecov](https://codecov.io/gh/Pincer-org/Pincer/branch/main/graph/badge.svg?token=T15T34KOQW)](https://codecov.io/gh/Pincer-org/Pincer) +![Lines of code](https://tokei.rs/b1/github/pincer-org/pincer?category=code&path=pincer) +![Repo Size](https://img.shields.io/github/repo-size/Pincer-org/Pincer) +![GitHub last commit](https://img.shields.io/github/last-commit/Pincer-org/Pincer) +![GitHub commit activity](https://img.shields.io/github/commit-activity/m/Pincer-org/Pincer) +![GitHub](https://img.shields.io/github/license/Pincer-org/Pincer) +![Discord](https://img.shields.io/discord/881531065859190804) +[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) + +An asynchronous Python API wrapper meant to replace discord.py + +## The package is currently within the pre-alpha phase + +## 📌 Links + +> Join the Discord server: +> The PyPI package: +> Our website: +> ReadTheDocs: + +## ☄️ Installation + +Use the following command to install Pincer into your Python environment: + +```bash +pip install pincer +``` + +
+ + + ⚙️ Didn't work? + + +Depending on your Python installation, you might need to use one of the +following: + +- Python is not in PATH + + ```sh + path/to/python.exe -m pip install pincer + ``` + +- Python is in PATH but pip is not + + ```sh + python -m pip install pincer + ``` + +- Unix systems can use pip3/python3 commands + + ```sh + pip3 install pincer + ``` + + ```sh + python3 -m pip install pincer + ``` + +- Using multiple Python versions + + ```sh + py -m pip install pincer + ``` + +
+ +## Current Features + +- Discord Gateway communication +- logging +- Http Client +- Events +- Event middleware +- Commands +- Command arguments *(for types: str, int, float, bool, User, Channel, Role)* +- Command argument choices +- Command argument descriptions +- Command cool downs (Using WindowSliding technique) +- Tasks +- Cogs + +**Client base class example:** + +```py +from pincer.client import Bot + +# Note that both `Bot` and `Client` are valid! +bot = Bot("...") +bot.run() +``` + +**An example on the `on_ready` event** + +```py +from time import perf_counter +from pincer.client import Client + +client = Client("...") + + +@client.event +async def on_ready(): + print(f"Logged in as {client.bot} after {perf_counter()} seconds") + + +client.run() +``` + +### Inherited client + +You have the possibility to use your own class to inherit from the Pincer bot +base. + +```py +from pincer import Client +from pincer.commands import command, CommandArg, Description + +class Bot(Client): + def __init__(self) -> None: + super(Bot, self).__init__(token="...") + + @Client.event + async def on_ready(self) -> None: + ... + + @command(description="Say something as the bot!") + async def say(self, message: str): + return message + + @command(description="Add two numbers!") + async def add( + self, + first: CommandArg[int, Description["The first number"]], + second: CommandArg[int, Description["The second number"]] + ): + return f"The addition of `{first}` and `{second}` is `{first + second}`" +``` + +For more examples you can take a look at the examples folder or check out our +bot on GitHub: + +> + +### Advanced Usage + +#### Enable the debug mode + +_If you want to see everything that is happening under the hood, either out of +curiosity or to get a deeper insight into the implementation of some features, +we provide debug logging!_ + +```py +import logging + +logging.basicConfig(level=logging.DEBUG) +``` + +**Note:** _A lot of printing can happen, including sensitive information, so +make sure to be aware of what you're doing if you're enabling it!_ + +#### Middleware + +_From version 0.4.0-dev, the middleware system has been introduced. This system +gives you the full freedom to remove the already existing middleware which has +been created by the developers and create custom events. Your custom middleware +directly receives the payload from Discord. You can't really do anything wrong +without accessing the `override` attribute, but if you access this attribute the +Pincer team will not provide any support for weird behavior. So in short, only +use this if you know what you're doing. An example of using this with a custom +`on_ready` event can be found +[in our docs](https://pincer.readthedocs.io/en/latest/pincer.html#pincer.client.middleware) +._ + +## 🏷️ License + +`© 2021 copyright Pincer` + +This repository is licensed under the MIT License. + +See LICENSE for details. From f33f5a63a4ffe9fbcd8d49fc6cd0550ec90e0b90 Mon Sep 17 00:00:00 2001 From: Lunarmagpie Date: Tue, 28 Dec 2021 16:12:35 -0500 Subject: [PATCH 04/13] :art: updated PYPI.md to match README.md --- docs/PYPI.md | 87 ++++++++++++++++++++++++++-------------------------- 1 file changed, 44 insertions(+), 43 deletions(-) diff --git a/docs/PYPI.md b/docs/PYPI.md index 807a2d44..d5688f83 100644 --- a/docs/PYPI.md +++ b/docs/PYPI.md @@ -11,30 +11,38 @@ ![Lines of code](https://tokei.rs/b1/github/pincer-org/pincer?category=code&path=pincer) ![Repo Size](https://img.shields.io/github/repo-size/Pincer-org/Pincer) ![GitHub last commit](https://img.shields.io/github/last-commit/Pincer-org/Pincer) -![GitHub commit activity](https://img.shields.io/github/commit-activity/m/Pincer-org/Pincer) +![GitHub commit activity](https://img.shields.io/github/commit-activity/m/Pincer-org/Pincer?label=commits) ![GitHub](https://img.shields.io/github/license/Pincer-org/Pincer) ![Discord](https://img.shields.io/discord/881531065859190804) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) -An asynchronous Python API wrapper meant to replace discord.py +# Pincer Logo Pincer +The snappy asynchronous discord api wrapper API wrapper written with aiohttp & websockets. -## The package is currently within the pre-alpha phase +| :exclamation: | The package is currently within Pre-Alpha phase | +| ------------- | :---------------------------------------------- | -## 📌 Links +## :pushpin: Links -> Join the Discord server: -> The PyPI package: -> Our website: -> ReadTheDocs: +> Discord Logo |Join the Discord server: https://discord.gg/pincer
+> PyPI Logo |The PyPI package: https://pypi.org/project/Pincer
+> Pincer Logo |Our website: https://pincer.dev
+> 📝 | ReadTheDocs: https://pincer.readthedocs.io ## ☄️ Installation Use the following command to install Pincer into your Python environment: -```bash +```sh pip install pincer ``` +To install our version with Aiohttp Speedup do: + +```sh +pip install pincer[speed] +``` +
@@ -74,61 +82,44 @@ following:
-## Current Features - -- Discord Gateway communication -- logging -- Http Client -- Events -- Event middleware -- Commands -- Command arguments *(for types: str, int, float, bool, User, Channel, Role)* -- Command argument choices -- Command argument descriptions -- Command cool downs (Using WindowSliding technique) -- Tasks -- Cogs - **Client base class example:** ```py from pincer.client import Bot # Note that both `Bot` and `Client` are valid! -bot = Bot("...") +bot = Bot("YOUR_TOKEN_HERE") bot.run() ``` **An example on the `on_ready` event** +Pincer is designed to be used by inheriting the Client. + ```py from time import perf_counter -from pincer.client import Client - -client = Client("...") - - -@client.event -async def on_ready(): - print(f"Logged in as {client.bot} after {perf_counter()} seconds") +from pincer import Client +class Bot(Client): + @Client.event + async def on_ready(): + print(f"Logged in as {client.bot} after {perf_counter()} seconds") +client = Bot("YOUR_TOKEN_HERE") client.run() ``` -### Inherited client +### Interactions -You have the possibility to use your own class to inherit from the Pincer bot -base. +Pincer is designed to make developing application commands intuitive and fast. ```py from pincer import Client from pincer.commands import command, CommandArg, Description +from pincer.objects import UserMessage, User -class Bot(Client): - def __init__(self) -> None: - super(Bot, self).__init__(token="...") +class Bot(Client): @Client.event async def on_ready(self) -> None: ... @@ -137,6 +128,14 @@ class Bot(Client): async def say(self, message: str): return message + @user_command + async def user_command(self, user: User): + return f"The user is {user}" + + @message_command(name="Message command") + async def message_command(self, message: UserMessage): + return f"The message read \"{message.content}\"" + @command(description="Add two numbers!") async def add( self, @@ -144,13 +143,18 @@ class Bot(Client): second: CommandArg[int, Description["The second number"]] ): return f"The addition of `{first}` and `{second}` is `{first + second}`" + + ``` For more examples you can take a look at the examples folder or check out our -bot on GitHub: +bot: > +You can also read the interactions guide for more information: +> + ### Advanced Usage #### Enable the debug mode @@ -165,9 +169,6 @@ import logging logging.basicConfig(level=logging.DEBUG) ``` -**Note:** _A lot of printing can happen, including sensitive information, so -make sure to be aware of what you're doing if you're enabling it!_ - #### Middleware _From version 0.4.0-dev, the middleware system has been introduced. This system From be94ec9af18ba97c34a4d918cf4dda61d41e3bf3 Mon Sep 17 00:00:00 2001 From: Lunarmagpie Date: Tue, 28 Dec 2021 16:14:02 -0500 Subject: [PATCH 05/13] :memo: changed stage to alpha --- docs/PYPI.md | 2 +- docs/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/PYPI.md b/docs/PYPI.md index d5688f83..c828408b 100644 --- a/docs/PYPI.md +++ b/docs/PYPI.md @@ -19,7 +19,7 @@ # Pincer Logo Pincer The snappy asynchronous discord api wrapper API wrapper written with aiohttp & websockets. -| :exclamation: | The package is currently within Pre-Alpha phase | +| :exclamation: | The package is currently within alpha phase | | ------------- | :---------------------------------------------- | ## :pushpin: Links diff --git a/docs/README.md b/docs/README.md index f7b60fa0..f5ffefbe 100644 --- a/docs/README.md +++ b/docs/README.md @@ -19,7 +19,7 @@ # Pincer Logo Pincer The snappy asynchronous discord api wrapper API wrapper written with aiohttp & websockets. -| :exclamation: | The package is currently within Pre-Alpha phase | +| :exclamation: | The package is currently within alpha phase | | ------------- | :---------------------------------------------- | ## :pushpin: Links From a55134afbe7c4d3129fdf673299a1d201743c55c Mon Sep 17 00:00:00 2001 From: Lunarmagpie <65521138+Lunarmagpie@users.noreply.github.com> Date: Wed, 29 Dec 2021 11:22:55 -0500 Subject: [PATCH 06/13] :bug: correct readme file in setup.cfg --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index f639768d..3eb6754b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ name = pincer version = 0.14.0 description = Discord API wrapper rebuild from scratch. -long_description = file: docs/README.md +long_description = file: docs/PYPI.md long_description_content_type = text/markdown author = Pincer-org author_email = contact@pincer.dev From 57c083abb15ccf9f34b34181db533f45b5e46fb8 Mon Sep 17 00:00:00 2001 From: Lunarmagpie <65521138+Lunarmagpie@users.noreply.github.com> Date: Wed, 29 Dec 2021 12:35:54 -0500 Subject: [PATCH 07/13] :art: Apply suggestions from code review Co-authored-by: trag1c <77130613+trag1c@users.noreply.github.com> --- docs/PYPI.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/PYPI.md b/docs/PYPI.md index c828408b..4e7b53a4 100644 --- a/docs/PYPI.md +++ b/docs/PYPI.md @@ -17,9 +17,9 @@ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) # Pincer Logo Pincer -The snappy asynchronous discord api wrapper API wrapper written with aiohttp & websockets. +The snappy asynchronous Discord API wrapper written with aiohttp. -| :exclamation: | The package is currently within alpha phase | +| :exclamation: | The package is currently within the Alpha phase | | ------------- | :---------------------------------------------- | ## :pushpin: Links @@ -37,7 +37,7 @@ Use the following command to install Pincer into your Python environment: pip install pincer ``` -To install our version with Aiohttp Speedup do: +To install our version with Aiohttp Speedup, use: ```sh pip install pincer[speed] @@ -138,16 +138,16 @@ class Bot(Client): @command(description="Add two numbers!") async def add( - self, - first: CommandArg[int, Description["The first number"]], - second: CommandArg[int, Description["The second number"]] + self, + first: CommandArg[int, Description["The first number"]], + second: CommandArg[int, Description["The second number"]] ): return f"The addition of `{first}` and `{second}` is `{first + second}`" ``` -For more examples you can take a look at the examples folder or check out our +For more examples, you can take a look at the examples folder or check out our bot: > From b2b2b8a0eef1018c0b379dd85fbd72bf23be020e Mon Sep 17 00:00:00 2001 From: Lunarmagpie Date: Wed, 29 Dec 2021 12:50:28 -0500 Subject: [PATCH 08/13] :art: more code review suggestions Signed-off-by: Lunarmagpie --- docs/README.md | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/docs/README.md b/docs/README.md index f5ffefbe..516de900 100644 --- a/docs/README.md +++ b/docs/README.md @@ -111,7 +111,7 @@ client.run() ### Interactions -Pincer is designed to make developing application commands intuitive and fast. +Pincer makes developing application commands intuitive and fast. ```py from pincer import Client @@ -147,8 +147,7 @@ class Bot(Client): ``` -For more examples you can take a look at the examples folder or check out our -bot: +For more examples you can take a look at the examples folder or check out our bot: > @@ -171,15 +170,14 @@ logging.basicConfig(level=logging.DEBUG) #### Middleware -_From version 0.4.0-dev, the middleware system has been introduced. This system -gives you the full freedom to remove the already existing middleware which has -been created by the developers and create custom events. Your custom middleware -directly receives the payload from Discord. You can't really do anything wrong -without accessing the `override` attribute, but if you access this attribute the -Pincer team will not provide any support for weird behavior. So in short, only -use this if you know what you're doing. An example of using this with a custom -`on_ready` event can be found -[in our docs](https://pincer.readthedocs.io/en/latest/pincer.html#pincer.client.middleware) +The middleware system was introduced in version `0.4.0-dev`. This system gives you the +freedom to create custom events and remove the already existing middleware created by +the developers. Your custom middleware directly receives the payload from +Discord. You can't do anything wrong without accessing the `override` attribute, but if +you do access it, the Pincer team will not provide any support for weird behavior. +So, in short, only use this if you know what you're doing. An example of using +the middleware system with a custom `on_ready` event can be found +[in our docs](https://pincer.readthedocs.io/en/latest/pincer.html#pincer.client.middleware). ._ ## 🏷️ License From 9ab8c2ed059f0c0534d8697ef348eb2d35b56b2a Mon Sep 17 00:00:00 2001 From: Lunarmagpie Date: Wed, 29 Dec 2021 15:34:09 -0500 Subject: [PATCH 09/13] :memo: move PYPI.md changes to README.md --- docs/PYPI.md | 22 +++++++++------------- docs/README.md | 21 +++++++++++---------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/docs/PYPI.md b/docs/PYPI.md index 4e7b53a4..b3369b6f 100644 --- a/docs/PYPI.md +++ b/docs/PYPI.md @@ -19,9 +19,6 @@ # Pincer Logo Pincer The snappy asynchronous Discord API wrapper written with aiohttp. -| :exclamation: | The package is currently within the Alpha phase | -| ------------- | :---------------------------------------------- | - ## :pushpin: Links > Discord Logo |Join the Discord server: https://discord.gg/pincer
@@ -134,7 +131,7 @@ class Bot(Client): @message_command(name="Message command") async def message_command(self, message: UserMessage): - return f"The message read \"{message.content}\"" + return f"The message read '{message.content}'" @command(description="Add two numbers!") async def add( @@ -171,15 +168,14 @@ logging.basicConfig(level=logging.DEBUG) #### Middleware -_From version 0.4.0-dev, the middleware system has been introduced. This system -gives you the full freedom to remove the already existing middleware which has -been created by the developers and create custom events. Your custom middleware -directly receives the payload from Discord. You can't really do anything wrong -without accessing the `override` attribute, but if you access this attribute the -Pincer team will not provide any support for weird behavior. So in short, only -use this if you know what you're doing. An example of using this with a custom -`on_ready` event can be found -[in our docs](https://pincer.readthedocs.io/en/latest/pincer.html#pincer.client.middleware) +_The middleware system was introduced in version `0.4.0-dev`. This system gives you the +freedom to create custom events and remove the already existing middleware created by +the developers. Your custom middleware directly receives the payload from +Discord. You can't do anything wrong without accessing the `override` attribute, but if +you do access it, the Pincer team will not provide any support for weird behavior. +So, in short, only use this if you know what you're doing. An example of using +the middleware system with a custom `on_ready` event can be found +[in our docs](https://pincer.readthedocs.io/en/latest/pincer.html#pincer.client.middleware). ._ ## 🏷️ License diff --git a/docs/README.md b/docs/README.md index 516de900..3cf46f27 100644 --- a/docs/README.md +++ b/docs/README.md @@ -17,9 +17,9 @@ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) # Pincer Logo Pincer -The snappy asynchronous discord api wrapper API wrapper written with aiohttp & websockets. +The snappy asynchronous Discord API wrapper written with aiohttp. -| :exclamation: | The package is currently within alpha phase | +| :exclamation: | The package is currently within the Alpha phase | | ------------- | :---------------------------------------------- | ## :pushpin: Links @@ -37,7 +37,7 @@ Use the following command to install Pincer into your Python environment: pip install pincer ``` -To install our version with Aiohttp Speedup do: +To install our version with Aiohttp Speedup, use: ```sh pip install pincer[speed] @@ -111,7 +111,7 @@ client.run() ### Interactions -Pincer makes developing application commands intuitive and fast. +Pincer is designed to make developing application commands intuitive and fast. ```py from pincer import Client @@ -134,20 +134,21 @@ class Bot(Client): @message_command(name="Message command") async def message_command(self, message: UserMessage): - return f"The message read \"{message.content}\"" + return f"The message read '{message.content}'" @command(description="Add two numbers!") async def add( - self, - first: CommandArg[int, Description["The first number"]], - second: CommandArg[int, Description["The second number"]] + self, + first: CommandArg[int, Description["The first number"]], + second: CommandArg[int, Description["The second number"]] ): return f"The addition of `{first}` and `{second}` is `{first + second}`" ``` -For more examples you can take a look at the examples folder or check out our bot: +For more examples, you can take a look at the examples folder or check out our +bot: > @@ -170,7 +171,7 @@ logging.basicConfig(level=logging.DEBUG) #### Middleware -The middleware system was introduced in version `0.4.0-dev`. This system gives you the +_The middleware system was introduced in version `0.4.0-dev`. This system gives you the freedom to create custom events and remove the already existing middleware created by the developers. Your custom middleware directly receives the payload from Discord. You can't do anything wrong without accessing the `override` attribute, but if From 99874b680b9531633c7da40d4ef1761388676513 Mon Sep 17 00:00:00 2001 From: Lunarmagpie Date: Wed, 29 Dec 2021 15:36:15 -0500 Subject: [PATCH 10/13] :memo: fast interactions test --- docs/PYPI.md | 2 +- docs/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/PYPI.md b/docs/PYPI.md index b3369b6f..1f005e69 100644 --- a/docs/PYPI.md +++ b/docs/PYPI.md @@ -91,7 +91,7 @@ bot.run() **An example on the `on_ready` event** -Pincer is designed to be used by inheriting the Client. +Pincer makes developing application commands intuitive and fast. ```py from time import perf_counter diff --git a/docs/README.md b/docs/README.md index 3cf46f27..37dccb1a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -94,7 +94,7 @@ bot.run() **An example on the `on_ready` event** -Pincer is designed to be used by inheriting the Client. +Pincer makes developing application commands intuitive and fast. ```py from time import perf_counter From 292b6423689f3f0ebf9fed089c22ef5db213fe2a Mon Sep 17 00:00:00 2001 From: Lunarmagpie Date: Thu, 30 Dec 2021 14:34:19 -0500 Subject: [PATCH 11/13] :speech_balloon: get rid of repeated sentance --- docs/PYPI.md | 7 ++----- docs/README.md | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/docs/PYPI.md b/docs/PYPI.md index 1f005e69..98c318c5 100644 --- a/docs/PYPI.md +++ b/docs/PYPI.md @@ -16,9 +16,6 @@ ![Discord](https://img.shields.io/discord/881531065859190804) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) -# Pincer Logo Pincer -The snappy asynchronous Discord API wrapper written with aiohttp. - ## :pushpin: Links > Discord Logo |Join the Discord server: https://discord.gg/pincer
@@ -91,7 +88,7 @@ bot.run() **An example on the `on_ready` event** -Pincer makes developing application commands intuitive and fast. +Pincer bots are required to inherit from the Client. ```py from time import perf_counter @@ -108,7 +105,7 @@ client.run() ### Interactions -Pincer is designed to make developing application commands intuitive and fast. +Pincer makes developing application commands intuitive and fast. ```py from pincer import Client diff --git a/docs/README.md b/docs/README.md index 37dccb1a..77d892f5 100644 --- a/docs/README.md +++ b/docs/README.md @@ -94,7 +94,7 @@ bot.run() **An example on the `on_ready` event** -Pincer makes developing application commands intuitive and fast. +Pincer bots are required to inherit from the Client. ```py from time import perf_counter @@ -111,7 +111,7 @@ client.run() ### Interactions -Pincer is designed to make developing application commands intuitive and fast. +Pincer makes developing application commands intuitive and fast. ```py from pincer import Client From 07a2d26a02519071f9be5d14259f9bcea6c03dd6 Mon Sep 17 00:00:00 2001 From: Lunarmagpie Date: Fri, 31 Dec 2021 15:45:44 -0500 Subject: [PATCH 12/13] :smile: added gitmoji --- docs/PYPI.md | 1 + docs/README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/PYPI.md b/docs/PYPI.md index 98c318c5..6e9e6078 100644 --- a/docs/PYPI.md +++ b/docs/PYPI.md @@ -15,6 +15,7 @@ ![GitHub](https://img.shields.io/github/license/Pincer-org/Pincer) ![Discord](https://img.shields.io/discord/881531065859190804) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) +![gitmoji](https://img.shields.io/badge/gitmoji-%20🚀%20💀-FFDD67.svg) ## :pushpin: Links diff --git a/docs/README.md b/docs/README.md index 77d892f5..f41f715b 100644 --- a/docs/README.md +++ b/docs/README.md @@ -15,6 +15,7 @@ ![GitHub](https://img.shields.io/github/license/Pincer-org/Pincer) ![Discord](https://img.shields.io/discord/881531065859190804) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) +![gitmoji](https://img.shields.io/badge/gitmoji-%20🚀%20💀-FFDD67.svg) # Pincer Logo Pincer The snappy asynchronous Discord API wrapper written with aiohttp. From 568356edbac1f01376de50a7283e51f340f97c8b Mon Sep 17 00:00:00 2001 From: Lunarmagpie Date: Fri, 31 Dec 2021 15:48:07 -0500 Subject: [PATCH 13/13] :bug: fix perf_counter in examples --- docs/PYPI.md | 7 ++++++- docs/README.md | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/PYPI.md b/docs/PYPI.md index 6e9e6078..e0686fd8 100644 --- a/docs/PYPI.md +++ b/docs/PYPI.md @@ -95,10 +95,15 @@ Pincer bots are required to inherit from the Client. from time import perf_counter from pincer import Client +marker = perf_counter() + + class Bot(Client): + @Client.event async def on_ready(): - print(f"Logged in as {client.bot} after {perf_counter()} seconds") + print(f"Logged in as {client.bot} after {perf_counter() - marker} seconds") + client = Bot("YOUR_TOKEN_HERE") client.run() diff --git a/docs/README.md b/docs/README.md index 84410504..7e5a4027 100644 --- a/docs/README.md +++ b/docs/README.md @@ -102,10 +102,15 @@ Pincer bots are required to inherit from the Client. from time import perf_counter from pincer import Client +marker = perf_counter() + + class Bot(Client): + @Client.event async def on_ready(): - print(f"Logged in as {client.bot} after {perf_counter()} seconds") + print(f"Logged in as {client.bot} after {perf_counter() - marker} seconds") + client = Bot("YOUR_TOKEN_HERE") client.run()