Skip to content

Commit

Permalink
Update customcommands.py
Browse files Browse the repository at this point in the history
  • Loading branch information
bugsbirb committed Apr 30, 2024
1 parent 2f72b69 commit fa741a1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Cogs/Modules/customcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,19 @@ async def command(self, ctx):
@commands.command()
async def prefix(self, ctx: commands.Context, prefix: str = None):
result = await prefixdb.find_one({'guild_id': ctx.guild.id})
currentprefix = result.get('prefix', "!!")
if result:

currentprefix = result.get('prefix', "!!")
else:
currentprefix = "!!"


if prefix is None:

await ctx.send(f"<:command1:1199456319363633192> **{ctx.author.display_name},** the prefix is `{currentprefix}`", allowed_mentions=discord.AllowedMentions.none())
else:
if ctx.author.guild_permissions.manage_guild:

await prefixdb.update_one({'guild_id': ctx.guild.id}, {'$set': {'prefix': prefix}}, upsert=True)
await ctx.send(f"<:whitecheck:1190819388941668362> **{ctx.author.display_name},** I've set the prefix to `{prefix}`", allowed_mentions=discord.AllowedMentions.none())
else:
Expand Down

0 comments on commit fa741a1

Please sign in to comment.