Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.
/ catalogger Public archive

OLD CODE, SEE README -- Discord logging bot that integrates with PluralKit

License

Notifications You must be signed in to change notification settings

starshine-sys/catalogger

Repository files navigation

NOTE: this codebase is basically abandoned. We're working on a rewrite over at https://codeberg.org/starshine/catalogger.

Catalogger

A logger bot that integrates with PluralKit's message proxying.

For a usage guide, check out docs/USAGE.md

To invite Catalogger to your server, use this link.

Hosting Catalogger yourself

A logging bot, by its nature, collects a lot of potentially sensitive data. All message content is stored encrypted, but even then, you might not be comfortable adding a third-party bot for logging. For that reason, we provide an easy way of self-hosting Catalogger using Docker.

(We're not sure if the Docker image will run on Windows--it's only been tested on Linux. For best results, use a Linux system!)

Docker

First off, you need Docker and docker-compose installed.

Copy .env.example in this directory to .env. For Docker, only the TOKEN, PREFIXES, OWNER, and AES_KEY lines are needed, but you can keep the DATABASE_URL and REDIS keys anyway--they won't affect anything. Make sure to replace all default values!

Your .env file should look something like this:

TOKEN=NzMwOTE2MTgxMjQ5ODg0MTgx.YANs0q.amdzZGhmZ2prc2RmaGdqa3NoZmh
PREFIXES=cl!
OWNER=594423578915786351
AES_KEY=ad97zmwmo7nm9TUU9K2XsDozTclX+nJ7+WcS/NVoVAU=

Then, just run docker-compose up (optionally adding the -d flag to run it in the background) to run the bot!

Dockern't

If for whatever reason you can't or don't want to use Docker, it's still possible to run Catalogger yourself.

Requirements

  • Go 1.16
  • PostgreSQL 12
  • Redis 6.2

Installation

Note that Catalogger is built as a single executable for both the bot and dashboard.
To run the bot, use ./catalogger bot.

  1. Create a Postgres database
  2. Copy .env.example to .env and fill it in
  3. Build the bot with build.sh
  4. Run the resulting executable

Configuration

Catalogger is configured through a .env file. The following keys are available:

  • TOKEN: Discord bot token. Required
  • DATBASE_URL: Connection string to a PostgreSQL database. Required, except for Docker
  • REDIS: Connection string to a Redis instance. Required, except for Docker
  • OWNER: Owner user ID, the only account that can use owner-only commands. Required
  • AES_KEY: the key used to encrypt message content. Required This should be a base64 string, such as from here.
  • PREFIXES: a comma-separated list of prefixes for commands. Required
    For example, cl!,lg! means both cl! and lg! are prefixes used to execute commands.
  • COMMANDS_GUILD_ID: if set to true, the only server ID that slash commands will be synced to. Recommended to set if your instance will only be used in a single server, otherwise, only enable during development.
  • SYNC_COMMANDS: if not set to false, sync slash commands with Discord on startup. Note that unless COMMANDS_GUILD_ID is also set, it can take up to an hour for slash commands to show up in the UI.
    It's recommended to leave this enabled.
  • JOIN_LEAVE_LOG: a channel ID that the bot will send messages to whenever it joins or leaves a server.
  • SUPPORT_SERVER: a link to the support server, used in the help command, as well as internal error messages. (not needed for self-hosting)
  • DASHBOARD_BASE: the base URL to the dashboard. (not needed for self-hosting)
  • SENTRY_URL: URL to connect to Sentry, for improved error logging (not needed for self-hosting)
  • DEBUG_LOGGING: if enabled, will enable debug level logging. Not needed for self-hosting, might be useful in development and for reporting errors.
  • INFLUX_URL: URL to an InfluxDB to report statistics to. (not needed for self-hosting)
  • INFLUX_TOKEN: Token for InfluxDB (not needed for self-hosting)
  • INFLUX_DB: Database name to report statistics to. (not needed for self-hosting)

Dashboard

The dashboard really isn't made with self-hosting in mind; the entire bot can be configured through commands and securely setting up the dashboard is too complicated to go into detail here. That being said, it's still possible to run it yourself--but prepare to look through the source code for anything that isn't documented!

To run the dashboard, run the catalogger executable with the web subcommand.

You'll also want to set DASHBOARD_BASE in your .env file. (Optional, but highly recommended, so the cl!dashboard command works)

Configuration

The dashboard requires some additional environment variables:

  • CLIENT_ID: your bot's client ID
  • CLIENT_SECRET: your bot's client secret
  • RPC_HOST: the host + port your bot process is listening on for RPC
  • HTTPS: whether to use HTTPS
  • PORT: the port to listen on
  • HOST: the hostname without http:///https:// prefix
  • ANNOUNCEMENTS_TOKEN: token to use to fetch bot announcements (optional)
  • ANNOUNCEMENTS: announcements channel to fetch (optional)

License

Copyright (C) 2021 Starshine System

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.

About

OLD CODE, SEE README -- Discord logging bot that integrates with PluralKit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages