python - Discord.py 如何关闭不和谐机器人的麦克风状态(但不静音机器人)?
问题描述
我的问题是:在为机器人编写加入函数(下面的代码)之后,机器人可以成功加入语音通道,但它会显示它的麦克风已打开。(我没让他玩什么,只是加入语音频道功能)。
我的加入功能:
@Test011.command(pass_context=True)
async def join(ctx):
global voice
channel = ctx.message.author.voice.channel
voice = get(Test011.voice_clients, guild=ctx.guild)
if voice and voice.is_connected(): # User in voice channel & Bot also in voice channel somewhere else maybe.
await voice.move_to(channel)
else: # bot is not in the channel, let it connect.
voice = await channel.connect()
print(f"The bot is connected to {channel}.")
await ctx.send(f"Joined {channel}.")
机器人“Test001”打开了麦克风,因为它的头像周围有一个绿色的“环”。
我不想让机器人静音,因为我试过了Guilds.change_voice_state
。
如果我不处理进一步的命令,我想让机器人加入,但不要打开麦克风。
任何帮助或建议表示赞赏!
解决方案
推荐阅读
- java - Maven 不适用于 Java SE 9 但 Java SE-1.8,为什么?
- database - IBM DB2 - 查询优化
- node.js - Fabric-node-sdk 1.2 可以与 Fabric 1.1 网络一起使用吗?
- oracle - 从具有空值的两个表中查找不匹配的记录
- windows - 使用 PowerShell 记录程序运行时
- wordpress - Elementor 库:未连接(cURL 错误 28:连接超时 ...)
- android - android build.gradle 模块应用程序错误:无法解决:注释
- xaml - 如何仅在 UWP 中将 AcrylicBrush 添加到工具栏
- unix - CircleCI 运行多行命令
- parsing - 如何使用 asyncio 模块在 python 中解析网站?