Integración domótica Discord, gratuita y de código abierto

Unofficial connector: chat with Gladys and get its notifications through your Discord bot.
La documentación de esta integración la escribe su autor y, por ahora, solo está disponible en inglés.
Unofficial connector, not affiliated with Discord. It turns a Discord bot that you create into a Gladys messaging channel, like the Telegram one: you talk to Gladys in a direct message with your bot, and Gladys answers and notifies you there. Discord is a trademark of Discord Inc.
What you get
| Surface | Content |
|---|---|
| Chat with Gladys | every direct message you send the bot goes to Gladys, the answer comes back in the same conversation |
| Notifications | the messages Gladys sends you (the "Send a message" scene action, camera images, system messages) arrive as Discord direct messages |
| Scene trigger | Discord command received: a direct message starting with !, like !garage open, starts your scenes instead of going to the assistant |
| Scene action | Post in a Discord channel: a text in a channel of a server (a family server, a home log channel…) |
| Configuration | the Test the bot button checks the token, the connection and the default channel, and gives the invite link of the bot |
Setup
Create the bot
- Open the Discord Developer Portal and click New Application. Give it a name, for instance "Gladys".
- Open the Bot page and click Reset Token, then copy the token. It is the password of your bot: never share it. You can also turn off Public Bot, so that only you can invite it.
- Leave the three Privileged Gateway Intents off: the integration only reads direct messages, and Discord delivers their text to a bot without any privileged intent (the "Message Content" intent is only needed for messages in servers).
Connect it to Gladys
- In Gladys, paste the token in Bot token and save. The status shows "Connected as …" after a few seconds.
- Click Test the bot: the result ends with the invite link of your bot.
Invite it to a server you are in
Discord only lets a bot and a person exchange direct messages when they share a server.
- Open the invite link and pick a server you are a member of. No server of
your own? In Discord, click + then Create My Own: a private server
with just you (and your family) is perfect. The link is the one the
OAuth2 → URL Generator page of the portal would build with the scope
botand the permissions View Channels, Send Messages and Attach Files. - Check that the members of that server may send you direct messages: server name → Privacy Settings → Direct Messages on.
Link your Discord account
- In Gladys, on the page of the integration, click Generate a link code in the Link my account block: a code of 8 characters appears (it works once, for 15 minutes).
- In Discord, open a direct message with the bot (click its name in the member list of the server, then Message) and send the code. The bot answers "Linked! Hello …".
Every Gladys user who wants Discord does the same with their own Discord account. A user can unlink from the same block at any time.
Talking to Gladys
- Every direct message from a linked account goes to Gladys, with the
authority of the linked Gladys user, exactly like the Gladys chat. Like
the Gladys chat, the assistant needs Gladys Plus: without it, Gladys
answers that Gladys Plus is required (the
!commands below work without it). - Answers and notifications arrive in the same conversation. A text longer than the 2,000 characters of a Discord message is split, and a camera image arrives as an image.
- An account that is not linked gets the linking instructions, nothing else.
Scene commands with !
A direct message starting with ! is not sent to the assistant: it fires
the scene trigger Discord command received, and the bot confirms
"Command "garage" passed to your scenes". Only linked accounts can do it.
- The Command filter is the word right after the
!. Gladys compares it exactly, so type it in lowercase and without accents: the integration lowers the case and drops the accents of what you send, so!Garage,!garageand!GARAGEall match the filtergarage. Leave the filter empty to react to every command. - The scene can use the details of the message: the command, the text after
it (
!garage opengivesopen), the whole message, the Gladys user (first name and selector) and the Discord user (id and name).
For instance: trigger Discord command received with the command
garage, then the action that opens the garage door; you open it by sending
!garage to the bot.
Posting in a server channel
The scene action Post in a Discord channel posts a text in a channel of a server the bot belongs to. Give it the channel id, or fill Default server channel id in the configuration and leave the field empty. To copy an id, turn on Developer Mode (Discord settings → Advanced), then right-click the channel → Copy Channel ID. The bot needs the View Channel and Send Messages permissions in that channel. The action gives back the id of the posted message.
Options
- Allowed Discord user ids: a safety list. When filled, the bot ignores the direct messages of everyone else, link codes included, without answering. Right-click a user → Copy User ID (Developer Mode).
- Default server channel id: the channel of the Post in a Discord channel action when the action names none.
Troubleshooting
- "Discord refused the bot token": the token was reset or mistyped. Click Reset Token in the portal, paste the new one and save.
- The bot does not answer: check the status of the integration, the allowed list, and that the bot is in a server you share. A message from an account that is not linked gets the linking instructions.
- "Discord refuses to deliver a direct message": the person does not share a server with the bot anymore, or blocks direct messages from that server's members.
- "This code is invalid or expired": a code works once, for 15 minutes; generate a new one.
- A short connection loss to Discord is normal: the integration resumes the session by itself, and only reports it after 30 seconds.
- Logs: the log level of the integration is set with the
LOG_LEVELvariable.
Privacy
The bot token is stored encrypted by Gladys and is only ever sent to Discord. Your messages travel through Discord like any Discord message. The integration writes nothing on disk: Gladys only keeps the link between a Discord user id and a Gladys user, which you can remove from the Link my account block.
Parámetros de configuración
Estos son los parámetros que Discord te pide en su pantalla de configuración en Gladys.
| Parámetro | Tipo | Obligatorio | Descripción |
|---|---|---|---|
| Discord in Gladys | section | No | Unofficial connector, not affiliated with Discord. A Discord bot you create becomes a Gladys chat channel: each Gladys user links their Discord account once, then talks to Gladys in direct messages with the bot and receives its answers and notifications there. Create the bot on the Discord Developer Portal (New Application, then Bot, then Reset Token), paste its token below, save, and use the invite link given by the "Test the bot" button to add it to a server you are a member of. |
| Bot token | secret | Sí | Developer Portal → your application → Bot → Reset Token. Stored encrypted by Gladys; never share it. |
| Link your Discord account | section | No | Each Gladys user clicks "Generate a link code" in the "Link my account" block and sends the 8-character code to the bot in a Discord direct message (a code works once, for 15 minutes). After that, the messages you send the bot go to Gladys, and Gladys answers there. A message starting with ! (like "!garage open") is not sent to the assistant: it fires the "Discord command received" scene trigger instead. |
| Allowed Discord user ids (optional) | string | No | Safety list: when filled, the bot ignores the direct messages of everyone else, link codes included. Ids separated by commas (Discord: Settings → Advanced → Developer Mode, then right-click a user → Copy User ID). |
| Default server channel id (optional) | string | No | Channel used by the "Post in a Discord channel" scene action when it names none (right-click the channel → Copy Channel ID). The bot must be a member of that server. |
Cómo instalar Discord en Gladys
- En Gladys, abre Integraciones: Discord aparece en el catálogo junto a las integraciones nativas, con una insignia de comunidad.
- Haz clic en Instalar. Gladys descarga la imagen Docker (
ghcr.io/lm1lc3n7/gladys-discord:0.1.1), la ejecuta en un entorno aislado del núcleo y genera la interfaz de la integración (dispositivos, descubrimiento y configuración). - Abre la pantalla de Configuración de la integración, rellena los parámetros y guarda.
- También puedes instalarla directamente desde la URL de su repositorio: https://github.com/LM1LC3N7/gladys-discord.
Discord requiere Gladys >=5.1.0. El catálogo de Gladys se actualiza cada hora, así que una nueva versión está disponible como máximo una hora después de publicarse.
¿Todavía no usas Gladys? Es gratuito y de código abierto: sigue la guía de instalación para empezar.
Sobre las integraciones externas
Discord es una integración externa: una integración comunitaria empaquetada como contenedor Docker y publicada en GitHub. Gladys la instala con un clic y la ejecuta en un entorno aislado del núcleo. La publica y mantiene LM1LC3N7, no el equipo principal de Gladys.
- Explorar todas las integraciones externas
- Descubrir las integraciones nativas incluidas en Gladys
- Crear y publicar tu propia integración externa
- Código fuente en GitHub — fuente de esta documentación