2026-01-21 20:33:17 -07:00
2026-01-17 13:42:20 -07:00
2026-01-17 13:42:20 -07:00
2026-01-17 13:42:20 -07:00
2026-01-17 11:22:16 -07:00
2026-01-21 20:33:17 -07:00
2026-01-17 11:22:16 -07:00
2026-01-17 11:22:16 -07:00

Sox

This directory contains an example of a simple Campfire bot named Sox written in Go.

Commands:

  • ping
  • trace google.com
  • math 32*9

The functionality of the bot is basic. But this example shows how you can:

  • Start an HTTP service to listen on a bot endpoint
  • Parse the JSON from the message request
  • Respond to that request with some HTML-formatted text

Installation

Nixos

Add this to flake.nix

    inputs = {
        sox.url = "git+https://gitea.rmtn.top/waldo/sox";
    }
    outputs = { self, nixpkgs, sox, ...}: {
      nixosConfigurations.yourhostname = nixpkgs.lib.nixosSystem {
        specialArgs = {
          inherit sox;
        };
      };
    }

Add this to sox.nix and include it somewhere in your config

{ pkgs, config, lib, cfg, sox, ... }:

rec {
  systemd.services."soxbotservice" = {
    enable = true;
    wants = [ "network-online.target" ];
    after = [ "syslog.target" "network-online.target" ];
    description = "Start Sox Campfire bot service";
    path = [ pkgs.libqalculate ];
    serviceConfig = {
      Type = "simple";
      ExecStart = sox.packages.${pkgs.system}.sox + "/bin/sox";
      Restart = "always";
      RestartSec = 10;
      KillMode = "process";
    };
    wantedBy = [ "multi-user.target" ]; # required or won't start automatically
  };
}

Point the Campfire bot webhook at your ip with port 8096 and everything should work.

Ping the bot with @Sox or DM for a response.

In group: @Sox ping or in DM: ping

Description
No description provided
Readme 86 KiB
Languages
Go 81.1%
Nix 18.6%
Makefile 0.3%