Skip to content

thegamecracks/discord-ws

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A minimal, asynchronous Python wrapper for the Discord Gateway API.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages