Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
135 views
in Technique[技术] by (71.8m points)

c# - 什么是上下文? 如何将Embed对象发送到webhook?(What is Context? How to send Embed object to webhook?)

I can't figure out how to post Embed message to Discord channel.

(我不知道如何将嵌入消息发布到Discord频道。)

I've got my webhook:

(我有我的webhook:)

public DiscordWebhookClient wHook = new DiscordWebhookClient(649622881288537840, "2hQ2XsT7jucOfT4C8-XTsDSys29mPhOF_gFdZ0wBveqzDBR806m0HFl7VR9-ZJxUMRKO");

And I have a method to Post my embed message like this, but It says that it has to be IEnumerable instead of Discord.Embed:

(而且我有一种方法可以这样发布我的嵌入消息,但是它说它必须是IEnumerable而不是Discord.Embed:)

public async Task SendWebhookAsync(Listing listing)
        {

            EmbedBuilder builder = new EmbedBuilder();
            builder.WithTitle(listing.Name);
            builder.WithUrl(listing.Url);
            builder.WithImageUrl(listing.ImageUrl);


            await wHook.SendMessageAsync("", false, builder.Build());
        }

I have seen that people use but I don't understand what is context:

(我已经看到人们在使用,但是我不明白什么是上下文:)

await Context.Channel.SendMessageAsync("", false, builder.Build());
  ask by kris translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...