Skip to content

Latest commit

 

History

History
69 lines (48 loc) · 1.98 KB

README.md

File metadata and controls

69 lines (48 loc) · 1.98 KB

discord-ws

A bare-bones asynchronous Python wrapper for the Discord Gateway API.

Note

This library is not associated with discord-ws on PyPI, which is written by a different author. For now, I am not planning to release this project on PyPI.

Features

Usage

Assuming you have Python 3.11+ and Git installed, you can install this library with:

pip install git+https://github.com/thegamecracks/discord-ws

If you want to test out the library without writing a script, create a bot on Discord's Developer Portal, copy your bot token, and try out the built-in CLI:

python -m discord_ws --standard-intents --zlib-stream

If you do want to write a script, import the library and use the Client class to establish a connection yourself:

import asyncio
import discord_ws

client = discord_ws.Client(
    token="Bot YOUR_TOKEN_HERE",
    intents=discord_ws.Intents.standard(),
)

@client.on_dispatch
async def handle_event(event: discord_ws.DispatchEvent):
    ...  # Do something with the events received from Discord

asyncio.run(client.run())

Resources

License

This project is written under the MIT license.