Discord python bot

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?

If what you provided is your actual code, then I see two issues.

This line:

images = [discord.File("A:\\mar\\ar.jpg), discord.File("A:\\mar\\at.jpg)]

has incorrect quotes, it should be:

images = [discord.File("A:\\mar\\ar.jpg), discord.File("A:\\mar\\at.jpg)"]

(but I think that’s a copy-paste error, python wouldn’t allow it).

The second thing is your discord.send() call. If you are sending a single file, the keyword is “file”, not “files”:

await message.channel.send(file=chosen_image)

Can you confirm somehow that you have a valid discord.File object in chosen_image ?

On a side note, I’ll point out that I think chosen_image will stay the same for every bot response. If you want the possibility of different responses every time, you’ll need to move the random.choice() call to the point where you send the response:

    if any(word in msg for word in hel):
        chosen_image = random.choice(images)
        await message.channel.send(file=chosen_image)