Skip to content
This repository has been archived by the owner on Sep 29, 2020. It is now read-only.
/ disco Public archive
forked from b1naryth1ef/disco

Here lies the remains of the precursor to BetterDisco [for compatibility reasons -- there are others that are dependent on this repo]. All future updates may be found at the link below.

Notifications You must be signed in to change notification settings

elderlabs/disco

This branch is 5 commits behind b1naryth1ef/disco:master.

Folders and files

NameName
Last commit message
Last commit date
Dec 20, 2019
Apr 5, 2019
Dec 1, 2018
Mar 9, 2019
May 26, 2017
Oct 30, 2018
Mar 9, 2019
Dec 1, 2018
Feb 13, 2018
Oct 6, 2016
Nov 2, 2019
Dec 2, 2018
Jul 18, 2017
Nov 20, 2019

Repository files navigation

disco

PyPI PyPI TravisCI

Disco is an extensive and extendable Python 2.x/3.x library for the Discord API. Disco 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 2.x/3.x
  • Evented networking and IO using Gevent

Installation

Disco was built to run both as a generic-use library, and a standalone bot toolkit. Installing disco is as easy as running pip install disco-py, 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:

from disco.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', '<content:str...>')
    def on_echo_command(self, event, content):
        event.msg.reply(content)

Using the default bot configuration, we can now run this script like so:

python -m disco.cli --token="MY_DISCORD_TOKEN" --run-bot --plugin simpleplugin

And commands can be triggered by mentioning the bot (configured by the BotConfig.command_require_mention flag):

About

Here lies the remains of the precursor to BetterDisco [for compatibility reasons -- there are others that are dependent on this repo]. All future updates may be found at the link below.

Topics

Resources

Stars

Watchers

Forks

Languages

  • Python 100.0%