https://github.com/kyb3r/pycord
pycord - A discord api wrapper written in python!
https://github.com/kyb3r/pycord
api-client discord discord-api discord-bot pycord python-3-6
Last synced: about 1 year ago
JSON representation
pycord - A discord api wrapper written in python!
- Host: GitHub
- URL: https://github.com/kyb3r/pycord
- Owner: kyb3r
- License: mit
- Created: 2017-09-16T13:03:46.000Z (over 8 years ago)
- Default Branch: dev
- Last Pushed: 2020-11-29T09:32:39.000Z (over 5 years ago)
- Last Synced: 2025-03-23T19:23:12.995Z (about 1 year ago)
- Topics: api-client, discord, discord-api, discord-bot, pycord, python-3-6
- Language: Python
- Homepage:
- Size: 660 KB
- Stars: 36
- Watchers: 7
- Forks: 6
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
## About
Pycord is a Discord API wrapper currently in development. It's easy to use, object oriented and asynchronous using the `trio` async I/O library. It features a super simple commands framework inspired by discord.py's one that makes writing Discord bots a breeze.
## Installation
You can easily install the pre-release of this library by doing `pip3 install py-cord` (not the latest)
## Event Registration
```py
import pycord
client = pycord.Client()
@client.on('ready')
async def on_ready(time):
print(f'Booted up in {time:.2f} seconds')
print(f'Logged in as: {client.user}')
print(f'User ID: {client.user.id}')
print(f'Is Bot: {client.user.bot}')
print(f'With {len(client.guilds)} guilds')
@client.on('message')
async def ping_command(message):
if message.content.startswith('py.ping'):
await message.reply('Pong!')
message_count = 0
@client.on('message')
async def stats(message):
message_count += 1
# easily register multiple events
client.login('token')
```
### Quick Examples
How to send messages
```py
await ctx.reply('content')
await channel.send('content')
await message.reply('content')
await message.channel.send('content')
```
How to send embeds
```py
em = pycord.Embed(title='Hi there', color=0x00FFFF)
em.set_author('Bob')
em.add_field('oi','this is a value')
await channel.send('pretext', embed=em)
```
