# alfred Server management bot. All commands are owner-only and work in channel or PM. ## Dependencies ``` pip install requests ``` ## Help system ``` !help list topics !help list commands for a topic !help description and usage for a command ``` All help responses are sent as IRC NOTICE to the requester, not said publicly in channel. Running any command with no arguments shows the same output as `!help `. ## Commands ### Bot management ``` !bot list show all managed bots and their running state !bot all start|stop|restart control all bots at once !bot start|stop|restart control a bot !bot status check if a bot is running ``` Bots are discovered automatically from `~/.config/sopel/*.cfg`. ### Server stats ``` !srv uptime uptime and load averages !srv disk disk usage for / [raw df output - needs formatting] !srv mem RAM and swap usage [raw free output - needs formatting] !srv load load averages and process count !srv status [service] rc-service status, all or one !srv net [iface] RX TX bytes for an interface !srv top [n] top n processes by CPU (default 5) !srv topmem [n] top n processes by memory (default 5) !srv io disk read write stats !srv conns TCP connection summary [raw ss -s output - needs formatting] !srv who logged-in users [raw who output - needs formatting] !srv logs [n] last n log lines for a service (default 10) ``` `!server` is an alias for `!srv`. ### Soju bouncer ``` !irc user list list all bouncer users [raw sojuctl output - needs formatting] !irc user add create a new user [raw sojuctl output - needs formatting] !irc user remove delete a user [raw sojuctl output - needs formatting] !irc user passwd change a user's password [raw sojuctl output - needs formatting] !irc user enable re-enable a disabled user [raw sojuctl output - needs formatting] !irc user disable disable a user [raw sojuctl output - needs formatting] !irc net list list networks for a user [raw sojuctl output - needs formatting] !irc net status show network connection status [raw sojuctl output - needs formatting] !irc net add [addr] add a network (preset or custom) [raw sojuctl output - needs formatting] !irc net remove remove a network [raw sojuctl output - needs formatting] !irc net quote send a raw IRC command to a network [raw sojuctl output - needs formatting] !irc net presets show available network presets !irc bouncer bouncer-wide stats [raw sojuctl output - needs formatting] !irc notice broadcast a notice to all users [raw sojuctl output - needs formatting] ``` ### File hosting (0x0) ``` !files stats file count and total size !files list [n] last n uploads (default 5) !files shorten [wkfo|gumx] shorten a URL !files mirror [wkfo|gumx] mirror a remote URL !files prune delete expired files from disk [raw flask output - needs formatting] !files vscan run ClamAV scan on stored files [raw flask output - needs formatting] !files remove permanently remove a file ``` ### Coffee tracker ``` !coffee stats today count, week bar graph, streak, all-time average !coffee + add n cups to today !coffee - remove n cups from today !coffee set today's count to n !coffee + yyyy-mm-dd add n cups to a past date !coffee yyyy-mm-dd set a past date to n cups !coffee yes confirm a pending action !coffee no cancel a pending action ``` ### WireGuard VPN ``` !vpn pubkey print server public key !vpn list list peers: name, IP, pubkey (first 24 chars) !vpn add add peer, returns assigned IP and client config URL !vpn remove remove peer live and from wg0.conf ``` `!vpn add` assigns the next free `10.0.0.x`, calls `wg set wg0 peer` live (no restart needed), rewrites `wg0.conf`, uploads a ready-to-use client `.conf` to wk.fo, and replies with the IP and URL. ### Mailing list ``` !list members show all subscribers !list subscribe subscribe an address !list unsubscribe unsubscribe an address !list send send a message to the list ``` Manages the mlmmj list at `list@gumx.cc`. Web archive at `mail.gumx.cc/list/archive/`. ### Git repos ``` !git list list all repos with last commit time and description !git desc set a repo's description (shown on git.gumx.cc) !git hook install a post-receive hook from the templates dir !git remove remove a repo (prompts for confirmation) ``` Repos auto-create on first push via the git-shell-wrapper. Use `!git hook` after pushing to a new repo to install a deploy hook. Available types depend on what's in `/home/ahmed/scripts/git-hooks/`. `!git remove` requires `!git yes` to confirm or `!git no` to cancel. ## Config keys | Key | Description | |-----|-------------| | `[coffee] data_path` | Path to coffee data JSON | | `[coffee] timezone` | Timezone for date calculations (default UTC) | | `[soju] config_path` | Path to soju config file | | `[files] url` | 0x0 API URL | | `[files] default_domain` | Default short domain (wkfo or gumx) | | `[files] db_path` | Path to 0x0 SQLite database | | `[files] data_path` | Path to 0x0 file storage directory | | `[files] app_path` | Path to 0x0 Flask app directory |