[英]How can I get my discord bot to send mp3 files? (discord.py)
I want my discord bot to send mp3 files that I have on my pc when I do a certain command.当我执行某个命令时,我希望我的 discord 机器人发送我在我的电脑上拥有的 mp3 文件。 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"
假设命令是 -hello 当我说 -hello 我希望机器人在我的电脑上发送一个名为“hello”的 mp3 文件
How could I do this?我怎么能这样做?
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在此处查看此答案: Discord.py Bot 将文件发送到 Discord 频道
await ctx.send(file=discord.File(r'c:\location\of\the_file_to\send.mp3'))
Heres the whole "code" using what gXLg send这是使用 gXLg 发送的整个“代码”
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')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.