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

huangapple go评论81阅读模式
英文:

discord.net - how to send link without embed

问题

我正在使用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

得分: 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;

huangapple
  • 本文由 发表于 2023年8月10日 19:11:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/76875173.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定