Fixed checker behavior
This commit is contained in:
parent
526f4acef7
commit
9fb580ffb7
11
glorybot.py
11
glorybot.py
@ -3,6 +3,7 @@ from datetime import datetime
|
|||||||
from random import choice
|
from random import choice
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
from typing import List
|
||||||
import discord, json # type: ignore
|
import discord, json # type: ignore
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@ -70,6 +71,12 @@ def makeEmbed(title="", description="", footer="", image=None, color=0xffffff):
|
|||||||
if image is not None:
|
if image is not None:
|
||||||
embed.set_image(url=image)
|
embed.set_image(url=image)
|
||||||
return embed
|
return embed
|
||||||
|
|
||||||
|
async def is_correct_answer(answer: str, correct: List[str]) -> bool:
|
||||||
|
for entry in correct:
|
||||||
|
if (answer.lower().replace(" ", "").replace(",", "").replace(".", "").replace("–", "-").replace("—", "-")).startswith(entry.lower().replace(" ", "")):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
#=========================================================================================================================
|
#=========================================================================================================================
|
||||||
|
|
||||||
|
|
||||||
@ -451,9 +458,7 @@ async def on_message(message):
|
|||||||
|
|
||||||
if message.author != client.user:
|
if message.author != client.user:
|
||||||
|
|
||||||
for answer in userdata[str(message.author.id)]["captcha"]["answer"]:
|
if await is_correct_answer(message.content, userdata[str(message.author.id)]["captcha"]["answer"]):
|
||||||
|
|
||||||
if answer.lower().replace(" ", "") in message.content.lower().replace(" ", "").replace(",", "").replace(".", ""):
|
|
||||||
|
|
||||||
logWrite(f"User {message.author.name}#{message.author.discriminator} verified")
|
logWrite(f"User {message.author.name}#{message.author.discriminator} verified")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user