This commit is contained in:
CMHopeSunshine 2022-05-15 21:12:39 +08:00
parent 02173dd8ff
commit e67c117348
3 changed files with 7 additions and 5 deletions

View File

@ -25,9 +25,11 @@ update_ys_voice = on_command('更新原神语音资源', priority=12, permission
async def download_voice(bot: Bot, event: Union[PrivateMessageEvent, GroupMessageEvent]):
await bot.send(event, '资源尚未初始化,现在开始下载资源,这需要较长的时间,请耐心等待')
await download_data.update_voice_data()
await bot.send(event, '资源下载完成,请重新发送指令开始游戏')
if not dir_name.exists():
dir_name.mkdir(parents=True, exist_ok=True)
await bot.send(event, '资源尚未初始化,现在开始下载资源,这需要较长的时间,请耐心等待')
await download_data.update_voice_data()
await bot.send(event, '资源下载完成,请重新发送指令开始游戏')
@guess_game.handle()

View File

@ -36,7 +36,7 @@ dir_data.mkdir(parents=True, exist_ok=True)
############
def init_db(db_dir, db_name='db.sqlite') -> SqliteDict:
return SqliteDict(get_path(db_dir, db_name),
return SqliteDict(str(get_path(db_dir, db_name)),
encode=json.dumps,
decode=json.loads,
autocommit=True)

View File

@ -35,7 +35,7 @@ def init_db(db_dir, db_name='db.sqlite', tablename='unnamed') -> SqliteDict:
db_cache_key = db_name + tablename
if db.get(db_cache_key):
return db[db_cache_key]
db[db_cache_key] = SqliteDict(get_path(db_dir, db_name),
db[db_cache_key] = SqliteDict(str(get_path(db_dir, db_name)),
tablename=tablename,
encode=json.dumps,
decode=json.loads,