好的,所以我需要兩個命令來復制,默認代碼是這樣寫的(我知道它很難重復,因為它充滿了引用,但這并不重要,這里只是為了上下文):@bot.command(name='Bot', help="Dane nt. zaka?enia w danym miejscu")async def cv_local(ctx, country=""): translator = Translator() translation = translator.translate(country, 'en') country = translation.text now = datetime.datetime.now() startTime = time.time() if country == "": country = "world" print("At " + str(now.hour) + ":" + str(now.minute) + " user " + str(ctx.message.author.name) + "(Id: " + str( ctx.message.author.id) + ")" + " didn't mention any country, sent data for world") else: print("At " + str(now.hour) + ":" + str(now.minute) + " user " + str(ctx.message.author.name) + "(Id: " + str( ctx.message.author.id) + ")" + " searched for: " + str(Library.exceptionCheck(country)[1])) if str(country).lower() == "world" or str(country).lower() == "kw" or str(country).lower() == "za": url = 'https://www.worldometers.info/coronavirus/' code = Library.HttpsRead(url, "?wiata", translation.src) else: temp1 = Library.exceptionCheck(country)[0] url = 'https://www.worldometers.info/coronavirus/country/' + temp1 code = Library.HttpsRead(url, country, config[ctx.guild.name]['country']) await ctx.send(embed=code) print("execution took %s seconds \n" % (time.time() - startTime))我沒有可以發布給你的錯誤痕跡,這很令人沮喪
1 回答

江戶川亂折騰
TA貢獻1851條經驗 獲得超5個贊
最后我制作了該命令的又一個版本并且它可以工作:
@bot.command(name='cv', help="Dane nt. zaka?enia w danym miejscu")
async def cv_local2(ctx, leng=""):
print("Invoking...")
temp1 = bot.commands
temp = bot.get_command(name='Bot')
await temp.callback(ctx, leng)
添加回答
舉報
0/150
提交
取消