节点与集成

Common issues

Here are some common errors and issues with the Discord node and steps to resolve or troubleshoot them.

Add extra fields to embeds

Discord messages can optionally include embeds, a rich preview component that can include a title, description, image, link, and more.

The Discord node supports embeds when using the Send operation on the Message resource. Select Add Embeds to set extra fields including Description, Author, Title, URL, and URL Image.

To add fields that aren't included by default, set Input Method to Raw JSON. From here, add a JSON object to the Value parameter defining the field names and values you want to include.

For example, to include footer and fields, neither of which are available using the Enter Fields Input Method, you could use a JSON object like this:

json
{
    "author": "My Name",
	"url": "https://discord.js.org",
	"fields": [
		{
			"name": "Regular field title",
			"value": "Some value here"
		}
	],
	"footer": {
		"text": "Some footer text here",
		"icon_url": "https://i.imgur.com/AfFp7pu.png"
	}
}

You can learn more about embeds in Using Webhooks and Embeds | Discord.

If you experience issues when working with embeds with the Discord node, you can use the HTTP Request with your existing Discord credentials to POST to the following URL:

text
https://discord.com/api/v10/channels/<CHANNEL_ID>/messages

In the body, include your embed information in the message content like this:

json
{
	"content": "Test",
	"embeds": [
		{
			"author": "My Name",
			"url": "https://discord.js.org",
			"fields": [
				{
					"name": "Regular field title",
					"value": "Some value here"
				}
			],
			"footer": {
				"text": "Some footer text here",
				"icon_url": "https://i.imgur.com/AfFp7pu.png"
			}
		}
	]
}

Mention users and channels

To mention users and channels in Discord messages, you need to format your message according to Discord's message formatting guidelines.

To mention a user, you need to know the Discord user's user ID. Keep in mind that the user ID is different from the user's display name. Similarly, you need a channel ID to link to a specific channel.

You can learn how to enable developer mode and copy the user or channel IDs in Discord's documentation on finding User/Server/Message IDs.

Once you have the user or channel ID, you can format your message with the following syntax:

  • User: <@USER_ID>
  • Channel: <#CHANNEL_ID>
  • Role: <@&ROLE_ID>

官方原文和授权

本页来自 N8N 英文官方网站固定快照,并转换成 xueai 静态页面。内容以 N8N 持续更新的官方页面为准。

来源、授权与修改

本站保留许可证、固定提交号、社区作者和修改说明,不代表 n8n 对本站背书。

查看许可证查看来源和修改说明