前提
Pythonを使ってディスコードのボットを作りたい
実現したいこと
ここに実現したいことを箇条書きで書いてください。
- テキストチャンネルで受け取ったメッセージをvcで流したい
発生している問題・エラーメッセージ
チャットで受け取ったメッセージを再生してくれない
output.wavにはちゃんと受け取ったメッセージが流れる
エラーは発生していない
log
1テスト 2C:/open_jtalk/bin/open_jtalk -x C:/open_jtalk/bin/dic -m C:/open_jtalk/bin/nitech_jp_atr503_m001.htsvoice -r 1.0 -ow C:/open_jtalk/bin/output.wav input.txt 3[2022-08-31 12:11:03] [INFO ] discord.player: ffmpeg process 16324 successfully terminated with return code of 1.
該当のソースコード
Python
1import discord 2from discord.ext import commands 3import subprocess 4import ffmpeg 5from voice_generator import creat_WAV 6import nacl 7bot = commands.Bot(command_prefix="/", intents=discord.Intents.all()) 8voice_client = None 9 10 11 12 13 14@bot.event 15# Botの準備完了時に呼び出されるイベント 16async def on_ready(): 17 print('We have logged in as {0}'.format(bot.user)) 18 19@bot.command() 20async def join(ctx): 21 print('join') 22 await ctx.send('vcに接続します') 23 #voicechannelを取得 24 vc = ctx.author.voice.channel 25 #voicechannelに接続 26 await vc.connect() 27 28@bot.command() 29async def bye(ctx): 30 #切断 31 await ctx.voice_client.disconnect() 32 33@bot.event 34async def on_message(message): 35 msgclient = message.guild.voice_client 36 if message.content.startswith('/'): 37 pass 38 39 else: 40 if message.guild.voice_client: 41 print(message.content) 42 creat_WAV(message.content) 43 source = discord.FFmpegPCMAudio("output.wav") 44 message.guild.voice_client.play(source) 45 else: 46 pass 47 await bot.process_commands(message) 48 49bot.run('トークン')
試したこと
Pythonの再インストール
トークンの再発行
補足情報(FW/ツールのバージョンなど)
Python 3.10.6
Windows 10 64-Bit
ffmpeg version 5.1-full_build
あなたの回答
tips
プレビュー