現在私はjackdからオーディオ出力を取り、それを不一致の音声チャットに接続しようとしています。このソリューションはうまくいかないようですが、これソリューションが動作すると言われています。私の解決策は機能しませんが、他の解決策は機能します。何が起こっていますか? githubリポジトリに似たソリューションを作成できますか?
import discord
from discord.ext import commands
from discord.utils import get
import os
#import jack
from discord.voice_client import VoiceClient
#start ffmpeg encoding magic.
os.system("ffmpeg -f jack -i stream_input -acodec libmp3lame -y stream.mp3 &> ffmpeg.log&")
# start jackd client stuff
#jack_client = jack.Client('Campfire')
#jack_client.inports.register('stream_input')
#Some variables. PLEASE ADJUST."
Client_Prefix= '>'
token= 'Nah'
client = commands.Bot(command_prefix = Client_Prefix)
#discord bot voice stuff
@client.event
async def on_ready():
print("Logged in as " + client.user.name + ".\n")
print("Prefix is " + Client_Prefix + "\n")
print('Status: armed')
print('-------------------------------------------------------')
@client.command(pass_context=True)
async def join(ctx):
await ctx.send('Joining the campfire.')
global voice
channel = ctx.message.author.voice.channel
voice = get(client.voice_clients, guild=ctx.guild)
if voice and voice.is_connected():
await voice.move_to(channel)
else:
voice = await channel.connect()
print("The bot has connected to a voice channel.")
@client.command(pass_context=True)
async def leave(ctx):
channel = ctx.message.author.voice.channel
voice = get(client.voice_clients, guild=ctx.guild)
if voice and voice.is_connected():
await voice.disconnect()
print("The bot has disconnected from a voice channel")
await ctx.send("Leaving the campfire")
else:
print("Error: I am not currently at a campfire")
await ctx.send("I am not currently at a campfire.")
@client.command(pass_context=True)
async def stoke(ctx):
song_there = os.path.isfile("stream.mp3")
#try:
#if song_there:
#os.remove("stream.mp3")
#print("Removed old campfire ashes.")
#await ctx.send("Removed old campfire ashes.")
#except PermissionError:
#print("Unable to remove old ashes. Bulldozing required.")
#await ctx.send("Unable to remove old ashes. Bulldozing required.")
#return
await ctx.send("Tuning the mystical instrument.")
voice = get(client.voice_clients, guild=ctx.guild)
voice.play(discord.FFmpegPCMAudio("stream.mp3"))
client.run(token)