【发布时间】:2022-01-06 15:50:58
【问题描述】:
我正在为 Dyscord 从事 BOT 行业,我需要在 32 位计算机上播放动态知识中的语音片段
import discord
from discord.ext import commands
import os
client = commands.Bot(command_prefix="!")
@client.command()
async def play(ctx, url : str):
print('We have logged in as {0.user}'.format(client))
voiceChannel = discord.utils.get(ctx.guild.voice_channels, name="Lounge")
await voiceChannel.connect()
voice = discord.utils.get(client.voice_clients, guild=ctx.guild)
voice.play(discord.FFmpegPCMAudio("song.mp3"))
@client.command()
async def ext(ctx):
voice = discord.utils.get(client.voice_clients, guild=ctx.guild)
await voice.disconnect()
client.run('token')
【问题讨论】:
-
到目前为止你有什么tried?
-
这能回答你的问题吗? Convert audio files to mp3 using ffmpeg
标签: python python-3.x ffmpeg