Ejemplo n.º 1
0
        /// <summary>
        /// Uploads the code in the given message to the service, and returns the URL to the post.
        /// </summary>
        /// <param name="msg">The Discord message to upload</param>
        /// <param name="code">The string to upload instead of message content</param>
        /// <returns>The URL to the newly created post</returns>
        public async Task <string> UploadCodeAsync(IMessage msg, string code = null)
        {
            var formatted = string.Format(Header,
                                          $"{msg.Author.Username}#{msg.Author.DiscriminatorValue}", msg.Channel.Name,
                                          DateTimeOffset.UtcNow.ToString("dddd, MMMM d yyyy @ H:mm:ss"), msg.Id,
                                          FormatUtilities.FixIndentation(code ?? msg.Content));

            return(await UploadCodeAsync(formatted));
        }
Ejemplo n.º 2
0
        public EmbedBuilder BuildEmbed(IUser user, string content, string url)
        {
            var cleanCode = FormatUtilities.FixIndentation(content);

            return(new EmbedBuilder()
                   .WithTitle("Your message was re-uploaded")
                   .WithAuthor(user)
                   .WithDescription(cleanCode.Trim().Truncate(200, 6))
                   .AddInlineField("Auto-Paste", url)
                   .WithColor(new Color(95, 186, 125)));
        }