Skip to content

Commit f788a54

Browse files
authored
[Leveler] Allow profile title to be reset/blank (#182)
* allow title to be reset/blank
1 parent 94c71e7 commit f788a54

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

leveler/commands/lvlset/profile.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,23 @@ async def profilebg(self, ctx, *, image_name: str):
180180

181181
@profileset.command()
182182
@commands.guild_only()
183-
async def title(self, ctx, *, title):
184-
"""Set your title."""
183+
async def title(self, ctx, *, title=None):
184+
"""
185+
Set your title.
186+
187+
Use this command with no title given to clear your title.
188+
"""
185189
user = ctx.author
186-
userinfo = await self.db.users.find_one({"user_id": str(user.id)})
187190
max_char = 20
188191

189-
if len(title) < max_char:
190-
userinfo["title"] = title
192+
if not title:
193+
await self.db.users.update_one({"user_id": str(user.id)}, {"$set": {"title": ""}})
194+
msg = (
195+
"Your title has been successfully cleared! "
196+
"Use this command with a title if you'd like to set one."
197+
)
198+
await ctx.send(msg)
199+
elif len(title) < max_char:
191200
await self.db.users.update_one({"user_id": str(user.id)}, {"$set": {"title": title}})
192201
await ctx.send("Your title has been succesfully set!")
193202
else:

0 commit comments

Comments
 (0)