Repository navigation
Slash commands
Every command answers privately, except the pings that /blowup posts in the channel and the charts that /chartgen sends in a direct message. Only the person who used the command sees the reply. The bot answers commands only in the output channels and in commands_channel_id. It ignores them in every other channel.
| Command | Tier | What it does |
|---|---|---|
/about |
anyone | Shows the bot version, the license (AGPL-3.0-or-later), and the source repository, https://github.com/mrchrisneal/shazzzbot. |
/status |
view | Shows the first output, with its images. |
/panel refresh |
operate | Updates all outputs now. Images follow at the next free upload time, which the reply names. |
/charts window <span> |
operate | Sets the time span of the charts and the Top Apps trend lines, from 5m up to [history] days, for example 45m, 6h, or 3d. Needs the audit channel. |
/blowup [reason] |
operate | Pings blowup_user_id five times in the current channel. Needs the audit channel. |
/docker restart <container> |
operate | Restarts one container. |
/docker restart-stack <stack> |
operate | Restarts all containers of one Compose stack. |
/docker restart-group <group> |
operate | Restarts all containers of one group in [restarts.groups]. |
/chartgen <series1> [series2] [series3] [series4] [span] [mode] |
view | Sends up to four history charts to you in a direct message. |
/ratelimits |
view | Shows the learned Discord rate budget. |
/update |
admin | Shows the version of the bot, each relay, and the host helper, and the update command for each. Needs the audit channel. |
The /docker commands need [host] docker_proxy, a match in [restarts] allow for each container, and the audit channel (see Restarts).
The three tiers are view, operate, and admin. A higher tier includes the lower tiers, so an operate member can also use /status. /about needs no tier, so every member who can use a command channel can see the source link.
The tiers are set in the [perms.*] tables (see Permissions).
Important
The bot denies access by default. A tier with no roles and no users gives nobody access. A Discord server owner or administrator gets no access unless a tier lists them.
/status shows the first [[outputs]] block. If the bot cannot upload images now, the reply has no images. This occurs when another upload runs, when the last upload is too recent, or when an upload waits to retry. The reply then shows each section as embed fields, and it leaves out sections that are too long. A note names the sections that it left out.
/blowup sends five messages, 2 seconds apart, in the channel where you used it. Each message mentions blowup_user_id and shows your name and the reason. The reason can have up to 200 characters.
The bot posts the request to the audit channel first. After one use, /blowup is off for 10 minutes for all users. If blowup_user_id is 0, the command answers Blowup is not configured.
/chartgen draws charts from the chart history and sends them to you in a direct message. Each series option takes one of these names, or list to show the names that have data:
-
cpu,ram,disk-read,disk-write,net-down, andnet-up. -
core-1,core-2, and so on, one for each CPU core, on a host with more than one core.
span sets the time span, from 5m up to [history] days. The default is the span of /charts window. mode is image (the default, one image), rich (embed fields), or text.
If your direct messages are closed to the server, the bot sends the charts in a private reply. Each user can send one request in 60 seconds, and the bot draws one request at a time. An image chart waits for a free upload time, up to 10 minutes. While it waits, other requests get Another chart is rendering. The bot posts each request to the audit channel, but the command does not need the audit channel.
/update posts a line to the audit channel, then sends one private reply for each node. Each reply shows these items:
- The current version of the node, or
unavailablewhen the node did not report one. - The latest public release on GitHub.
-
Update available.,No update available., orVersion comparison unavailable. - When the release check fails:
Latest public release: unavailable., or the last known release andNo newer release in last-known result. - The time of the last release check and its result.
- The update command from
[node_updates], and the host to run it on. The bot never runs the command.
See Node update commands.
/docker restart does these steps in this order:
- It makes sure that
[host] docker_proxyis set, that the name matches[restarts] allow, and that the bot can see the audit channel. If[host] docker_proxyis not set, it answersDocker is not configured. - If the last update got a container list, it makes sure that the container is in that list. If not, it answers
No container named `name`. - It shows Confirm and Cancel buttons. Only the person who used the command can click them, and they expire after 30 seconds.
- After Confirm, it gets a new container list from the Docker proxy. If the proxy does not answer, or the container is not in that list, it stops and restarts nothing.
- It posts the restart to the audit channel. If that post fails, it stops and restarts nothing.
- It restarts the container. Docker gives the container 20 seconds to stop before it forces it to stop.
- It posts the result to the audit channel.
/docker restart-stack selects the containers whose Compose project has that name. /docker restart-group selects the containers that match the globs of that group. Both commands do these steps in this order:
- They make sure that
[host] docker_proxyis set, that each selected container matches[restarts] allow, and that the bot can see the audit channel. If one container does not match, they restart nothing. - They list the containers and show Confirm and Cancel buttons, which expire after 30 seconds.
- They post the start of the restart to the audit channel. If that post fails, they restart nothing.
- They get a new container list, and restart each selected container that is still in it, one at a time.
- They post the result of each container to the audit channel. If a post fails, they restart no more containers.
- They post a summary and reply with the lists of restarted and failed containers.
The whole sequence stops after 12 minutes. A reply longer than 1900 characters comes as a restart-details.txt file.