Python discord.ext.commands.errors.CommandInvokeError:Command引发异常:AttributeError:“Command”对象没有属性“strftime”
我试图做一个机器人命令,你可以问机器人是否是周三,但我一直得到这个错误,我不知道该怎么办。请帮忙。 这是我的代码:Python discord.ext.commands.errors.CommandInvokeError:Command引发异常:AttributeError:“Command”对象没有属性“strftime”,python,discord.py,discord.py-rewrite,Python,Discord.py,Discord.py Rewrite,我试图做一个机器人命令,你可以问机器人是否是周三,但我一直得到这个错误,我不知道该怎么办。请帮忙。 这是我的代码: @client.command(aliases=['wednesdaymydudes', 'wednesday', 'wednesdaycheck'], pass_context=True) async def isitwednesdaymydudes(ctx): currentday = time.strftime('%A') if
@client.command(aliases=['wednesdaymydudes', 'wednesday', 'wednesdaycheck'],
pass_context=True)
async def isitwednesdaymydudes(ctx):
currentday = time.strftime('%A')
if currentday == 'Wednesday':
await ctx.send('It is Wednesday, {}'.format(ctx.message.author.mention))
else:
await ctx.send('It is not Wednesday, {}'.format(ctx.message.author.mention))
为了得到一周中的某一天,你应该做的是
from datetime import datetime as dt
day = dt.now()
day_of_week = day.strftime('%A')
是否有另一个函数名为time的命令?它看起来像是有其他东西以该名称隐藏了Python模块,或者您没有导入它。