quick commit
Some checks failed
CI/CD Pipeline / Code Quality Checks (push) Failing after 6m9s
CI/CD Pipeline / Security Scanning (push) Successful in 26s
CI/CD Pipeline / Tests (3.11) (push) Failing after 5m24s
CI/CD Pipeline / Tests (3.12) (push) Failing after 5m23s
CI/CD Pipeline / Build Docker Image (push) Has been skipped
CI/CD Pipeline / Deploy to Staging (push) Has been skipped
CI/CD Pipeline / Deploy to Production (push) Has been skipped
CI/CD Pipeline / Notification (push) Successful in 1s
Some checks failed
CI/CD Pipeline / Code Quality Checks (push) Failing after 6m9s
CI/CD Pipeline / Security Scanning (push) Successful in 26s
CI/CD Pipeline / Tests (3.11) (push) Failing after 5m24s
CI/CD Pipeline / Tests (3.12) (push) Failing after 5m23s
CI/CD Pipeline / Build Docker Image (push) Has been skipped
CI/CD Pipeline / Deploy to Staging (push) Has been skipped
CI/CD Pipeline / Deploy to Production (push) Has been skipped
CI/CD Pipeline / Notification (push) Successful in 1s
This commit is contained in:
@@ -10,8 +10,6 @@ from datetime import datetime, timedelta, timezone
|
||||
from enum import Enum
|
||||
from typing import Any
|
||||
|
||||
import discord
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -217,6 +215,28 @@ class EmojiChallengeGenerator(ChallengeGenerator):
|
||||
return names.get(emoji, "correct")
|
||||
|
||||
|
||||
class QuestionsChallengeGenerator(ChallengeGenerator):
|
||||
"""Generates custom question challenges."""
|
||||
|
||||
DEFAULT_QUESTIONS = [
|
||||
("What color is the sky on a clear day?", "blue"),
|
||||
("Type the word 'verified' to continue.", "verified"),
|
||||
("What is 2 + 2?", "4"),
|
||||
("What planet do we live on?", "earth"),
|
||||
]
|
||||
|
||||
def __init__(self, questions: list[tuple[str, str]] | None = None) -> None:
|
||||
self.questions = questions or self.DEFAULT_QUESTIONS
|
||||
|
||||
def generate(self) -> Challenge:
|
||||
question, answer = random.choice(self.questions)
|
||||
return Challenge(
|
||||
challenge_type=ChallengeType.QUESTIONS,
|
||||
question=question,
|
||||
answer=answer,
|
||||
)
|
||||
|
||||
|
||||
class VerificationService:
|
||||
"""Service for managing member verification."""
|
||||
|
||||
@@ -230,6 +250,7 @@ class VerificationService:
|
||||
ChallengeType.CAPTCHA: CaptchaChallengeGenerator(),
|
||||
ChallengeType.MATH: MathChallengeGenerator(),
|
||||
ChallengeType.EMOJI: EmojiChallengeGenerator(),
|
||||
ChallengeType.QUESTIONS: QuestionsChallengeGenerator(),
|
||||
}
|
||||
|
||||
def create_challenge(
|
||||
|
||||
Reference in New Issue
Block a user