Skip to content

A discord bot for fetching and visualising data from the tacticus api

License

Notifications You must be signed in to change notification settings

sigubrat/Homina

Repository files navigation

homina

Homina Logo

GitHub package.json version (branch) GitHub Repo stars Discord Dynamic JSON Badge

Homina-homina-homina

Blessed is the Machine Spirit.

This is a verified Discord bot intended to provide guilds with useful information regarding its members, guild, and guild raid information. It will be updated as Snowprint updates their public API.

To invite the bot to your server, click here

The discord support server can be found here

Table of Contents

Features

  • Provides detailed guild member and raid information
  • Tracks and displays guild activity and participation
  • Generates visual charts for guild stats using Chart.js
  • Offers commands for exporting guild data
  • Integrates with PostgreSQL for persistent data storage
  • Easy setup with environment variables and secret management
  • Slash command support for modern Discord interaction
  • Regular updates as the Tacticus API evolves
  • Includes a help command and detailed usage instructions
  • Designed for extensibility and community contributions

This should be all the information you need if you just want to invite the bot to your server. Further information will be for those who want technical information about the bot.


Stack


Prerequisites

Before running the project, ensure you have the following installed:

  • Node.js and Bun (latest version recommended)
  • PostgreSQL for database management
  • A Discord bot token (create one via the Discord Developer Portal)
  • Set your environment variables and player mappings (see further down)
  • Set up a secret manager using Infisical
  • Optional: Nix (to use the provided flake for a reproducible dev shell/environment)

Nix flake

Nix is a powerful package manager for Linux and macOS, designed to provide a reliable and reproducible way to manage software dependencies. Nix allows you to create isolated environments and build systems, preventing dependency conflicts and ensuring consistent development and deployment environments.

If you are using Nix, you don't need to manually install anything.

You have two options for development:

  1. Use nix direnv and create a .envrc in your root folder with the following:
use flake
  1. Use the nix shell
nix develop

To update flake inputs:

nix flake update

Environment Variables

Create a .env file in the root of the project and add the following variables:

  • DB_NAME - Name of your postgres database
  • DB_USER - Your postgres database username
  • DB_PWD - The password to your postgres database
  • INFISICAL_SECRET - Your Infisical secret key
  • INFISICAL_ID - Your Infisical project ID
  • INFISICAL_WORKSPACE - Your Infisical workspace ID
  • NODE_ENV - The environment (either dev for development or prod for production)
  • MIDDLEWARE_URL - URL of the HominaMiddleware service (defaults to http://localhost:3001)
DB_NAME=your-database-name
DB_USER=your-database-user
DB_PWD=your-database-password
INFISICAL_SECRET=your-infisical-secret
INFISICAL_ID=your-infisical-id
INFISICAL_WORKSPACE=your-infisical-workspace-id
NODE_ENV=dev|prod
MIDDLEWARE_URL=http://localhost:3001

Database Configuration

  1. Ensure PostgreSQL is installed and running.
  2. Create a database for the bot:
    createdb homina
  3. Update the .env file with your database credentials (DB_NAME, DB_USER, DB_PWD).

Before running the bot

To install dependencies:

bun install

To deploy commands so that they're available in Discord:

bun run deployCommands

Usage

To run the bot:

bun run dev

The bot checks the database connection before starting up, but if you want to test it without waiting for the bot you can use:

bun run testDb

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a new branch for your feature or bugfix:
    git checkout -b feature-name
  3. Commit your changes:
    git commit -m "Add feature-name"
  4. Push to your branch:
    git push origin feature-name
  5. Open a pull request.

License

This project is licensed under the Apache License. See the LICENSE file for details.

Attribution is not required if you use of the code in this repository, but it is appreciated.


Common Issues

  • Database connection errors - Ensure PostgreSQL is running and your .env credentials are correct.
  • Bot not responding to commands - Make sure you've run bun run deployCommands after any command changes.

Screenshots

Here are some examples of the bot in action:

help example
The help command
season-by-rarity options example
Features optional rarity options
season-by-rarity example
Get detailed graphs for a rarity
meta team distribution
See how well your guild utilises the different meta teams
inactive members
Check who's not contributing

Acknowledgments

  • Thanks to Snowprint Studios for their public API.
  • Inspired by the community of Discord bot developers.

About

A discord bot for fetching and visualising data from the tacticus api

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Languages