A Discord bot that interacts with Mozilla Hubs. Mostly bridges information (chat, media links, joins/leaves) and lets you see who is currently in Hubs from Discord.
Here's an invite link to add the bot to your server.
Check out the bot in action on the Hubs development Discord!
The primary function of the bot is to establish a 1:1 linkage between a Discord text channel and a Hubs room. Once rooms are linked, then the bot will do the following:
- Bridge text chat from the Discord channel into the Hubs room.
- Bridge text chat from the Hubs room into the Discord channel.
- Post links in Discord to media (images, videos, models) which are spawned in the Hubs room.
- Post in the Discord channel when someone joins or leaves the Hubs room, or if administrative stuff happens in the Hubs room.
-
Use the invite link to invite the bot to your guild.
-
Give the bot appropriate permissions on the channels you want it to run in.
-
Create a webhook named "Hubs" in the channels you want it to run in. It will use this webhook to bridge chat and send Hubs status updates.
-
Try out the bot! Type
!hubs
in a channel the bot is in to see some things you can do. The bot will bind a Discord channel and a room if it sees the room URL in the topic of the channel.
The bot requires several permissions in order to work:
- "Send messages," "Read messages," and "Embed links" are necessary for obvious reasons.
- "Manage webhooks" is necessary in order for the bot to find and use a webhook for bridging chat.
- "Manage channels" is necessary if you want to use the bot's channel topic management. If you don't want the bot to put Hubs information in the topic, then you don't need it.
You can and should assign these on a channel-by-channel basis to the bot role after adding the bot to your guild.
If you just add the bot to your Discord guild, it will run on the Hubs servers and you don't need to do anything. But if you want to hack it, run it yourself, or point it at your own deployment of Hubs, read on.
-
Clone this repository.
-
Install Node and
npm
. The instructions at the NPM website should suffice. -
Install Javascript dependencies by running
npm ci
. -
Create an
.env
file with your bot's API token. If you want it to work with rooms on hubs.mozilla.com, also includeRETICULUM_HOST=hubs.mozilla.com
andHUBS_HOSTS=hubs.mozilla.com
. You can see the different configuration bits you can override in.env.defaults
. You can also pass these values as environment variables when you runnpm start
. -
Run
npm start
to start the server, connect to Discord and Reticulum, and operate indefinitely. -
Follow the instructions above to set up and use the bot on your Discord guild.