Esempio n. 1
0
        public async Task SteamGameAsync(EventContext context)
        {
            DateTime requestStart = DateTime.Now;

            string[] args = context.arguments.Split(' ');

            IDiscordEmbed embed = Utils.Embed;

            embed.SetAuthor("Steam Game", steamAuthorIcon, "");

            SteamGameInfo gameInfo = await steam.GetGameInfo(args[0]);

            embed.SetDescription(gameInfo.Name);
            embed.SetThumbnailUrl(gameInfo.HeaderImage);

            embed.SetFooter("Request took in " + Math.Round((DateTime.Now - requestStart).TotalMilliseconds) + "ms", "");
            embed.QueueToChannel(context.Channel);
        }
Esempio n. 2
0
        public async Task SteamUserAsync(EventContext context)
        {
            DateTime requestStart = DateTime.Now;

            string[] args = context.arguments.Split(' ');

            IDiscordEmbed embed = Utils.Embed;

            embed.SetAuthor("Steam Profile", steamAuthorIcon, "");

            SteamUserInfo user = await steam.GetSteamUser(args[0]);

            if (user == null)
            {
                embed = Utils.ErrorEmbed(context, "No user was found!");
                embed.QueueToChannel(context.Channel);
                return;
            }

            string userLevel = await steam.GetSteamLevel(user.SteamID);

            embed.SetThumbnailUrl(user.GetAvatarURL());

            /* Current Game & Embed Colour */
            if (user.IsPlayingGame())
            {
                if (user.CurrentGameName != "???")
                {
                    embed.SetDescription("Currently playing " + user.CurrentGameName);
                }
                else
                {
                    embed.SetDescription("Currently in-game");
                }
                embed.Color = new Color(0.5f, 1, 0.5f);
            }
            else if (user.PersonaState != 0)
            {
                embed.Color = new Color(0.5f, 0.5f, 1);
            }

            /* Name & ID */
            embed.AddInlineField("Name", user.GetUsername());
            embed.AddInlineField("ID", user.SteamID);

            /* Real Name & Country */
            embed.AddInlineField("Real Name", user.RealName);
            embed.AddInlineField("Country", (user.CountryCode != "???" ? ":flag_" + user.CountryCode.ToLower() + ": " : "") + user.CountryCode);

            /* Profile Link */
            embed.AddField("Link", user.ProfileURL);

            /* Created & Status */
            embed.AddInlineField("Created", String.Format("{0:MMMM d, yyyy}", user.TimeCreated));
            if (user.GetStatus() == "Offline")
            {
                embed.AddInlineField("Offline Since", ToTimeString(user.OfflineSince()));
            }
            else
            {
                embed.AddInlineField("Status", user.GetStatus());
            }

            /* Level */
            embed.AddInlineField("Level", userLevel);

            embed.SetFooter("Request took in " + Math.Round((DateTime.Now - requestStart).TotalMilliseconds) + "ms", "");
            embed.QueueToChannel(context.Channel);
        }