Skip to content

Commit

Permalink
fix: remove prefix and role timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
2vw committed Mar 11, 2024
1 parent 81d453b commit d15bdc4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
18 changes: 11 additions & 7 deletions cogs/moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,17 @@ def setup(client) -> commands.Cog:
@limiter(20, on_ratelimited=lambda ctx, delay, *_1, **_2: ctx.send(f"You're on cooldown! Please wait `{round(delay, 2)}s`!"))
async def nickname(ctx, member: voltage.User, *, nick:str):
if ctx.author.permissions.manage_nicknames or ctx.author.id == ctx.server.owner.id:
async with aiohttp.ClientSession() as s:
await s.patch(
url=f"https://api.revolt.chat/servers/{ctx.server.id}/members/{member.id}",
headers={"x-bot-token": config['TOKEN']},
json={"nickname": nick}
)
await s.close()
try:
async with aiohttp.ClientSession() as s:
await s.patch(
url=f"https://api.revolt.chat/servers/{ctx.server.id}/members/{member.id}",
headers={"x-bot-token": config['TOKEN']},
json={"nickname": nick},
timeout=10
)
await s.close()
except aiohttp.ClientTimeout:
return
embed = voltage.SendableEmbed(
title="Nickname",
description=f"Changed {member.display_name}'s nickname to `{nick}`!",
Expand Down
2 changes: 1 addition & 1 deletion cogs/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ async def addprefix(ctx, *, prefix):
)
async def removeprefix(ctx, *, prefix):
if (await userdb.find_one({'userid':ctx.author.id})):
if len((await userdb.find_one({'userid':ctx.author.id})['prefixes'])) > 1 :
if len((await userdb.find_one({'userid':ctx.author.id}))['prefixes']) > 1 :
if prefix in (await userdb.find_one({'userid':ctx.author.id}))['prefixes']:
await userdb.update_one({'userid':ctx.author.id}, {'$pull':{'prefixes':prefix}})
prefixes = (await userdb.find_one({'userid':ctx.author.id}))['prefixes']
Expand Down

0 comments on commit d15bdc4

Please sign in to comment.