Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

betterdisco-py

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

betterdisco-py

A Discord API library, written in Python, for those that like to dance. [QUEUE COWBOY BEBOP THEME]

  • 2024.10.10
  • PyPI
  • Socket score

Maintainers
2

BetterDisco

BetterDisco is an up-to-date modernized fork of Disco, a library witten by b1nzy, the creator of Discord's API, iirc. Disco is a library, written in Python 3 to interface with Discord's API as efficiently and effectively as possible. Disco is expressive, and contains a functional interface. Disco is built for performance and efficiency. Disco is scalable and works well in large and small deployments. Disco is configurable and modular. Disco contains evented network and IO pipes, courtesy of gevent. Buzzwords 100. WYSIWYG.

Installation

Disco is designed to run both as a generic-use library, and as a standalone bot toolkit. Installing disco is as easy as running pip install betterdisco-py --upgrade --no-cache-dir, however, additional options are available for extended features, performance, and support:

ThisInstalls theseWhy?
betterdisco-pygevent, requests, websocket-clientRequired for base Disco functionality.
betterdisco-py[http]flaskUseful for hosting an API to interface with your bot.
betterdisco-py[performance]erlpack, isal, regex, pylibyaml, ujson, wsaccelUseful for performance improvement in several areas. I am speed.
betterdisco-py[sharding]gipc, dillRequired for auto-sharding and inter-process communication.
betterdisco-py[voice]libnaclRequired for VC connectivity and features.
betterdisco-py[yaml]pyyamlRequired for YAML support, particularly if using config.yaml.
betterdisco-py[all]All of the above, unless otherwise noted.All additional packages, for the poweruser that absolutely needs it all.

Examples

Simple bot using the built-in bot authoring tools:

from disco.bot import 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.reply('Pong!')

    # Which includes command argument parsing
    @Plugin.command('echo', '<content:str...>')
    def on_echo_command(self, event, content):
        event.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):

For further information and configuration options, please refer to our documentation first and foremost.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc