Highly abstracted and easy to use wrapper over the Wumpy project
Project description
Wumpy-bot
Easy to use high abstraction over other Wumpy subpackages.
This is the most beginner-friendly way to use Wumpy, and provides all features
of the Discord API. This is the primary package installed from PyPI when you
only specify wumpy
.
Getting started
All official Wumpy projects prioritise both asyncio and Trio support so you can run the bot under either:
import anyio
from wumpy.bot import Bot
bot = Bot('ABC123.XYZ789') # Replace with your token and keep it safe!
# This runs the bot with Trio as the event loop (recommended),
# use backend='asyncio' to run it under asyncio.
anyio.run(bot.run, backend='trio')
Registering listeners
Continuing from the previous code, you can register listeners for Discord events using Wumpy's rich event listeners:
import anyio
from wumpy.bot import Bot
from wumpy.bot.events import MessageDeleteEvent
bot = Bot('ABC123.XYZ789')
@bot.listener()
async def log_deleted_messages(event: MessageDeleteEvent):
print(f'Message {event.message_id} in {event.channel_id} was deleted')
anyio.run(bot.run, backend='trio')
The listener is registered with the @bot.listener()
decorator, which tells
Wumpy to read the annotation of the first parameter (name does not matter, but
here it is called event
) and register that function for the type of event
that it is typehinted as.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file wumpy-bot-0.1.0.tar.gz
.
File metadata
- Download URL: wumpy-bot-0.1.0.tar.gz
- Upload date:
- Size: 17.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.26.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa317d6ccb008fa7643c9eac02957a4570dae66ff58597883b8b2f115afef587 |
|
MD5 | 3b98befd9a2b68dc824c2d873c294b04 |
|
BLAKE2b-256 | e4b98576bf1288f57c82ed33722717f85d8a17211d4f539956a7f3f70357ad11 |
File details
Details for the file wumpy_bot-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: wumpy_bot-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.26.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | adf4ef086676b759121b5741fb24a72d2fdf8a9912d7d29bcea94a78eef234e7 |
|
MD5 | f4d032460eb1c2732ed1a185c64a1a55 |
|
BLAKE2b-256 | 64a28b31182877806a476927294e2ccf16f9ef25656de4a9ca0d214319b36075 |