Skip to main content

A library for connecting to and making a bot in Destiny.gg chat.

Project description

PyPI license info PyPI version info PyPI supported Python versions

A library for connecting to and making a bot in Destiny.gg chat.

Installing

Python 3.9 or higher is required (version 0.5.0 and above, Python 3.8+ for versions below)

# Linux/macOS
python3 -m pip install -U dgg-bot

# Windows
py -3 -m pip install -U dgg-bot

Usage

Not sure what to put here at this point in time. Unauthorized chat bots are subject to being banned, ask Cake in DGG for permission and guidelines for chat bots before running one.

Examples

A simple bot with three commands and will yump back at chatters.

from dggbot import DGGBot
import time

bot = DGGBot(
    "AUTH_TOKEN",
    owner="Owner",
    prefix="$",
)  # default command prefix is "!"

@bot.command()
@bot.is_owner()  # only the owner named in DGGBot can use this command.
def test(msg):  # $test
    msg.reply("Test 123")

@bot.command(aliases=["banmeplease"])  # aliases for this command
def banme(msg):  # $banme / $banmeplease
    bot.send("RightToBearArmsLOL BINGQILIN nathanTiny2")


def is_cake(msg):  # a check where only the user Cake can use commands with this check
    return msg.nick == "Cake"

@bot.command(aliases=["oooo"])
@bot.check(is_cake)
def pog(msg):
    msg.reply("Cake OOOO")

"""
Events
You can either name the function after the event, or include the event name in the decorator.
mention() is also included as a shortcut for event("on_mention").

Event names: on_ban, on_broadcast, on_join, on_mention, on_msg, on_mute, on_privmsg, on_quit,
             on_refresh, on_unban
"""

@bot.event()
def on_msg(msg):
    print(msg)

# @bot.event("on_mention")
@bot.mention()
def yump(msg):
    if "MiyanoHype" in msg.data:
        time.sleep(0.5)
        msg.reply(f"{msg.nick} MiyanoHype")

if __name__ == "__main__":
    bot.run_forever()

Connecting to alternative DGG environments.

from dggbot import DGGBot

bot = DGGBot(
    owner="Owner",
    prefix="$",
    sid="SID",
    rememberme="REMEMBERME",
    config={
        {
            "wss": "wss://chat.omniliberal.dev/ws",
            "wss-origin": "https://www.omniliberal.dev",
            "baseurl": "https://www.omniliberal.dev",
            "endpoints": {"user": "/api/chat/me", "userinfo": "/api/userinfo"},
            "flairs": "https://cdn.omniliberal.dev/flairs/flairs.json",
        }
    },
)

@bot.event()
def on_msg(msg):
    print(msg)

if __name__ == "__main__":
    bot.run_forever()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dgg-bot-1.5.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

dgg_bot-1.5.0-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file dgg-bot-1.5.0.tar.gz.

File metadata

  • Download URL: dgg-bot-1.5.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for dgg-bot-1.5.0.tar.gz
Algorithm Hash digest
SHA256 dd185f24738f6e3ac483957b58e3051d28bea9083ca1a336e1cf4826cd4ed9b5
MD5 74c9bb193ccc6e2e45fdcff3149cdf0c
BLAKE2b-256 542465f323c9e8b03d8c800538466b9cff1f95511ecfd27d1b1c68683acde25b

See more details on using hashes here.

File details

Details for the file dgg_bot-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: dgg_bot-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for dgg_bot-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 65a3b2d1e21148fafc5351fa19962bad384bf02b42581997e0d2321d349693c3
MD5 630fb5549ca35a8736dda3328d8e2a9f
BLAKE2b-256 aa4680bead033a14ad85e9c9dfdf36eb77024facafe8760ed6e3c6cee9e1f117

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page