release | ||
dev |
A little library that extends the discljord
Clojure client library for Discord, with:
- Handy utility methods that support common bot operations.
- 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 no longer considered idiomatic. Consider using application commands instead, perhaps via a library such as JohnnyJayJay/slash
.
API documentation is available here.
Express the correct maven dependencies in your deps.edn
:
{:deps {com.github.pmonks/discljord-utils {:mvn/version "LATEST_CLOJARS_VERSION"}}}
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])
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:
- A namespace containing your bot's responsive commands (note: the intent is to replace this with application/slash commands)
- 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) - Logback configuration
- 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:
- 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.
- A privacy policy, which the bot will link to when a user issues the
!privacy
command
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 release
branch is only updated from dev
via PRs created by the core development team. All other changes submitted to release
will be rejected.
Copyright © 2020 Peter Monks
Distributed under the Apache License, Version 2.0.
SPDX-License-Identifier: Apache-2.0