Komrade_FMX

Untitled

Jul 24th, 2022 (edited)
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.25 KB | None | 0 0
  1. @client.command(name="desc")
  2. async def desc(ctx, *,description = "No description"):
  3.   if description == "remove":
  4.             if (os.path.exists(os.path.join(os.getcwd(), "userdescriptions", str(ctx.author.id) + ".desc.txt"))):
  5.                 os.remove(os.path.join(os.getcwd(), "userdescriptions", str(ctx.author.id) + ".desc.txt"))
  6.  
  7.                 await ctx.send("Your user description has been removed.")
  8.             else:
  9.                 await ctx.send("Unable to remove your user description, because you don't have one.")
  10.   else:
  11.     with open(os.path.join(os.getcwd(), "userdescriptions", str(ctx.author.id) + ".desc.txt"), "w") as descriptionFile:
  12.       descriptionFile.write(description)
  13.  
  14.       await ctx.send("Your user description has been uploaded.")
  15.  
  16. @client.command(name="profile")
  17. async def profile(ctx, user:nextcord.Member=None):
  18.  
  19.   if user==None:
  20.       user=ctx.author
  21.  
  22.   userId = user.id
  23.   descriptionPath = os.path.join(os.getcwd(), "userdescriptions", str(userId) + ".desc.txt")
  24.  
  25.   if (os.path.exists(descriptionPath)):
  26.     with open(descriptionPath) as descriptionFile:
  27.       await ctx.send("User Description: ```" + descriptionFile.read() + "```")
  28.   else:
  29.     await ctx.send("That user does not have a description.")
  30.  
Add Comment
Please, Sign In to add comment