Discord Bot
Jump to navigation
Jump to search
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: