Signed-off-by: Sebastian Crane <email@example.com>
|1 year ago|
|LICENSES||1 year ago|
|src||1 year ago|
|test||1 year ago|
|CHANGELOG.md||1 year ago|
|CONTRIBUTING.md||1 year ago|
|README.md||1 year ago|
|build.clj||1 year ago|
|deps.edn||1 year ago|
|tests.edn||1 year ago|
A chatbot for announcing upcoming matches and finding fellow players, written for the LibreGaming community
Install Clojure - you can use Clojure's official installation guide or your distribution's package.
Clone this repository:
git clone https://git.libregaming.org/LibreGaming/matchbot.git cd matchbot
- Create a configuration file,
config.yaml, in YAML format:
data-file: "matchbot-data.json" irc: server: example.com port: 6667 nick: matchbot channel: "##matchbot-test"
clojure -M -m system
!list - show all the games that have a list of players
!match game - announce a match of
game to all of its players
!players game - show all the players of
!add game - add yourself to the list of players for
!remove game - remove yourself from the list of players for
!help - show available commands with their explanations
Running the tests
matchbot includes automated unit tests for many functions, along with a simple test runner configuration with Kaocha.
Running the tests is a similar process to running the main application:
Starting a development REPL
matchbot, it can be more convenient and efficient to work interactively with a REPL integrated into your text editor.
matchbot uses Clojure's tools.deps library, the best way to start is by following the relevant part of the nREPL documentation to create a user-level
deps.edn file, then install the nREPL extension for your text editor.
You can create, start and stop an instance of the chatbot process with the functions in the
;; creating a new instance - an empty Var (def my-instance nil) ;; starting the instance (alter-var-root #'my-instance system/start) ;; restarting the instance (system/restart #'my-instance) ;; stopping and resetting the instance (alter-var-root #'my-instance system/stop) (alter-var-root #'my-instance (constantly nil))
Once you are familiar with nREPL, you can additionally use tools.namespace.repl to make reevaluating (reloading) your changes easier:
(require '[clojure.tools.namespace.repl :refer [refresh]]) (refresh)
Make sure that you create your system instance in the REPL, since
refresh will forcefully delete the instance if it has been defined in another namespace!