Pincer 0.4.0 - Middlewares System rewrite
Pre-release- Dispatcher
- Logging Improved
- HTTP Client
- Client base class
- Basic events Improved
Client base class example:
from pincer.client import Bot
# Note that both `Bot` and `Client` are valid!
bot = Bot("...")
bot.run()
An example on on_ready
event
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.
class Bot(Client):
def __init__(self) -> None:
super(Bot, self).__init__(token='...')
@Client.event
async def on_ready(self) -> None:
...
See an advanced bot implementation:
Advanced Usage
Warning: These features are meant for advanced developers to make early experimentation with Pincer.
Enable the debug mode
If you want to see everything that is happening under the hood,
either for curiosity or the implementation of some features,
we provide a debug logging!
import logging
logging.basicConfig(level=logging.DEBUG)
Note: A lot of printing can happen, with sensitive information,
make sure to be aware or what your doing if your enable it!
middleware
Within the version 0.4.0-dev, middleware system has been re-created,
and now also advanced user to use them. However, it should be used carefully.
An /say command early implementation, using middleware
https://gist.github.com/Arthurdw/e110ebbdafca388722f25ddb79c1dfb8