Esempio n. 1
0
        public async Task ShowRiddleAsync()
        {
            var riddles = new List <Question>();

            using (var db = new Database.UserContext(Config))
            {
                riddles = await db.GetCachedAllQuestionsAsync();
            }

            riddles = riddles.Shuffle().ToList();
            var riddle = riddles.FirstOrDefault();

            riddle.Answers = riddle.Answers.OrderBy(x => x.Number).ToList();

            var msg = await ReplyAsync(riddle.Get());

            await msg.AddReactionsAsync(riddle.GetEmotes());

            await Task.Delay(15000);

            var react = await msg.GetReactionUsersAsync(riddle.GetRightEmote(), 100).FlattenAsync();

            await msg.RemoveAllReactionsAsync();

            if (react.Any(x => x.Id == Context.User.Id))
            {
                await ReplyAsync("", false, $"{Context.User.Mention} zgadłeś!".ToEmbedMessage(EMType.Success).Build());
            }
            else
            {
                await ReplyAsync("", false, $"{Context.User.Mention} pudło!".ToEmbedMessage(EMType.Error).Build());
            }
        }
Esempio n. 2
0
 public async Task <List <Database.Models.Question> > GetQuestionsAsync()
 {
     using (var db = new Database.UserContext(_config))
     {
         return(await db.GetCachedAllQuestionsAsync());
     }
 }