无法与Discord API发送附件或嵌入
我需要有关Discord API中附件的错误的帮助。
它正在响应slash命令的应用程序commandType,但它仅通过内容成功,但没有用内容,而是使用嵌入式和附件。 (我什至不知道如何找到有关此错误的更多信息。)
我不知道有什么问题,并感谢您的帮助。
我正在使用为Deno编辑的DeNo环境,并使用DeNo的DeNo环境。不使用Discord.js。
import {
APIApplicationCommandInteraction,
APIInteractionResponse,
InteractionResponseType,
APIAttachment,
APIEmbed
} from "../lib/discord-api-types/payloads/index.ts";
import { Snowflake } from "../lib/discord-api-types/globals.ts";
import { DiscordSnowflake as sf } from "../lib/snowflake/DiscordSnowflake.ts";
export const onApplicationCommand = (
interaction: APIApplicationCommandInteraction
) => {
let res: APIInteractionResponse = {
type: InteractionResponseType.ChannelMessageWithSource,
data: {
// Success!!
content: "hello"
// Some Error
// embeds: [
// {url: "https://media.valorant-api.com/weaponskinlevels/d6b75f1b-409b-bae9-d378-d3adf04a3ca9/displayicon.png"} as APIEmbed
// ]
// Some Error
// attachments: [
// {
// id: sf.generate().toString() as Snowflake,
// filename: "displayicon.png",
// content_type: "image/png",
// size: 56056,
// url: "https://media.valorant-api.com/weaponskinlevels/d6b75f1b-409b-bae9-d378-d3adf04a3ca9/displayicon.png",
// proxy_url: "https://media.valorant-api.com/weaponskinlevels/d6b75f1b-409b-bae9-d378-d3adf04a3ca9/displayicon.png",
// } as APIAttachment,
// ],
},
};
return res;
};
我编辑了Discord-api类型以使用类型定义。 我在github上查找使用附件,但它使用了discord.js,没有帮助。 我不知道发送响应后的不便错误是什么,所以我需要知道如何找出答案。我也不知道该怎么做。
I need help with an error about Attachments in the Discord API.
It is responding to the ApplicationCommandType of the slash command in serverless, but it succeeds with Content only, but not with Content but with embedds and attachments.
(I don't even know how to find out more about this error.)
I have no idea what is wrong and would appreciate your help.
I am using deno environment with discord-api-types edited for deno. discord.js is not used.
import {
APIApplicationCommandInteraction,
APIInteractionResponse,
InteractionResponseType,
APIAttachment,
APIEmbed
} from "../lib/discord-api-types/payloads/index.ts";
import { Snowflake } from "../lib/discord-api-types/globals.ts";
import { DiscordSnowflake as sf } from "../lib/snowflake/DiscordSnowflake.ts";
export const onApplicationCommand = (
interaction: APIApplicationCommandInteraction
) => {
let res: APIInteractionResponse = {
type: InteractionResponseType.ChannelMessageWithSource,
data: {
// Success!!
content: "hello"
// Some Error
// embeds: [
// {url: "https://media.valorant-api.com/weaponskinlevels/d6b75f1b-409b-bae9-d378-d3adf04a3ca9/displayicon.png"} as APIEmbed
// ]
// Some Error
// attachments: [
// {
// id: sf.generate().toString() as Snowflake,
// filename: "displayicon.png",
// content_type: "image/png",
// size: 56056,
// url: "https://media.valorant-api.com/weaponskinlevels/d6b75f1b-409b-bae9-d378-d3adf04a3ca9/displayicon.png",
// proxy_url: "https://media.valorant-api.com/weaponskinlevels/d6b75f1b-409b-bae9-d378-d3adf04a3ca9/displayicon.png",
// } as APIAttachment,
// ],
},
};
return res;
};
I edited discord-api-types to use type definitions.
I looked on github for a use of attachment, but it was using discord.js and was not helpful.
I don't know what the discord error is after sending a response, so I need to know how to find out. I couldn't figure out how to do this either.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论