🐛 纠正错别字

This commit is contained in:
艾迪 2022-08-31 19:19:40 +08:00 committed by GitHub
parent 65f659c5dc
commit 83f09cd00f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 6 deletions

View File

@ -17,7 +17,7 @@ class QuizRepository:
questions = results.all() questions = results.all()
return questions return questions
async def get_answers_form_question_id(self, question_id: int) -> List[AnswerDB]: async def get_answers_from_question_id(self, question_id: int) -> List[AnswerDB]:
async with self.mysql.Session() as session: async with self.mysql.Session() as session:
query = select(AnswerDB).where(AnswerDB.question_id == question_id) query = select(AnswerDB).where(AnswerDB.question_id == question_id)
results = await session.exec(query) results = await session.exec(query)

View File

@ -12,7 +12,7 @@ class QuizService:
self._cache = cache self._cache = cache
self.lock = asyncio.Lock() self.lock = asyncio.Lock()
async def get_quiz_form_database(self) -> List[Question]: async def get_quiz_from_database(self) -> List[Question]:
"""从数据库获取问题列表 """从数据库获取问题列表
:return: Question List :return: Question List
""" """
@ -20,7 +20,7 @@ class QuizService:
question_list = await self._repository.get_question_list() question_list = await self._repository.get_question_list()
for question in question_list: for question in question_list:
question_id = question.id question_id = question.id
answers = await self._repository.get_answers_form_question_id(question_id) answers = await self._repository.get_answers_from_question_id(question_id)
data = Question.de_database_data(question) data = Question.de_database_data(question)
data.answers = [Answer.de_database_data(a) for a in answers] data.answers = [Answer.de_database_data(a) for a in answers]
temp.append(data) temp.append(data)
@ -37,7 +37,7 @@ class QuizService:
""" """
# 只允许一个线程访问该区域 让数据被安全有效的访问 # 只允许一个线程访问该区域 让数据被安全有效的访问
async with self.lock: async with self.lock:
question_list = await self.get_quiz_form_database() question_list = await self.get_quiz_from_database()
await self._cache.del_all_question() await self._cache.del_all_question()
question_count = await self._cache.add_question(question_list) question_count = await self._cache.add_question(question_list)
await self._cache.del_all_answer() await self._cache.del_all_answer()

View File

@ -59,7 +59,7 @@ class Material(BasePlugins):
Log.info(f"用户 {user.full_name}[{user.id}] 查询角色培养素材命令请求 || 参数 {character_name}") Log.info(f"用户 {user.full_name}[{user.id}] 查询角色培养素材命令请求 || 参数 {character_name}")
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO) await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
file_path = await url_to_file(url, "") file_path = await url_to_file(url, "")
caption = "Form 米游社 友人A " \ caption = "From 米游社 友人A " \
f"查看 [原图]({url})" f"查看 [原图]({url})"
await message.reply_photo(photo=open(file_path, "rb"), caption=caption, filename=f"{character_name}.png", await message.reply_photo(photo=open(file_path, "rb"), caption=caption, filename=f"{character_name}.png",
allow_sending_without_reply=True, parse_mode=ParseMode.MARKDOWN_V2) allow_sending_without_reply=True, parse_mode=ParseMode.MARKDOWN_V2)

View File

@ -57,7 +57,7 @@ class Strategy(BasePlugins):
Log.info(f"用户 {user.full_name}[{user.id}] 查询角色攻略命令请求 || 参数 {character_name}") Log.info(f"用户 {user.full_name}[{user.id}] 查询角色攻略命令请求 || 参数 {character_name}")
await message.reply_chat_action(ChatAction.UPLOAD_PHOTO) await message.reply_chat_action(ChatAction.UPLOAD_PHOTO)
file_path = await url_to_file(url, "") file_path = await url_to_file(url, "")
caption = "Form 米游社 西风驿站 " \ caption = "From 米游社 西风驿站 " \
f"查看 [原图]({url})" f"查看 [原图]({url})"
await message.reply_photo(photo=open(file_path, "rb"), caption=caption, filename=f"{character_name}.png", await message.reply_photo(photo=open(file_path, "rb"), caption=caption, filename=f"{character_name}.png",
allow_sending_without_reply=True, parse_mode=ParseMode.MARKDOWN_V2) allow_sending_without_reply=True, parse_mode=ParseMode.MARKDOWN_V2)