Skip to content

Commit

Permalink
可以在 clean_cache 接口中清理 node 缓存
Browse files Browse the repository at this point in the history
  • Loading branch information
This-is-XiaoDeng committed Nov 5, 2023
1 parent b1288fd commit f54b6aa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions basic_api_v11.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import node2image
from discord.channel import CategoryChannel, ForumChannel
from logger import get_logger
import os
import translator
import message_parser_v11
import return_object
Expand Down Expand Up @@ -71,9 +72,18 @@ async def send_private_msg(
async def delete_msg(message_id: int) -> dict:
return await basic_actions_v12.delete_message(str(message_id))

def clean_node_cache() -> None:
for file in os.listdir(".cache"):
if file.startswith("node."):
os.remove(os.path.join(".cache", file))

@register_action("v11")
async def clean_cache() -> dict:
await file.clean_files()
try:
clean_node_cache()
except Exception:
pass
return return_object.get(0)

@register_action("v11")
Expand Down

0 comments on commit f54b6aa

Please sign in to comment.