Skip to content
This repository has been archived by the owner on Dec 26, 2022. It is now read-only.

Pincer 0.4.1 - Documentation Improvements

Pre-release
Pre-release
Compare
Choose a tag to compare
@Sigmanificient Sigmanificient released this 05 Sep 17:35

📌 Links

Join the Discord server: https://discord.gg/8WkYz3fNFm
The PyPI package: https://pypi.org/project/Pincer
Our website: https://pincer.dev
ReadTheDoc: https://pincer.readthedocs.io/en/latest/pincer.html

Current Features

  • Dispatcher
  • Logging
  • HTTP Client
  • Client base class
  • Basic events
  • Better documentation & sphinx ReadTheDoc

The documentation has been 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 the 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:

https://github.com/Pincer-org/Pincer-bot

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 out of curiosity or to get a deeper insight into the implementation
of some features, we provide debug logging!

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

Within the version 0.4.0-dev, the middleware system has been re-created,
and now advanced users can utilize them; however, it should be done carefully.

A /say command early implementation using middleware

https://gist.github.com/Arthurdw/e110ebbdafca388722f25ddb79c1dfb8