Share your repls and programming experiences

← Back to all posts
PyCord, An extremely lightweight python discord library
h
CSharpIsGud (207)

This is a discord package for python with only one dependency: websockets. Everything else is done with pythons built-ins!

There is a simple example bot with 2 commands, ping and clear. Might write some basic documentation later on

What it can do:
Send messages
Receive messages and respond to them
Retrieve guild ids/names and textchannels
Bulk Delete messages in channels
Get users id and username
What it cant do(yet):
everything else

Commentshotnewtop
Haaruun (93)

You can use the builtin socket library to replace websockets

CSharpIsGud (207)

@Haaruun Yes, but you would have to implement the entire websocket protocol yourself and if you don't do it right it could cause big issues down the road.

Haaruun (93)

True, just saying if you wanted to go compleatly standerd library. @CSharpIsGud

IreoluwaRaufu (204)

Absolutely Beautiful!

MarcusWeinberger (182)

Is this available from PyPI? If not, can you make it so?

CSharpIsGud (207)

@MarcusWeinberger Sure I can do that, but its nowhere near being able to compete with discord.py, once it gets to that point it would probably exceed it due to only needing one dependency(discord.py has atleast more than 4 due to depending on aiohttp which requires many more)

Thecrowbar1234 (118)

I am his 69th upvoter, and I am pround of that

endercowINC (2)

Traceback (most recent call last):
File "main.py", line 27, in <module>
cli.connect(environ["TOKEN"])
File "/usr/local/lib/python3.8/os.py", line 673, in getitem
raise KeyError(key) from None
KeyError: 'TOKEN'

CSharpIsGud (207)

@endercowINC You have to fork it and make a .env file TOKEN="BOT_TOKEN"