Discord Bot: Difference between revisions
Jump to navigation
Jump to search
Created page with "The discord bot monitors MQTT traffic and builds a cache of information, so that it is able to respond to commands via Discord without accessing any databases. There are a num..." |
No edit summary |
||
Line 8: | Line 8: | ||
** <code>!tools</code> - Show current status of bookable tools, e.g. who is using it now, who will be using it next, and when. | ** <code>!tools</code> - Show current status of bookable tools, e.g. who is using it now, who will be using it next, and when. | ||
** <code>!wiki [search term]</code> - Queries this wiki's API to perform a search | ** <code>!wiki [search term]</code> - Queries this wiki's API to perform a search | ||
** <code>!trains</code> - show the latest received train departure board using the cron job for [[Train Station Display]] (for fun it updates the clock at the bottom for ten seconds). | |||
* Alerts on certain MQTT messages | * Alerts on certain MQTT messages | ||
** Forwards doorbell alerts as silent messages to #bot-spam | ** Forwards doorbell alerts as silent messages to #bot-spam | ||
Line 14: | Line 15: | ||
** messages to MQTT Topic <code>nh/discord/tx/{channel}</code> will be forwarded to #{channel} | ** messages to MQTT Topic <code>nh/discord/tx/{channel}</code> will be forwarded to #{channel} | ||
** messages to MQTT TOPIC <code>nh/discord/tx/pm/{nick}</code> will be sent as a DM to {nick} | ** messages to MQTT TOPIC <code>nh/discord/tx/pm/{nick}</code> will be sent as a DM to {nick} | ||
** messages posted in | ** messages posted in Discord channels which do not end in "-private" are relayed to MQTT Topic <code>nh/discord/tx/{channel}/{nick}</code> | ||
*** there's also a JSON version which includes more metadata, all of these go to <code>nh/discord/json/rx</code> | |||
** presence changes to <code>nh/discord/presence/{username}</code> | |||
** user avatar URLs on presence changes to <code>nh/discord/avatar/{username}</code> | |||
The code is currently available on | The code is currently available on GitHub: | ||
https://github.com/ | https://github.com/NottingHack/nh-instrumentation-discord |
Latest revision as of 20:57, 29 July 2024
The discord bot monitors MQTT traffic and builds a cache of information, so that it is able to respond to commands via Discord without accessing any databases. There are a number of supported features:
- Built-in commands, such as:
!battery
- Shows a list of WirelessThings battery levels.!humidity
- Shows a list of room humidities (also from WirelessThings sensors).!status
- Shows (25 most recent) service statuses from thenh/status
topic. These timeout and go 'bad' after 1 minute.!temp
- Show temperature readings from around the hackspace.!tools
- Show current status of bookable tools, e.g. who is using it now, who will be using it next, and when.!wiki [search term]
- Queries this wiki's API to perform a search!trains
- show the latest received train departure board using the cron job for Train Station Display (for fun it updates the clock at the bottom for ten seconds).
- Alerts on certain MQTT messages
- Forwards doorbell alerts as silent messages to #bot-spam
- Relays messages to and from MQTT
- messages to MQTT Topic
nh/discord/tx
will be forwarded to #bot-spam - messages to MQTT Topic
nh/discord/tx/{channel}
will be forwarded to #{channel} - messages to MQTT TOPIC
nh/discord/tx/pm/{nick}
will be sent as a DM to {nick} - messages posted in Discord channels which do not end in "-private" are relayed to MQTT Topic
nh/discord/tx/{channel}/{nick}
- there's also a JSON version which includes more metadata, all of these go to
nh/discord/json/rx
- there's also a JSON version which includes more metadata, all of these go to
- presence changes to
nh/discord/presence/{username}
- user avatar URLs on presence changes to
nh/discord/avatar/{username}
- messages to MQTT Topic
The code is currently available on GitHub: