Liking cljdoc? Tell your friends :D
releaseCIDependencies
devCIDependencies

Latest Version Open Issues License

discljord-utils

A little library that extends the discljord Clojure client library for Discord, with:

  1. Handy utility methods that support common bot operations.
  2. A micro-framework that handles startup, configuration, and logging.

These can be used independently; use of the utility methods does not require use of the framework, and vice versa.

NOTE: This library pre-dates the implementation of application (aka "slash") commands by Discord, and the approach it implements for commands is not longer considered idiomatic. Consider using application commands instead, perhaps via a library such as JohnnyJayJay/slash.

Using the library

Documentation

API documentation is available here.

Dependency

Express the correct maven dependencies in your deps.edn:

{:deps {com.github.pmonks/discljord-utils {:mvn/version "LATEST_CLOJARS_VERSION"}}}

Require one or more of the namespaces

In your namespace(s):

(ns your.namespace
  (:require [discljord-utils.util         :as u]     ; Handy utility methods that are not Discord / discljord specific
            [discljord-utils.message-util :as mu]))  ; Handy utility methods related to Discord / discljord messages

At the REPL:

(require '[discljord-utils.util         :as u])
(require '[discljord-utils.message-util :as mu])

Using the micro-framework

For now your best bet is to look at the for-science bot as a fully-functional example of how to use the framework. It's a little cluttered with deployment specific paraphernalia (none of which is required by the micro-framework), but at a minimum you will need:

  1. A namespace containing your bot's responsive commands (note: the intent is to replace this with application/slash commands)
  2. A config file for your bot (the for-science config file demonstrates the minimal required elements, and you can add whatever bot-specific configuration elements you need to this file as well)
  3. Logback configuration
  4. To use the bot.main namespace as the entry point for your bot, rather than any of your own namespaces

Optionally, you can also provide:

  1. A build info file, which (if present) will be used by the framework to report the precise version of the code it is running with. You can see an example of generating this file automatically here.
  2. A privacy policy, which the bot will link to when a user issues the !privacy command

Contributor Information

Contributing Guidelines

Bug Tracker

Code of Conduct

Developer Workflow

This project uses the git-flow branching strategy, and the permanent branches are called release and dev, and any changes to the release branch are considered a release and auto-deployed (JARs to Clojars, API docs to GitHub Pages, etc.).

For this reason, all development must occur either in branch dev, or (preferably) in temporary branches off of dev. All PRs from forked repos must also be submitted against dev; the main branch is only updated from dev via PRs created by the core development team. All other changes submitted to main will be rejected.

License

Copyright © 2020 Peter Monks

Distributed under the Apache License, Version 2.0.

SPDX-License-Identifier: Apache-2.0

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close