除了我创建的send_message函数之外,整个bot都可以工作。
@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)
答案 0 :(得分:0)
尝试一下:
@client.event
async def send_winners(message):
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:", Image.open("placement_temp.jpg")) # Error happening here
send_winners = no
with open("winner_send.json", "w") as fp:
json.dump(send_winners, fp)
await asyncio.sleep(10)