示例#1
0
        public async Task FindTag(string tag, bool postFull = false)
        {
            if (!await RequireUser(Roles.Admin))
            {
                return;
            }
            var query = Looter.Where(x => x.Tags.Contains(tag));

            if (postFull)
            {
                foreach (var x in query)
                {
                    await ProcessMeme(x);
                }
            }
            else
            {
                int           i  = 0;
                StringBuilder sb = new StringBuilder();
                foreach (var x in query)
                {
                    sb.Append($"{x.Index}[{string.Join(",", x.Meme.Tags)}]\n[{x.Meme.URL}]\n");
                    if (i++ > 10)
                    {
                        i = 0;
                        await ReplyAsync(sb.ToString());

                        sb.Clear();
                    }
                }
                if (i != 0)
                {
                    await ReplyAsync(sb.ToString());
                }
            }
        }