Discord service - lypitech/area GitHub Wiki
← Home
This page describes the usage of the discord service. This page gives informations about where and how to find the necessary information needed by the service to work.
For starters, add the app to your server using this url.
If you want to add your own application (bot), you can create it here. When inviting your bot to your server, make sure you allow him those permissions:
- Manage Roles
- Moderate Members
- Read Message History
- Send Messages
- View Channels
Make sure you enable the scope bot and applications.commands.
Also make sure you check the option named "Message Content Intent". Otherwise, some features just won't work.
Once created, you can generate a link with those permissions that will redirect to an authorization site to invite the bot on your server.
During this documentation page, the word Guild will be used instead Server to comply with Discord Documentation.
This section will explain how to create the different response object for the Discord service. If needed, refer to other sections about where to find the needed parameters.
To create a Send message response, you will need to specify the channel_id.
The app will make sure it have the permission to write a message and return a 400: Bad request if not.
Here's the correct payload to send:
{
"service_name": "Discord", // case sensitive
"name": "Send message", // case sensitive
"resource_ids": {
"channel_id": "<CHANNEL_ID>"
},
"payload": "This is what i want to tell the world."
}To create a Add role response, you will need to specify the guild_id, user_id, role_id.
The app will make sure it have the permission to manage permissions and return a 400: Bad request if not.
Here's the correct payload to send:
{
"service_name": "Discord",
"name": "Add role",
"resource_ids": {
"guild_id": "<GUILD_ID>",
"user_id": "<USER_ID>",
"role_id": "<ROLE_ID>"
}
}To create a New message trigger you will need to specify the guild_id and optionally the channel_id.
Here's the minimum payload to send:
{
"service_name": "Discord",
"name": "New message",
"input": {
"guild_id": "<GUILD_ID>",
"channel_id": "<CHANNEL_ID>"
},
"trigger_type": "webhook"
}You can add a description.
To create a New reaction trigger you will need to specify the guild_id, optionally the channel_id and optionally the message_id.
Note that if you want to specify the message_id, you will need to specify channel_id.
Here's the minimum payload to send:
{
"service_name": "Discord",
"name": "New message",
"input": {
"guild_id": "<GUILD_ID>",
"channel_id": "<CHANNEL_ID>",
"message_id": "<MESSAGE_ID>"
},
"trigger_type": "webhook"
}You can add a description.
Triggers when a message is edited in a server.
Required parameters: guild_id, optional channel_id and message_id.
{ "service_name": "Discord", "name": "Message Update", "input": { "guild_id": "<GUILD_ID>", "channel_id": "<CHANNEL_ID>", "message_id": "<MESSAGE_ID>" }, "trigger_type": "webhook" }
You can add a description.
Triggers when a message is deleted in a server.
Required parameters: guild_id, optional channel_id and message_id.
{ "service_name": "Discord", "name": "Message Delete", "input": { "guild_id": "<GUILD_ID>", "channel_id": "<CHANNEL_ID>", "message_id": "<MESSAGE_ID>" }, "trigger_type": "webhook" }
Triggers when multiple messages are deleted at once.
Required parameters: guild_id and optional channel_id. Individual message_ids are not required.
{ "service_name": "Discord", "name": "Message Delete Bulk", "input": { "guild_id": "<GUILD_ID>", "channel_id": "<CHANNEL_ID>" }, "trigger_type": "webhook" }
Triggers when a reaction is removed from a message.
Required parameters: guild_id, optional channel_id, message_id.
{ "service_name": "Discord", "name": "Message Reaction Remove", "input": { "guild_id": "<GUILD_ID>", "channel_id": "<CHANNEL_ID>", "message_id": "<MESSAGE_ID>" }, "trigger_type": "webhook" }
Triggers when all reactions are removed from a message.
Required parameters: guild_id, optional channel_id, message_id.
{ "service_name": "Discord", "name": "Message Reaction Remove All", "input": { "guild_id": "<GUILD_ID>", "channel_id": "<CHANNEL_ID>", "message_id": "<MESSAGE_ID>" }, "trigger_type": "webhook" }
Triggers when all reactions of a specific emoji are removed from a message.
Required parameters: guild_id, optional channel_id, message_id.
{ "service_name": "Discord", "name": "Message Reaction Remove Emoji", "input": { "guild_id": "<GUILD_ID>", "channel_id": "<CHANNEL_ID>", "message_id": "<MESSAGE_ID>" }, "trigger_type": "webhook" }
Triggers when a user is banned from a server.
Required parameters: guild_id and optionally user_id.
{ "service_name": "Discord", "name": "Guild Ban Add", "input": { "guild_id": "<GUILD_ID>", "user_id": "<USER_ID>" }, "trigger_type": "webhook" }
Triggers when a user is unbanned from a server.
Required parameters: guild_id and optionally user_id.
{ "service_name": "Discord", "name": "Guild Ban Remove", "input": { "guild_id": "<GUILD_ID>", "user_id": "<USER_ID>" }, "trigger_type": "webhook" }
In order to create a Discord response, the Application may need a guild_id.
Start by enabling the Discord developer mode in the settings (see Discord documentention).
To find your guild_id, right click on the guild's picture and left click on Copy server id.
If you don't want to enable the discord developer mode, another way of finding out this id is by right clicking on a guild's channel, then copy link, the link will look like this: https://discord.com/channels/1348369551691350188/1425012368408051774. The guild_id is the set of number right after channels/. The second one is the channel_id.
To find the guild_id, press the guild's image until a little window pops up, then click on more, then under the section Developer mode click on the button Copy server id.
If you don't want to enable the discord developer mode, another way of finding out this id is by pressing a guild's channel, then copy link, the link will look like this: https://discord.com/channels/1348369551691350188/1425012368408051774. The guild_id is the set of number right after channels/. The second one is the channel_id.
In order to interact with a Discord response, the Application may need a user_id.
Start by enabling the Discord developer mode in the settings (see Discord documentation).
To find a user_id, right click on the user's profile picture or username and select Copy ID.
If you don't want to enable the Discord developer mode, another way to find the user_id is by right clicking on a user's message, then Copy Message Link. The link will look like this: https://discord.com/channels/<GUILD_ID>/<CHANNEL_ID>/<MESSAGE_ID>. The user_id is not directly in this link, so enabling Developer Mode is the recommended method.
To find a user_id, press on the user's profile picture or username until a pop-up appears, then select Copy ID.
If you don't want to enable the Discord developer mode, there is no reliable way to get a user_id from the mobile app without Developer Mode enabled, so it is strongly recommended to enable it.
In order to create a Discord response, the Application may need a channel_id
To find your channel_id, go on the guild(server) you want to use the channel of, then right click on the channel's name and left click on Copy channel id.
If you don't want to enable the discord developer mode, another way of finding out this id is by right clicking the guild's channel you want, then copy link, the link will look like this: https://discord.com/channels/1348369551691350188/1425012368408051774. The channel_id is the last set of number.
To find the channel_id, press the guild's image until a little window pops up, then click on more, then under the section Developer mode click on the button Copy server id.
If you don't want to enable the discord developer mode, another way of finding out this id is by pressing the guild's channel you want, then copy link, the link will look like this: https://discord.com/channels/1348369551691350188/1425012368408051774. The channel_id is the last set of number.
In order to create a Discord response, the Application may need a role_id
To find your role_id, go on the guild(server) you want to use the channel of, then right click on the guild's image, hover on Server settings, a menu will pop up. Then left click on Roles. If there is no Server settings buttons, then you may not have the necessary rights on this server.
else, right click the role you want, then Copy role id.
It is the only way to find it.
In order to create a Discord response, the Application may need a message_id
To find your message_id, go to the message you want, then right click on the message, then Copy role id.
If you don't want to enable the discord developer mode, another way of finding out this id is by right clicking the message you want, then copy link, the link will look like this: https://discord.com/channels/1348369551691350188/1425012368408051774/1433747005087420436. The channel_id is the last set of number.
To find the message_id, go to the message you want, then press it until a submenu pops up. Then click on Copy message id.
If you don't want to enable the discord developer mode, another way of finding out this id is by pressing message you want, then copy link, the link will look like this: https://discord.com/channels/1348369551691350188/1425012368408051774/1433747005087420436. The channel_id is the last set of number.