我正在尝试创建一个在用户当前所在房间内播放Icecast流的Discord机器人。我不确定为什么这不起作用。我正在使用Discord.py
的Python
import discord
from discord.ext import commands
try:
from bs4 import BeautifulSoup
soupAvailable = True
except:
soupAvailable = False
import urllib.request as urllib2
import ffmpy
import asyncio
if not discord.opus.is_loaded():
discord.opus.load_opus('/usr/local/lib/libopus.so')
...
@_radio.command(pass_context=True)
async def play(self, ctx):
client = discord.Client()
channel = discord.VoiceState(voice_channel)
voice = await client.join_voice_channel(channel)
player = voice.create_ffmpeg_player('http://srv.flare-radio.com:8000/stream')
player.start()