Replaced json with ujson

This commit is contained in:
Profitroll 2023-04-23 10:44:21 +02:00
parent 4ce4cb1a47
commit e3e6d34677
2 changed files with 5 additions and 8 deletions

View File

@ -1,16 +1,14 @@
import asyncio
from datetime import datetime
from random import choice
import time
import traceback
from typing import List
import discord, json # type: ignore
import discord, ujson
import os
from modules.booruGet import booruGet
from discord import Embed, ButtonStyle, ApplicationContext, Option # type: ignore
from discord.enums import ChannelType # type: ignore
#from discord_slash import SlashCommand, SlashContext
@ -26,13 +24,11 @@ def logWrite(message):
def jsonSave(filename, value):
with open(filename, 'w', encoding="utf-8") as f:
json.dump(value, f, indent=4, ensure_ascii=False)
f.close()
f.write(ujson.dumps(value, indent=4, ensure_ascii=False))
def jsonLoad(filename):
with open(filename, 'r', encoding="utf-8") as f:
value = json.load(f)
f.close()
value = ujson.loads(f.read())
return value
#=========================================================================================================================

View File

@ -1,2 +1,3 @@
py-cord[speed]==2.4.1
requests==2.28.2
ujson==5.7.0