英文:
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<Embed>(), 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会自动显示一个嵌入。你可以通过在频道(或角色)中取消以下权限来防止这种情况发生:
或者通过将其包装在<>
中,例如:<https://google.com>
。
英文:
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:
or by wrapping it into <>
for example: <https://google.com>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论