Worked on #13 and #4. There are some caching issues left, though. Introduced abstract class Cacheable. Replaced async_pymongo with pymongo
This commit is contained in:
@@ -43,7 +43,7 @@ class CogUnregister(Cog):
|
||||
try:
|
||||
guild: PycordGuild = await self.bot.find_guild(ctx.guild.id)
|
||||
except (InvalidId, GuildNotFoundError):
|
||||
await ctx.respond(self.bot._("unexpected_error", "messages", locale=ctx.locale))
|
||||
await ctx.respond(self.bot._("unexpected_error", "messages", locale=ctx.locale), ephemeral=True)
|
||||
return
|
||||
|
||||
try:
|
||||
@@ -53,17 +53,22 @@ class CogUnregister(Cog):
|
||||
return
|
||||
|
||||
if not guild.is_configured():
|
||||
await ctx.respond(self.bot._("guild_unconfigured", "messages", locale=ctx.locale))
|
||||
await ctx.respond(
|
||||
self.bot._("guild_unconfigured", "messages", locale=ctx.locale), ephemeral=True
|
||||
)
|
||||
return
|
||||
|
||||
user: PycordUser = await self.bot.find_user(ctx.author, ctx.guild)
|
||||
|
||||
if user.is_jailed:
|
||||
await ctx.respond(self.bot._("jailed_error", "messages", locale=ctx.locale))
|
||||
await ctx.respond(self.bot._("jailed_error", "messages", locale=ctx.locale), ephemeral=True)
|
||||
return
|
||||
|
||||
# TODO Fix a bug where registered_event_ids is invalid because of caching
|
||||
if pycord_event._id not in user.registered_event_ids:
|
||||
await ctx.respond(self.bot._("unregister_not_registered", "messages", locale=ctx.locale))
|
||||
await ctx.respond(
|
||||
self.bot._("unregister_not_registered", "messages", locale=ctx.locale), ephemeral=True
|
||||
)
|
||||
return
|
||||
|
||||
await user.event_unregister(pycord_event._id, cache=self.bot.cache)
|
||||
|
Reference in New Issue
Block a user