discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Command' object has no attribute 'strftime'
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Command' object has no attribute 'strftime'
我正在尝试制作一个机器人命令,您可以在其中询问机器人是否是星期三,但我一直收到此错误消息,我不知道该怎么做。请帮忙。
这是我的代码:
@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')
我正在尝试制作一个机器人命令,您可以在其中询问机器人是否是星期三,但我一直收到此错误消息,我不知道该怎么做。请帮忙。 这是我的代码:
@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')