簡體   English   中英

Discord.py 命令不起作用,沒有任何錯誤消息或 output

[英]Discord.py command not working without any error messages or output

這是直到我今天運行它時該命令沒有提供任何反饋、沒有嵌入、沒有錯誤消息和沒有新文件的代碼:

@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 不會做任何事情。 我什至從之前的測試中刪除了現有文件,看看它是否只看到現有文件,所以沒有發送任何東西,但它仍然不起作用。

您是否正在運行 on_message 事件? 如果是這樣,那可能會使命令不起作用。

好的,我最終修復了它,原來我的電腦是由 Fierce PC 預先構建的,這使得它預先帶有 1 個可見的 FiercePC 用戶和 1 個隱藏的 FiercePC 用戶。 代碼決定將文件保存到我以前不知道存在的隱藏用戶

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM