0

I want my discord bot to send mp3 files that I have on my pc when I do a certain command. Let's say the command is -hello When I say -hello I want the bot to send an mp3 file on my pc with the name "hello"

How could I do this?

2 Answers2

0

Check out this answer here: Discord.py Bot sending file to Discord Channel If you want to attach the file with your message, then do this with

await ctx.send(file=discord.File(r'c:\location\of\the_file_to\send.mp3'))
gXLg
  • 184
  • 13
0

Here's the whole "code" using what gXLg send

from discord.ext import commands
    
client = commands.Bot(command_prefix='-')
    
@bot.command()
async def hello(ctx):
await ctx.send(file=discord.File(r'location\to\file\hello.mp3'))

client.run('your token here')
dda
  • 6,030
  • 2
  • 25
  • 34
IDONTCODE
  • 7
  • 4