Formatting changes, delay changes
This commit is contained in:
parent
dffd5f780f
commit
58e0ee892b
2 changed files with 15 additions and 14 deletions
|
@ -62,9 +62,9 @@ class BanCog(ModcaseCog):
|
|||
|
||||
embed.set_author(
|
||||
name=user.display_name,
|
||||
icon_url=user.avatar,
|
||||
icon_url=user.avatar.url,
|
||||
)
|
||||
embed.set_thumbnail(url=user.avatar)
|
||||
embed.set_thumbnail(url=user.avatar.url)
|
||||
embed.set_footer(text=f"{user.username}#{user.discriminator} | {user.id}")
|
||||
|
||||
await ctx.send(embed=embed)
|
||||
|
@ -89,9 +89,9 @@ class BanCog(ModcaseCog):
|
|||
)
|
||||
embed.set_author(
|
||||
name=user.username,
|
||||
icon_url=user.avatar,
|
||||
icon_url=user.avatar.url,
|
||||
)
|
||||
embed.set_thumbnail(url=user.avatar)
|
||||
embed.set_thumbnail(url=user.avatar.url)
|
||||
embed.set_footer(text=f"{user.username}#{user.discriminator} | {user.id}")
|
||||
await ctx.send(embed=embed)
|
||||
|
||||
|
@ -121,15 +121,15 @@ class BanCog(ModcaseCog):
|
|||
async def _ban(
|
||||
self,
|
||||
ctx: InteractionContext,
|
||||
user: User,
|
||||
reason: str,
|
||||
user: User = None,
|
||||
btype: str = "perm",
|
||||
duration: int = 4,
|
||||
) -> None:
|
||||
if not user or user == ctx.author:
|
||||
if user.id == ctx.author.id:
|
||||
await ctx.send("You cannot ban yourself.", ephemeral=True)
|
||||
return
|
||||
if user == self.bot.user:
|
||||
if user.id == self.bot.user.id:
|
||||
await ctx.send("I'm afraid I can't let you do that", ephemeral=True)
|
||||
return
|
||||
if btype == "temp" and duration < 0:
|
||||
|
@ -215,9 +215,10 @@ class BanCog(ModcaseCog):
|
|||
discord_ban_info = None
|
||||
database_ban_info = None
|
||||
|
||||
bans = await ctx.guild.bans()
|
||||
bans = await ctx.guild.fetch_bans()
|
||||
|
||||
# Try to get ban information out of Discord
|
||||
self.logger.debug(f"{user}")
|
||||
if re.match(r"^[0-9]{1,}$", user): # User ID
|
||||
user = int(user)
|
||||
discord_ban_info = find(lambda x: x.user.id == user, bans)
|
||||
|
@ -252,9 +253,9 @@ class BanCog(ModcaseCog):
|
|||
# try to find the relevant information in the database.
|
||||
# We take advantage of the previous checks to save CPU cycles
|
||||
if not discord_ban_info:
|
||||
if isinstance(user, int):
|
||||
if isinstance(user, User):
|
||||
database_ban_info = await Ban.find_one(
|
||||
q(guild=ctx.guild.id, user=user, active=True)
|
||||
q(guild=ctx.guild.id, user=user.id, active=True)
|
||||
)
|
||||
else:
|
||||
search = {
|
||||
|
@ -320,10 +321,10 @@ class BanCog(ModcaseCog):
|
|||
search["active"] = True
|
||||
if btype > 0:
|
||||
search["type"] = types[btype]
|
||||
bans = Ban.find(search).sort([("created_at", -1)])
|
||||
bans = await Ban.find(search).sort([("created_at", -1)]).to_list(None)
|
||||
db_bans = []
|
||||
fields = []
|
||||
async for ban in bans:
|
||||
for ban in bans:
|
||||
if not ban.username:
|
||||
user = await self.bot.fetch_user(ban.user)
|
||||
ban.username = user.username if user else "[deleted user]"
|
||||
|
|
|
@ -38,7 +38,7 @@ class VerifyCog(Scale):
|
|||
self.logger = logging.getLogger(__name__)
|
||||
|
||||
@slash_command(name="verify", description="Verify that you've read the rules")
|
||||
@cooldown(bucket=Buckets.USER, rate=1, interval=15)
|
||||
@cooldown(bucket=Buckets.USER, rate=1, interval=30)
|
||||
async def _verify(self, ctx: InteractionContext) -> None:
|
||||
await ctx.defer()
|
||||
role = await Setting.find_one(q(guild=ctx.guild.id, setting="verified"))
|
||||
|
@ -90,7 +90,7 @@ class VerifyCog(Scale):
|
|||
)
|
||||
)
|
||||
except asyncio.TimeoutError:
|
||||
await message.delete(delay=30)
|
||||
await message.delete(delay=2)
|
||||
self.logger.debug(f"User {ctx.author.id} failed to verify before timeout")
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue