Bavera
Bavera is an extensive and extendable Python 3.x library for the Discord API. Bavera boasts the following major features:
- Expressive, functional interface that gets out of the way
- Built for high-performance and efficiency
- Configurable and modular, take the bits you need
- Full support for Python 3.x
- Evented networking and IO using Gevent
Installation
Bavera was built to run both as a generic-use library, and a standalone bot toolkit. Installing bavera is as easy as running pip install bavera
, however some extra packages are recommended for power-users, namely:
Name | Reason |
---|---|
requests[security] | adds packages for a proper SSL implementation |
ujson | faster json parser, improves performance |
erlpack (2.x), earl-etf (3.x) | ETF parser run with the –encoder=etf flag |
gipc | Gevent IPC, required for autosharding |
Examples
Simple bot using the builtin bot authoring tools:
<div class="highlight highlight-source-python position-relative overflow-auto" data-snippet-clipboard-copy-content="from bavera.bot import Bot, Plugin
class SimplePlugin(Plugin):
# Plugins provide an easy interface for listening to Discord events
@Plugin.listen('ChannelCreate')
def on_channel_create(self, event):
event.channel.send_message('Woah, a new channel huh!')
# They also provide an easy-to-use command component
@Plugin.command('ping')
def on_ping_command(self, event):
event.msg.reply('Pong!')
# Which includes command argument parsing
@Plugin.command('echo', '’)
def on_echo_command(self, event, content):
event.msg.reply(content)
“>
from bavera.bot import Bot, Plugin class SimplePlugin(Plugin): # Plugins provide an easy interface for listening to Discord events @Plugin.listen('ChannelCreate') def on_channel_create(self, event): event.channel.send_message('Woah, a new channel huh!') # They also provide an easy-to-use command component @Plugin.command('ping') def on_ping_command(self, event): event.msg.reply('Pong!') # Which includes command argument parsing @Plugin.command('echo', ' ' ) def on_echo_command(self, event, content): event.msg.reply(content)