コード例 #1
0
        private DiscordEmbedBuilder defaultImgEmbed(IamageModel imgInfo, IamagesAPIWrapper api)
        {
            string thumbUrl = api.getImgThumb(imgInfo.ImageID);
            string fileType = BotServices.ConvertToString(imgInfo.FileMime);
            string purity   = BotServices.ConvertToString(imgInfo.FileNSFW);

            string desc =
                $"**ID** = {imgInfo.ImageID}\n" +
                $"**Description** = {imgInfo.FileDesc ?? "No description provided."}\n" +
                $"**ImageType** = {fileType}\n" +
                $"**Purity** = {purity}\n" +
                $"**Dimensions** = {imgInfo.FileWidth}px x {imgInfo.FileHeight}px\n" +
                $"**Created at** = {imgInfo.created_at.DateTime}";

            var embed = new DiscordEmbedBuilder()
                        .WithAuthor("Iamages Discord Bot", null, SharedData.LogoURL)
                        .WithFooter("Retrieved from Iamages API")
                        .WithColor(SharedData.defaultColour)
                        .WithTimestamp(DateTime.Now)
                        .WithDescription(desc)
                        .WithImageUrl(thumbUrl);

            return(embed);
        }