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 <topic> list commands for a topic
!help <topic> <cmd> 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 <topic>.
Commands
Bot management
!bot list show all managed bots and their running state
!bot all start|stop|restart control all bots at once
!bot <name> start|stop|restart control a bot
!bot <name> 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 <service> [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 <nick> <pass> create a new user [raw sojuctl output - needs formatting]
!irc user remove <nick> delete a user [raw sojuctl output - needs formatting]
!irc user passwd <nick> <pass> change a user's password [raw sojuctl output - needs formatting]
!irc user enable <nick> re-enable a disabled user [raw sojuctl output - needs formatting]
!irc user disable <nick> disable a user [raw sojuctl output - needs formatting]
!irc net list <user> list networks for a user [raw sojuctl output - needs formatting]
!irc net status <user> show network connection status [raw sojuctl output - needs formatting]
!irc net add <user> <name> [addr] add a network (preset or custom) [raw sojuctl output - needs formatting]
!irc net remove <user> <name> remove a network [raw sojuctl output - needs formatting]
!irc net quote <user> <net> <cmd> 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 <message> 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 <url> [wkfo|gumx] shorten a URL
!files mirror <url> [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 <filename> permanently remove a file
Coffee tracker
!coffee stats today count, week bar graph, streak, all-time average
!coffee +<n> add n cups to today
!coffee -<n> remove n cups from today
!coffee <n> set today's count to n
!coffee +<n> yyyy-mm-dd add n cups to a past date
!coffee <n> 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 <name> <pubkey> add peer, returns assigned IP and client config URL
!vpn remove <name> 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 <email> subscribe an address
!list unsubscribe <email> unsubscribe an address
!list send <message> 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 <repo> <text> set a repo's description (shown on git.gumx.cc)
!git hook <repo> <type> install a post-receive hook from the templates dir
!git remove <repo> 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 |