Ejemplo n.º 1
0
        private static void Watchdog_UserMatchListUpdated(object source, APIWatchdogMatchUpdateEventArgs args)
        {
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("New match on " + args.User.PUBGName + "'s account! The new match id is: " + args.MatchID);


            Console.ReadLine();


            API               pubgapi      = new API(Environment.GetEnvironmentVariable("API_KEY", EnvironmentVariableTarget.User));
            APIRequest        matchrequest = pubgapi.RequestMatch(args.MatchID, PlatformRegionShard.PC_NA);
            DiscordWebhooks   webhooks     = new DiscordWebhooks("");
            DiscordEmbedField kills        = new DiscordEmbedField();
            DiscordEmbedField heals        = new DiscordEmbedField();
            DiscordEmbedField winplace     = new DiscordEmbedField();
            DiscordEmbedField headshotkill = new DiscordEmbedField();
            DiscordEmbedField longestkill  = new DiscordEmbedField();
            DiscordEmbedField killstreak   = new DiscordEmbedField();

            foreach (APIPlayer player in matchrequest.Match.PlayerList)
            {
                if (player.PlayerId == args.User.AccountID)
                {
                    kills = new DiscordEmbedField()
                    {
                        Name = "Kills", Value = player.Kills.ToString(), Inline = true
                    };
                    killstreak = new DiscordEmbedField()
                    {
                        Name = "Kill Streak", Value = player.KillStreaks.ToString(), Inline = true
                    };
                    longestkill = new DiscordEmbedField()
                    {
                        Name = "Longest Kill", Value = player.LongestKill.ToString() + " m.", Inline = true
                    };
                    headshotkill = new DiscordEmbedField()
                    {
                        Name = "Headshot Kills", Value = player.HeadshotKills.ToString(), Inline = true
                    };
                    heals = new DiscordEmbedField()
                    {
                        Name = "Heals", Value = player.Heals.ToString(), Inline = true
                    };
                    winplace = new DiscordEmbedField()
                    {
                        Name = "Win Place", Value = player.WinPlace.ToString(), Inline = true
                    };
                }
            }
            DiscordembedAuthor author = new DiscordembedAuthor()
            {
                Name = "", URL = "", Icon_URL = ""
            };

            webhooks.MessageChannel(args.User.PUBGName + "'s Most Recent Match", matchrequest.Match.Gamemode + " on " + matchrequest.Match.MapName, author, new List <DiscordEmbedField>()
            {
                kills, heals, winplace, killstreak, longestkill, headshotkill
            }, "", 231, 163, 54);
            Console.ForegroundColor = ConsoleColor.White;
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            DiscordWebhooks webhooks = new DiscordWebhooks("https://discordapp.com/api/webhooks/433824702826283018/8l0sO7fOsl0wETFd2wGMbfshsiPb58da_3mwRYr5uJuL11xE9406cxl5jFy0-TYArLkO");

            webhooks.MessageChannel("mems");
            DiscordEmbedField field = new DiscordEmbedField()
            {
                Name = "name1", Value = "val", Inline = true
            };
            DiscordEmbedField field2 = new DiscordEmbedField()
            {
                Name = "name13", Value = "2val", Inline = true
            };
            DiscordembedAuthor author = new DiscordembedAuthor()
            {
                Name = "kitten", URL = "https://gist.github.com/Birdie0/78ee79402a4301b1faf412ab5f1cdcf9", Icon_URL = "http://icons.iconarchive.com/icons/paomedia/small-n-flat/256/sign-check-icon.png"
            };

            webhooks.MessageChannel("title", "desc", author, new List <DiscordEmbedField>()
            {
                field, field2
            }, "", 255, 255, 255, new DiscordEmbedFooter()
            {
                Text = "Footer", Icon_URL = ""
            });
            Console.WriteLine("Done");
            Console.ReadLine();
        }