Esempio n. 1
0
        public async Task AcceptQuote(int quoteId = 0)
        {
            EmbedBuilder eb;

            if (quoteId == 0)
            {
                eb = new EmbedBuilder
                {
                    Title       = "Invalid Syntax / Invalid ID",
                    Description = "**Syntax:** " + Guild.Load(Context.Guild.Id).Prefix + "acceptquote [id]",
                    Color       = new Color(210, 47, 33)
                };

                await ReplyAsync("", false, eb.Build());

                return;
            }

            RequestQuote q = RequestQuote.RequestQuotes.Find(quote => quote.RequestId == quoteId);

            if (q == null)
            {
                eb = new EmbedBuilder
                {
                    Title       = "Unable to find Quote",
                    Description = "Unable to find a request quote with that ID in the database.",
                    Color       = new Color(210, 47, 33)
                };

                await ReplyAsync("", false, eb.Build());

                return;
            }

            RequestQuote.ApproveRequestQuote(quoteId, Context.User.Id, Context.Guild.Id);
            AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id);

            eb = new EmbedBuilder
            {
                Title  = "Quote #" + quoteId + " approved",
                Author = new EmbedAuthorBuilder
                {
                    Name    = "@" + q.CreatedBy.GetUser().Username,
                    IconUrl = q.CreatedBy.GetUser().GetAvatarUrl()
                },
                Description = q.QuoteText,
                Footer      = new EmbedFooterBuilder
                {
                    Text    = "Approved by @" + Context.User.Username,
                    IconUrl = Context.User.GetAvatarUrl()
                }
            };

            await ReplyAsync("", false, eb.Build());

            await Configuration.Load().LogChannelId.GetTextChannel().SendMessageAsync("", false, eb.Build());
        }