【发布时间】:2021-06-23 18:40:21
【问题描述】:
这是直到我今天运行它时该命令没有提供任何反馈、没有嵌入、没有错误消息并且没有新文件时的代码:
@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
我没有更改任何使它无法正常运行的东西,所以我很困惑为什么输入我的命令前缀 / 然后 start 不会做任何事情。我什至从之前的测试中删除了现有文件,看看它是否只看到现有文件,所以没有发送任何东西,但它仍然不起作用。
【问题讨论】:
标签: python discord discord.py