Implemented memcached caching

This commit is contained in:
2025-02-09 23:00:18 +01:00
parent d402c520a5
commit b3a7e3623a
20 changed files with 460 additions and 101 deletions

View File

@@ -47,7 +47,9 @@ class CustomChannels(commands.Cog):
Command to create a custom channel for a user.
"""
holo_user_ctx: HoloUser = await HoloUser.from_user(ctx.user)
holo_user_ctx: HoloUser = await HoloUser.from_user(
ctx.user, cache=self.client.cache
)
# Return if the user is using the command outside of a guild
if not hasattr(ctx.author, "guild"):
@@ -100,7 +102,9 @@ class CustomChannels(commands.Cog):
manage_channels=True,
)
await holo_user_ctx.set_custom_channel(created_channel.id)
await holo_user_ctx.set_custom_channel(
created_channel.id, cache=self.client.cache
)
await ctx.respond(
embed=Embed(
@@ -136,7 +140,9 @@ class CustomChannels(commands.Cog):
Command to change properties of a custom channel.
"""
holo_user_ctx: HoloUser = await HoloUser.from_user(ctx.user)
holo_user_ctx: HoloUser = await HoloUser.from_user(
ctx.user, cache=self.client.cache
)
custom_channel: TextChannel | None = ds_utils.get(
ctx.guild.channels, id=holo_user_ctx.custom_channel
@@ -182,7 +188,9 @@ class CustomChannels(commands.Cog):
"""Command /customchannel remove [<confirm>]
Command to remove a custom channel. Requires additional confirmation."""
holo_user_ctx: HoloUser = await HoloUser.from_user(ctx.user)
holo_user_ctx: HoloUser = await HoloUser.from_user(
ctx.user, cache=self.client.cache
)
# Return if the user does not have a custom channel
if holo_user_ctx.custom_channel is None:
@@ -211,7 +219,7 @@ class CustomChannels(commands.Cog):
color=Color.FAIL,
)
)
await holo_user_ctx.remove_custom_channel()
await holo_user_ctx.remove_custom_channel(cache=self.client.cache)
return
# Return if the confirmation is missing
@@ -227,7 +235,7 @@ class CustomChannels(commands.Cog):
await custom_channel.delete(reason="Власник запросив видалення")
await holo_user_ctx.remove_custom_channel()
await holo_user_ctx.remove_custom_channel(cache=self.client.cache)
try:
await ctx.respond(