From 03b9dc7ae42837e4a8ab6b2570cd8e2e895f01b1 Mon Sep 17 00:00:00 2001 From: No767 <73260931+No767@users.noreply.github.com> Date: Sun, 27 Oct 2024 16:18:59 -0700 Subject: [PATCH] use msgspec json decoder instead --- bot/cogs/pronouns.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bot/cogs/pronouns.py b/bot/cogs/pronouns.py index 27fb317..7bc6139 100644 --- a/bot/cogs/pronouns.py +++ b/bot/cogs/pronouns.py @@ -5,7 +5,6 @@ import discord import msgspec -import orjson from discord import app_commands from discord.ext import commands, menus from libs.utils.embeds import Embed, FullErrorEmbed @@ -487,6 +486,7 @@ class Pronouns(commands.GroupCog, name="pronouns"): def __init__(self, bot: Catherine) -> None: self.bot = bot + self.decoder = msgspec.json.Decoder() self.session = self.bot.session self.pool = self.bot.pool super().__init__() @@ -621,7 +621,7 @@ async def db(self, interaction: discord.Interaction, member: discord.Member) -> params = {"platform": "discord", "ids": member.id} async with self.session.get("https://pronoundb.org/api/v2/lookup", params=params) as r: - data = await r.json(loads=orjson.loads) + data = await r.json(loads=self.decoder.decode) if len(data) == 0: await interaction.response.send_message("No pronouns found for these user(s).") return @@ -645,7 +645,7 @@ async def profile(self, interaction: discord.Interaction, username: str) -> None url = URL("https://en.pronouns.page/api/profile/get/") / username params = {"version": 2} async with self.session.get(url, params=params) as r: - data = await r.json(loads=orjson.loads) + data = await r.json(loads=self.decoder.decode) if len(data["profiles"]) == 0: await interaction.followup.send("The profile was not found") return