This is the code that until I ran it today when this command didn't provide any feedback, no embed, no error message and no new files:
@bot.command(name="start")
async def some_crazy_function_name(ctx):
global currentcreator
if not currentcreator == 0:
await message.channel.send("Someone is already making a profile, please wait")
currentcreater = ctx.author
dir = r'C:\\Users\\FiercePC\Desktop\DiscordMMO\User-Profiles'
MessageAuthor = str(ctx.author.id)
ProfileDIR = os.path.join(dir,MessageAuthor)
doesExist = os.path.exists(ProfileDIR)
if doesExist == False:
embed=discord.Embed(title="Creating Profile", url="", description=MessageAuthor+", your profile is being created", color=0x3b05ff)
await ctx.send(embed=embed)
os.makedirs(ProfileDIR,1)
file = os.path.join(ProfileDIR,"Hitpoints.txt")
open(file,"x")
openfile = open(file,"w")
openfile.write("3")
openfile.close()
file = os.path.join(ProfileDIR,"MaxHitpoints.txt")
open(file,"x")
openfile = open(file,"w")
openfile.write("3")
openfile.close()
file = os.path.join(ProfileDIR,"HitpointsEXP.txt")
open(file,"x")
openfile = open(file,"w")
openfile.write("0")
openfile.close()
file = os.path.join(ProfileDIR,"StrengthEXP.txt")
open(file,"x")
openfile = open(file,"w")
openfile.write("0")
openfile.close()
file = os.path.join(ProfileDIR,"StrengthLevel.txt")
open(file,"x")
openfile = open(file,"w")
openfile.write("1")
openfile.close()
embed=discord.Embed(title="Profile Created", url='', description=MessageAuthor+', thanks for setting up your profile, now you can enjoy a unique MMO RPG experience only on discord.', color=0x3b05ff)
await ctx.send(embed=embed)
currentcreator = 0
I haven't changed anything that would make it not run properly so I am so confused why entering my command prefix / and then start wouldn't do anything. I even deleted the existing files from a previous test to see if it just saw the existing files so didn't send anything but it still doesnt work.
Do you have a on_message event running? if so, that could make the command not work.
Ok, I eventually fixed it, turns out that my pc was pre built by Fierce PC which makes it pre come with 1 visible FiercePC user and 1 hidden FiercePC user. The code decided to save the files to the hidden user which I didn't previously know existed
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.