我正在尝试让我的机器人在语音聊天中播放音频文件,而不是youtube视频。令人惊讶的是,我真的找不到任何有效的帮助。
@client.command()
async def play(ctx, *args):
if len(args) == 0:
await ctx.send("Specify something then")
else:
#server = ctx.message.server
#voice_client = client.voice_client_in(server)
voice_player = await ctx.message.author.voice.channel.connect()
if args[0] == "chulp":
print("Playing chulp")
source = discord.FFmpegPCMAudio("Core files\\Sounds\\chulpy.mp3")
player = voice_player.play(source)
player.start()
我总是会收到此错误:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'start'
答案 0 :(得分:0)
您做错了。您必须这样做-
create table mytable (Names varchar(64))
insert into mytable values ('Bob'),('Mary'),('Tom'),('Frank')
--this is your parameter from SSRS
declare @var varchar(4000) = 'Bob,Mary,Janice,Scarlett'
select distinct mytable.*
from mytable
cross apply dbo.DelimitedSplit8K(@var,',') spt
where spt.Item = mytable.Names
我不确定,但这是否可以正常工作-
if args[0] == "chulp":
print("Playing chulp")
player = voice_player.create_ffmpeg_player("Core files\\Sounds\\chulpy.mp3")
player.start()
我认为您组合了2个不同来源的代码。