Esempio n. 1
0
        public async Task ReportBugAsync(OldAccount a, Server s, SocketGuild g, Emoji flag, CommandInfo command, string subject, string summary)
        {
            List <Emoji> flags = new List <Emoji>
            {
                EmojiIndex.VisualFlag,
                EmojiIndex.SuggestFlag,
                EmojiIndex.SpeedFlag,
                EmojiIndex.PriorityFlag,
                EmojiIndex.ExceptionFlag
            };

            string pfx = (s.Config.UsePrefixes ? s.Config.Prefix : Context.Client.CurrentUser.Mention + " ");

            if (!flag.EqualsAny(flags))
            {
                await ReplyAsync($"You must specify a flag type for the bug you wish to report. `{pfx}flags` for more info.");

                return;
            }

            OriReportPriorityType type = flag.GetFlagType();

            if (type == OriReportPriorityType.Unknown)
            {
                await ReplyAsync($"You must specify a flag type for the bug you wish to report. `{pfx}flags` for more info.");

                return;
            }

            Report r = new Report(Context.Account, type, Context.Message.Id, command, subject);

            Context.Data.Global.LogReport(r);
            await(Context.Client.GetChannel(_bugs) as SocketTextChannel).SendMessageAsync(embed: r.Generate(a).Build());
            await ReplyAsync($"Your input has been noted. You may view your report with `{pfx}getreport {r.Id}`");
        }
Esempio n. 2
0
        public async Task SubmitReportRepsonseAsync(string flag, string command, string subject, [Remainder] string content)
        {
            Emoji ico = new Emoji(flag);

            if (flag.ToLower().EqualsAny("p0", "p1", "p2", "p3", "p4"))
            {
                ico = GetFlagType(flag);
            }

            SearchResult result = _service.Search(command);

            if (!result.IsSuccess)
            {
                await ReplyAsync("There are no commands that match what you typed.");

                return;
            }

            CommandInfo cmd  = _service.Search(command).Commands.FirstOrDefault().Command;
            string      name = ($"{cmd.Module.Name ?? cmd.Module.ToString()}.{cmd.Name}").ToLower().Replace(" ", "-");

            await BuildReportAsync(Context.Global, Context.Account, ico.GetFlagType(), name, Context.Global.CaseIncrement, content, subject);

            Context.Data.Update(Context.Account);
            Context.Data.Update(Context.Global);
        }
Esempio n. 3
0
        public Report(OrikivoCommandContext ctx, RestUserMessage message)
        {
            List <Embed> embeds = message.Embeds.ToList();

            if (embeds.Count > 0)
            {
                EmbedBuilder e = embeds.FirstOrDefault().ToEmbedBuilder();

                string sbj = "Subject: ";
                string bid = "BugID: ";

                string[] title = e.Title.Split('\n');

                string.Join("\n", title).Debug();


                string[] top = title[0].Split(" | ");
                string.Join(" | ", top).Debug();


                string emoji = top[0];

                string fullname = top[1];
                fullname.Debug("fullname length");

                string username = fullname.Substring(0, fullname.Length - 5);

                Debugger.Write("i passed this 5");
                // force ignore hashtag.
                string discriminator = top[1].Substring(username.Length + 1);

                Debugger.Write("i passed this 6");
                string sid = e.Footer.Text.Substring(bid.Length);

                Debugger.Write("i passed this 7");
                string command = top[2];
                Debugger.Write("i passed this 8");

                Emoji      flag = new Emoji(emoji.Unescape());
                SocketUser u    = ctx.Client.GetUser(username, discriminator);

                if (!u.Exists())
                {
                    ctx.Channel.SendMessageAsync($"user not found ({username}, {discriminator})");
                    throw new Exception("Invalid User: No User Fits the Statement.");
                }

                string subject = title[1].Substring(sbj.Length).TryUnwrap("**");
                string content = e.Description;
                ulong  id      = ulong.Parse(sid);

                Id      = id;
                Author  = new Author(u);
                Type    = flag.GetFlagType();
                Command = command;
                Subject = subject;
                Content = content;
                return;
            }

            throw new Exception("Invalid Message: No Embeds in Container.");
        }