51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

discord.net – 如何发送不带嵌入的链接

英文:

discord.net - how to send link without embed

问题 {#heading}

我正在使用discord.net和c#向Discord发送一些文本:

var result = await client.SendMessageAsync(theText, false, Array.Empty<Embed>(), botname, imageUrl);

但我不想要任何嵌入式内容,当文本包含链接时,会自动生成一个嵌入式内容...
我该如何防止这种情况发生?使用null或Array.Empty()无法阻止嵌入式内容显示出来... 英文:

I'm sending some text to discord using discord.net and c#:

var result = await client.SendMessageAsync(theText, false, Array.Empty&lt;Embed&gt;(), botname, imageUrl);

but I don't want any embed, and when the text contains a link an embed is automatically generated...
How could I prevent that? using null or Array.Empty<Embed>() doesn't prevent the embed to show up...

答案1 {#1}

得分: 0

你的代码没有问题。如@Anu6is在评论中提到的,如果你发布一个链接,discord会自动显示一个嵌入。你可以通过在频道(或角色)中取消以下权限来防止这种情况发生:

discord.net – 如何发送不带嵌入的链接

或者通过将其包装在&lt;&gt;中,例如:&lt;https://google.com&gt;。 英文:

There is nothing wrong with your code. As @Anu6is mentioned in the comments, discord automatically shows an embed if you post a link. You can either prevent this by removing the following permission in the channels (or for the role) for your bot:

discord.net – 如何发送不带嵌入的链接

or by wrapping it into &lt;&gt; for example: &lt;https://google.com&gt;


赞(0)
未经允许不得转载:工具盒子 » discord.net – 如何发送不带嵌入的链接