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(
|
embed.set_author(
|
||||||
name=user.display_name,
|
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}")
|
embed.set_footer(text=f"{user.username}#{user.discriminator} | {user.id}")
|
||||||
|
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
|
@ -89,9 +89,9 @@ class BanCog(ModcaseCog):
|
||||||
)
|
)
|
||||||
embed.set_author(
|
embed.set_author(
|
||||||
name=user.username,
|
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}")
|
embed.set_footer(text=f"{user.username}#{user.discriminator} | {user.id}")
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
|
@ -121,15 +121,15 @@ class BanCog(ModcaseCog):
|
||||||
async def _ban(
|
async def _ban(
|
||||||
self,
|
self,
|
||||||
ctx: InteractionContext,
|
ctx: InteractionContext,
|
||||||
|
user: User,
|
||||||
reason: str,
|
reason: str,
|
||||||
user: User = None,
|
|
||||||
btype: str = "perm",
|
btype: str = "perm",
|
||||||
duration: int = 4,
|
duration: int = 4,
|
||||||
) -> None:
|
) -> None:
|
||||||
if not user or user == ctx.author:
|
if user.id == ctx.author.id:
|
||||||
await ctx.send("You cannot ban yourself.", ephemeral=True)
|
await ctx.send("You cannot ban yourself.", ephemeral=True)
|
||||||
return
|
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)
|
await ctx.send("I'm afraid I can't let you do that", ephemeral=True)
|
||||||
return
|
return
|
||||||
if btype == "temp" and duration < 0:
|
if btype == "temp" and duration < 0:
|
||||||
|
@ -215,9 +215,10 @@ class BanCog(ModcaseCog):
|
||||||
discord_ban_info = None
|
discord_ban_info = None
|
||||||
database_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
|
# Try to get ban information out of Discord
|
||||||
|
self.logger.debug(f"{user}")
|
||||||
if re.match(r"^[0-9]{1,}$", user): # User ID
|
if re.match(r"^[0-9]{1,}$", user): # User ID
|
||||||
user = int(user)
|
user = int(user)
|
||||||
discord_ban_info = find(lambda x: x.user.id == user, bans)
|
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.
|
# try to find the relevant information in the database.
|
||||||
# We take advantage of the previous checks to save CPU cycles
|
# We take advantage of the previous checks to save CPU cycles
|
||||||
if not discord_ban_info:
|
if not discord_ban_info:
|
||||||
if isinstance(user, int):
|
if isinstance(user, User):
|
||||||
database_ban_info = await Ban.find_one(
|
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:
|
else:
|
||||||
search = {
|
search = {
|
||||||
|
@ -320,10 +321,10 @@ class BanCog(ModcaseCog):
|
||||||
search["active"] = True
|
search["active"] = True
|
||||||
if btype > 0:
|
if btype > 0:
|
||||||
search["type"] = types[btype]
|
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 = []
|
db_bans = []
|
||||||
fields = []
|
fields = []
|
||||||
async for ban in bans:
|
for ban in bans:
|
||||||
if not ban.username:
|
if not ban.username:
|
||||||
user = await self.bot.fetch_user(ban.user)
|
user = await self.bot.fetch_user(ban.user)
|
||||||
ban.username = user.username if user else "[deleted user]"
|
ban.username = user.username if user else "[deleted user]"
|
||||||
|
|
|
@ -38,7 +38,7 @@ class VerifyCog(Scale):
|
||||||
self.logger = logging.getLogger(__name__)
|
self.logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@slash_command(name="verify", description="Verify that you've read the rules")
|
@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:
|
async def _verify(self, ctx: InteractionContext) -> None:
|
||||||
await ctx.defer()
|
await ctx.defer()
|
||||||
role = await Setting.find_one(q(guild=ctx.guild.id, setting="verified"))
|
role = await Setting.find_one(q(guild=ctx.guild.id, setting="verified"))
|
||||||
|
@ -90,7 +90,7 @@ class VerifyCog(Scale):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
except asyncio.TimeoutError:
|
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")
|
self.logger.debug(f"User {ctx.author.id} failed to verify before timeout")
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue