UPDATE2: The following just worked for me... I would almost certainly expect your issue is that your files are not being created properly. Either that or your bot is broken in some other way. If you use a debugger (say pycharms) you could set break points and see if your command is executing and whether or not your discord.File objects are being created properly
async def test(self, ctx):
image = r"C:\Users\name\Desktop\visual-reverse-image-search-v2_intro.jpg"
import discord
await ctx.send(file=discord.File(image))
UPDATE: I did not read far enough, it should accept a string path. Have you tried debugging into the code to see if it's successful at opening your file?
Sometimes it's worth looking at the source code. I went and looked at discord.File.
class File:
"""A parameter object used for :meth:`abc.Messageable.send`
for sending file objects.
Attributes
-----------
fp: Union[:class:`str`, :class:`io.BufferedIOBase`]
A file-like object opened in binary mode and read mode
or a filename representing a file in the hard drive to
open.
.. note::
If the file-like object passed is opened via ``open`` then the
modes 'rb' should be used.
To pass binary data, consider usage of ``io.BytesIO``.
"""
def __init__(self, fp, filename=None, *, spoiler=False):
self.fp = fp
if isinstance(fp, io.IOBase):
if not (fp.seekable() and fp.readable()):
raise ValueError('File buffer {!r} must be seekable and readable'.format(fp))
self.fp = fp
self._original_pos = fp.tell()
self._owner = False
else:
self.fp = open(fp, 'rb')
self._original_pos = 0
self._owner = True
It appears as though it's expecting an opened file.