Simple (relatively) typehinted Discord API Wrapper with type casting.
Made (and meant) to work in conjunction with MFramework.py hence it's usage on it's own is rather limited (Read: It's mainly a REST wrapper with Gateway's Dispatch)
- Generated 1:1 Mapping of models & endpoints based on Discord documentation. All endpoints are available as methods of
Client
. - In theory 100% of API coverage.
- Iterating prioritizable event listeners supporting predicates without blocking them.
- Differentiating direct messages from guild messages by prependeding them with
DIRECT_
. - Automatic skipping of events sent by bots (Those containing
is_bot
attribute set toTrue
) - Embed builder respecting message limits without throwing.
- Convenience methods for models in
types.py
. - Just a simple API wrapper with Gateway client without anything fancy, really.
Basic (Websocket) usage example:
cfg = {
"DiscordTokens": {
"Bot": "TOKEN"
}
}
from mdiscord import onDispatch, Message, Client
@onDispatch
async def message_create(ctx: Client, msg: Message):
pass
async def main():
client = Client("Bot", cfg, None, None)
while True:
async with client:
await client.receive()
import asyncio
asyncio.run(main())
HTTP only (REST) usage example:
from mdiscord.http_client import HTTP_Client
import asyncio
webhook_id = 0
webhook_token = ""
async def main():
e = HTTP_Client()
await e.execute_webhook(webhook_id, webhook_token, content="Hello")
asyncio.run(main())
While PR's are welcome, for command-related capability contributions, visit MFramework.py repo.