Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: 6 days ago
JSON representation

pycord - A discord api wrapper written in python!

Awesome Lists containing this project

README

        



NOTE: This is a dead project.




python 3.6
docs


## 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)
```