Esempio n. 1
0
        public override async Task OnCommand(CommandArguments command)
        {
            BlogPost post;

            await using (var db = await Database.GetConnectionAsync())
            {
                post = (await db.QueryAsync <BlogPost>("SELECT `ID`, `Slug`, `Title` FROM `Blog` WHERE `IsHidden` = 0 ORDER BY `Time` DESC LIMIT 1")).SingleOrDefault();
            }

            if (post.ID == 0)
            {
                command.Reply("No blog post found.");

                return;
            }

            command.Reply(
                command.Message.Length > 0 ?
                "Blog post:{0} {1}{2} -{3} {4}" :
                "Latest blog post:{0} {1}{2} -{3} {4}",

                Colors.BLUE, post.Title, Colors.NORMAL,
                Colors.DARKBLUE, SteamDB.GetBlogUrl(post.Slug.Length > 0 ? post.Slug : post.ID.ToString())
                );
        }