Hello, I’m trying to create a discord bot that it upload an image from a folder when it see a specific word in discord message. I wrote the code but it’s not work well. Can you help me? I’ll share my code and please look at this and tell me the problem. Thank you!
import random import discord from discord.ext import commands images = [discord.File("A:\\mar\\ar.jpg), discord.File("A:\\mar\\at.jpg)] hel = ['dog', 'cat', 'horse'] chosen_image = random.choice(images) @Bot.event async def on_message(message): if message.author==Bot.user: return msg = message.content . . . if any(word in msg for word in hel): await message.channel.send(files=chosen_image)
I faced with ValueError: I/O error, how can I fix it?