【发布时间】:2020-04-03 21:09:16
【问题描述】:
除了我创建的 send_message 函数外,整个机器人都可以工作。
@client.event
async def send_winners():
img = Image.open("placement_temp.jpg")
send_winners = json.loads(open('send_message.json').read())
if send_winners == True:
channel = 686026687145705505 #648365930639785985
await message.channel.send(channel, "<@&684816171316412458> And the Winners of this week are:", img) # Error happening here
send_winners = no
with open("winner_send.json", "w") as fp:
json.dump(send_winners, fp)
await asyncio.sleep(10)
【问题讨论】:
-
你能附上完整的错误信息吗?
-
NameError: name 'message' is not defined
-
您能否包含错误中包含的完整堆栈跟踪?
-
您也可以尝试将频道放在引号中:
channel = "686026687145705505" -
文件“C:\Users\agweb\Documents\GitHub\TrophyBot\TrophyBot.py”,第 223 行,在
client.loop.create_task(send_winners(message)) NameError: name '消息'未定义
标签: python discord.py