Update
This commit is contained in:
parent
78fdeffaa2
commit
8bd272f7d4
6 changed files with 15 additions and 12 deletions
|
@ -74,3 +74,5 @@ dice_output_count = 50
|
|||
dice_output_len = 200
|
||||
dice_detail_count = 5
|
||||
dice_count_limit = 10
|
||||
wordle_attempts = 6
|
||||
wordle_background_color = 'white'
|
|
@ -1,4 +1,3 @@
|
|||
import asyncio
|
||||
import io
|
||||
import re
|
||||
|
||||
|
@ -93,7 +92,7 @@ if Config('openai_api_key'):
|
|||
Logger.warn(run.last_error.json())
|
||||
raise NoReportException(msg.locale.t('ask.message.rate_limit_exceeded'))
|
||||
raise RuntimeError(run.last_error.json())
|
||||
await asyncio.sleep(4)
|
||||
await msg.sleep(4)
|
||||
|
||||
messages = await client.beta.threads.messages.list(
|
||||
thread_id=thread.id
|
||||
|
|
|
@ -235,7 +235,7 @@ async def chemical_code(msg: Bot.MessageSession, id=None, random_mode=True, capt
|
|||
msg.locale.t('chemical_code.message.timeup', answer=play_state[msg.target.target_id]["answer"]))
|
||||
|
||||
else:
|
||||
await asyncio.sleep(1) # 防冲突
|
||||
await msg.sleep(1) # 防冲突
|
||||
await timer(start)
|
||||
|
||||
if not captcha_mode:
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import asyncio
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
|
@ -327,7 +326,7 @@ if Info.subprocess:
|
|||
if datetime.now().timestamp() - restart_time[0] < 60:
|
||||
if len(get) != 0:
|
||||
await msg.send_message(msg.locale.t("core.message.restart.wait", count=len(get)))
|
||||
await asyncio.sleep(10)
|
||||
await msg.sleep(10)
|
||||
return await wait_for_restart(msg)
|
||||
else:
|
||||
await msg.send_message(msg.locale.t("core.message.restart.restarting"))
|
||||
|
@ -389,7 +388,7 @@ if Bot.FetchTarget.name == 'QQ':
|
|||
else:
|
||||
await x['fetch'].send_direct_message(x['message'])
|
||||
Temp.data['waiting_for_send_group_message'].remove(x)
|
||||
await asyncio.sleep(30)
|
||||
await msg.sleep(30)
|
||||
await msg.finish(msg.locale.t("core.message.resume.done"))
|
||||
else:
|
||||
await msg.finish(msg.locale.t("core.message.resume.nothing"))
|
||||
|
@ -409,7 +408,7 @@ if Bot.FetchTarget.name == 'QQ':
|
|||
else:
|
||||
await x['fetch'].send_direct_message(x['message'])
|
||||
Temp.data['waiting_for_send_group_message'].remove(x)
|
||||
await asyncio.sleep(30)
|
||||
await msg.sleep(30)
|
||||
await msg.finish(msg.locale.t("core.message.resume.done"))
|
||||
else:
|
||||
await msg.finish(msg.locale.t("core.message.resume.nothing"))
|
||||
|
|
|
@ -141,7 +141,7 @@ async def _(msg: Bot.MessageSession):
|
|||
await msg.send_message(f'.' * wait_repeat, quote=False)
|
||||
wait_time -= 0.25
|
||||
|
||||
await asyncio.sleep(0.25)
|
||||
await msg.sleep(0.25)
|
||||
|
||||
await timer(start, wait_time, hooked_time, wait_repeat, hook_repeat) # 重新调用计时器函数
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'words.txt'),
|
|||
with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'answers.txt'), encoding='utf8') as handle:
|
||||
answers_list = handle.read().splitlines()
|
||||
play_state = {}
|
||||
attempts = Config('wordle_attempts', 6)
|
||||
|
||||
|
||||
class WordleState(Enum):
|
||||
|
@ -116,13 +117,13 @@ class WordleBoardImage:
|
|||
def __init__(self):
|
||||
self.cell_size = 50
|
||||
self.margin = 10
|
||||
self.rows = 6
|
||||
self.rows = attempts
|
||||
self.columns = 5
|
||||
self.green_color = (107, 169, 100)
|
||||
self.yellow_color = (201, 180, 88)
|
||||
self.grey_color = (120, 124, 126)
|
||||
self.border_color = (211, 214, 218)
|
||||
self.background_color = "white"
|
||||
self.background_color = Config('wordle_background_color', 'white')
|
||||
self.wordle_board = None
|
||||
self.image = self.create_empty_board()
|
||||
self.font_path = "assets/Noto Sans CJK Bold.otf"
|
||||
|
@ -194,7 +195,7 @@ async def _(msg: Bot.MessageSession):
|
|||
Logger.info(f'Answer: {board.word}')
|
||||
await msg.send_message([BImage(path), Plain(msg.locale.t('wordle.message.start'))])
|
||||
|
||||
while board.get_trials() <= 6 and play_state[msg.target.target_id]['active'] and not board.is_game_over():
|
||||
while board.get_trials() <= attempts and play_state[msg.target.target_id]['active'] and not board.is_game_over():
|
||||
if not play_state[msg.target.target_id]['active']:
|
||||
return
|
||||
wait = await msg.wait_anyone(timeout=3600)
|
||||
|
@ -210,9 +211,11 @@ async def _(msg: Bot.MessageSession):
|
|||
board_image.update_board(board)
|
||||
board_image.save_image(path)
|
||||
|
||||
if not board.is_game_over():
|
||||
if not board.is_game_over() and board.get_trials() <= attempts:
|
||||
Logger.info(f'{word} != {board.word}, attempt {board.get_trials() - 1}')
|
||||
await wait.send_message([BImage(path)])
|
||||
|
||||
await msg.sleep(3)
|
||||
|
||||
play_state[msg.target.target_id]['active'] = False
|
||||
g_msg = msg.locale.t('wordle.message.finish', answer=board.word)
|
||||
|
|
Reference in a new issue