Ejemplo n.º 1
0
        private async Task SendReport(Features.Moderation.MessageCheck.MessageError?res, IGuild guild, IUser author, string message, ulong msgId, ulong chanId)
        {
            if (res == null)
            {
                return;
            }
            string id = await BotDb.GetReportChanId(guild.Id.ToString());

            if (id == "None")
            {
                return;
            }
            ITextChannel chan = await guild.GetTextChannelAsync(ulong.Parse(id));

            if (chan == null)
            {
                return;
            }
            var msg = await chan.SendMessageAsync("", false, new EmbedBuilder
            {
                Title       = "A message from " + author.ToString() + " (" + author.Id + ") was reported",
                Url         = "https://discordapp.com/channels/" + guild.Id + "/" + chanId + "/" + msgId,
                Description =
                    "♻: Delete message" + Environment.NewLine +
                    "⚠: Delete message and warn user" + Environment.NewLine +
                    "👢: Delete message and kick user" + Environment.NewLine +
                    "🔨: Delete message and ban user" + Environment.NewLine +
                    "❌: Delete report" + Environment.NewLine + Environment.NewLine +
                    "Click on the title to jump to the message",
                Color  = Color.Red,
                Fields = new List <EmbedFieldBuilder>()
                {
                    new EmbedFieldBuilder
                    {
                        IsInline = true,
                        Name     = "Flag triggered",
                        Value    = res.Value.flag
                    },
                    new EmbedFieldBuilder
                    {
                        IsInline = true,
                        Name     = "Flag value",
                        Value    = res.Value.currValue.ToString("0.00") + " / " + res.Value.maxValue.ToString("0.00")
                    },
                    new EmbedFieldBuilder
                    {
                        Name  = "Message",
                        Value = message
                    }
                },
                Footer = new EmbedFooterBuilder()
                {
                    Text = "Bot Technical Information: {\"UserId\":" + author.Id + ", \"MessageId\":" + msgId + ", \"ChannelId\":" + chanId + ", \"Flag\":\"" + res.Value.flag + "\"}"
                }
            }.Build());

            await msg.AddReactionsAsync(new IEmote[] { new Emoji("♻"), new Emoji("⚠"), new Emoji("👢"), new Emoji("🔨"), new Emoji("❌") });
        }