Skip to content

A small Discord bot that you can send Clojure code to, to experiment with the language, demonstrate core language principles, or just mess about.

License

Notifications You must be signed in to change notification settings

pmonks/for-science

Repository files navigation

release CI Dependencies
dev CI Dependencies

Open Issues License

for-science

A small Discord bot that you can send Clojure code to, to experiment with the language, demonstrate core language principles, or just mess about. Note: only supports the subset of Clojure's core provided by the Small Clojure Interpreter.

Please review the privacy policy before interacting with the bot.

Adding the Bot to Your Discord Server

If you're an administrator of a server, click here and follow the instructions. You will also need to ensure that the bot has permissions to read messages from other people, and create messages in every channel you want to use it in. The !move command also requires permission to delete other people's messages.

Using the Bot

The bot provides these commands in any channel or a DM:

  • !clj ...forms... - evaluate the following text as Clojure forms. If code fences are used, will only evaluate text within those code fences (thereby allowing for a "literate" style of message). Note that each use of this command is run in a "fresh" instance of the interpreter - no state is maintained between invocations (to help avoid memory leaks). If this is limiting for your use case, please chime in here.
  • !move #channel - logically moves the current conversation to #channel. This is done by posting cross-linked messages in both this channel and the other channel, and asking users to continue in the other channel. Note: it doesn't actually move any messages in a technical sense - it's more about logically moving a conversation from that point forward.

It also provides these commands in a DM only:

  • !help - provides brief help.
  • !privacy - provides a link to the bot's privacy policy.

Running Your Own Copy of the Bot

Obtaining API Keys

Configure a Discord bot using the Discord developer portal, obtaining an API key. Detailed instructions on this process are provided in the discljord project.

Running the Bot

Currently the bot is only distributed in source form, so regardless of how you intend to deploy it, you'll need to clone this repository locally.

Direct Execution

  1. Either set environment variables as described in the default config.edn file, or copy that file somewhere else and hardcode the values in the file directly.
  2. If you set the environment variables in the previous step run clj -M:run, otherwise run clj -M:run -c /path/to/your/config.edn

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 (to Digital Ocean).

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.

License

Copyright © 2021 Peter Monks

Distributed under the Apache License, Version 2.0.

SPDX-License-Identifier: Apache-2.0

About

A small Discord bot that you can send Clojure code to, to experiment with the language, demonstrate core language principles, or just mess about.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published