示例#1
0
        private async Task <IMessage> FollowupFileAsyncInternal(Stream stream, string filename, string text, bool isTTS, IEnumerable <Embed> embeds,
                                                                string username, string avatarUrl, AllowedMentions allowedMentions, RequestOptions options, bool isSpoiler, int?flags)
        {
            var args = new UploadWebhookFileParams(stream)
            {
                Filename = filename, Content = text, IsTTS = isTTS, IsSpoiler = isSpoiler
            };

            if (username != null)
            {
                args.Username = username;
            }
            if (avatarUrl != null)
            {
                args.AvatarUrl = avatarUrl;
            }
            if (embeds != null)
            {
                args.Embeds = embeds.Select(x => x.ToModel()).ToArray();
            }
            if (allowedMentions != null)
            {
                args.AllowedMentions = allowedMentions.ToModel();
            }
            if (flags.HasValue)
            {
                args.Flags = flags.Value;
            }

            return(await InteractionHelper.SendFollowupFileAsync(Discord.Rest, args, Token, Channel, options).ConfigureAwait(false));
        }