/dash2

A cleanroom rewrite of Dash in Hikari.

Primary LanguagePythonMIT LicenseMIT

Dash 2

A cleanroom rewrite of Dash on Lightbulb and Hikari.

Changes are documented in the changelog.

Installing

Running is easy if you have just and [Nix](https://nixos.org] installed.

direnv, and direnv-nix are also helpful, but not required.

OCI/Docker container with Nix

docker load < $(nix build .#dash-container)
# Jump to "Configuration", then run the container the normal way

Executable with Nix

nix build .#dash
# Jump to "Configuration", then...
./result/bin/dash

Manually without Nix

Install Poetry.

Copy the file named example.env in the root of the project to .env and modify it.

Alternatively, you can also use your hosting platform's method for setting environment variables.

Ensure you have a Discord bot token, then paste it into the DISCORD_TOKEN key.

Then, obtain a Giphy API token and paste it into the GIPHY_TOKEN key.

And, finally, run this to run the bot:

poetry install
python3 -m dash

Configuration

The bot is configured entirely through environment variables. Sample values are provided in extras/example.env.

MediaWiki instance

MEDIAWIKI_API and MEDIAWIKI_BASE_URL control the API URL and the MediaWiki base URL for the MediaWiki extension.

MEDIAWIKI_API example value: https://ftb.fandom.com/api.php

MEDIAWIKI_BASE_URL example value: https://ftb.fandom.com/wiki/

Tokens

Ensure you have a Discord bot token, then set it in the DISCORD_TOKEN variable.

Then, obtain a Giphy API token and set it in the GIPHY_TOKEN variable.

NixOS module

A NixOS module is available in flake.nix, from the nixosModules.default output.

Example usage

In your flake.nix:

inputs = {
  nixpkgs = {
    url = "github:NixOS/nixpkgs/nixpkgs-unstable";
  };
  dash2 = {
    url = "github:tomodachi94/dash2";
    inputs.nixpkgs.follows = "nixpkgs";
  };
  # -- snip --
};

# -- snip --

outputs = { nixpkgs, dash2, ... }: {
  # -- snip --
  nixosConfigurations.my-machine = nixpkgs.lib.nixosSystem {
    modules = [
      # -- snip --
      dash2.nixosModules.default
      # -- snip --
      # NOTE: Make sure your configuration.nix is loaded somewhere.
    ];
  };
}

And then, in your configuration.nix:

{
  services.dash = {
    enable = true;
    secretsFile = "/run/secrets/dash"; # See ./extras/example.env for an example of the required format.
  };
}

Development

Install Nix, then use nix develop. If you have direnv and nix-direnv installed, you can use direnv allow and have the shell environment activated automatically.