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

Commit

Permalink
🚀 Pypi 0.3.0dev1 - Basic events support!
Browse files Browse the repository at this point in the history
  • Loading branch information
Sigmanificient committed Aug 31, 2021
1 parent 945e5ee commit 6c4d54c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 26 deletions.
52 changes: 27 additions & 25 deletions docs/PYPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,49 +73,51 @@ py -m pip install pincer
- Dispatcher
- Logging
- HTTP Client
- Client base class
- *New* basic events

**HTTP client example**: *Adding a reaction to a message*
```py
import asyncio

from pincer.core.http import HTTPClient
**Client base class Example:**

client = HTTPClient("...")
```py
from pincer.client import Bot

CHANNEL_ID: int = ...
MESSAGE_ID: int = ...
REACTION: str = ...
# see: https://discord.com/developers/docs/resources/channel#get-channel
# Note that both `Bot` and `Client` are valid!
bot = Bot("...")
bot.run()
```

**An example on `on_ready` event

async def add_reaction() -> None:
await client.put(
f'channels/{CHANNEL_ID}/messages/{MESSAGE_ID}/reactions/{REACTION}/@me',
{}
)
```py
from time import perf_counter
from pincer.client import Client

client = Client("...")

def main() -> None:
loop = asyncio.get_event_loop()
loop.run_until_complete(add_reaction())

@client.event
async def on_ready():
print(f"Logged in as {client.bot} after {perf_counter()} seconds")

if __name__ == '__main__':
main()

client.run()
```

- *New* Client base class
### Enable the debug mode

**Client base class Example:**
*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!*

```py
from pincer.client import Bot
import logging

bot = Bot("...")
bot.run()
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!*


## 🏷️ License

Expand Down
2 changes: 1 addition & 1 deletion pincer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
__package__ = "Pincer"
__author__ = "Sigmanificient, Arthurdw"
__license__ = "MIT"
__version__ = "0.2.0.dev"
__version__ = "0.3.0.dev"
__description__ = "Discord API wrapper rebuild from scratch."

0 comments on commit 6c4d54c

Please sign in to comment.