Beispiel #1
0
        public async Task StartQuiz(ulong id, ulong time = 60)
        {
            if (GlobalVar.QuizHasBeenStarted)
            {
                return;
            }
            if (!IsHavingThisRole((SocketGuildUser)Context.User, "Developer") &&
                !IsHavingThisRole((SocketGuildUser)Context.User, "Quiz Manager"))
            {
                return;
            }
            Quiz now = Quizzes.GetQuiz(id);

            if (now == null)
            {
                await Context.Channel.SendMessageAsync("`No Quiz Found`");

                return;
            }
            string formattedText = $"Quiz No-{now.ID} : \nDifficulty : {now.Difficulty}\n";

            formattedText += $"Time : {time} second(s)\n";
            switch (now.Type)
            {
            case "image":
                formattedText += $"Type : Image\n";
                break;

            case "sv":
                formattedText += $"Type : Shadowverse Pic\n";
                break;

            case "ost":
                formattedText += $"Type : OST(OP/ED)\n";
                break;

            case "bonus":
                formattedText += $"Type : Bonus\n";
                break;

            case "voice-sv":
                formattedText += $"Type : Shadowverse Voice\n";
                break;
            }
            int lenght = now.Drop.Count;
            int temp   = 0;

            for (int i = 0; i < lenght; i++)
            {
                formattedText += $"Drop-{i + 1} : {now.Drop[i].Name}\n";
                temp++;
            }
            for (int i = temp; i < 3; i++)
            {
                formattedText += $"Drop-{i + 1} : --- \n";
            }

            GlobalVar.Selected = now;
            Quizzes.ResetQuiz();
            GlobalVar.GuildSelect   = Context.Guild;
            GlobalVar.ChannelSelect = (SocketTextChannel)Context.Channel;
            await Context.Channel.SendMessageAsync($"{formattedText}");

            await ReapetedTimer.StartQuiz(time, Context.Guild, (SocketTextChannel)Context.Channel);
        }