python - Discord Bot 使用 Python 使用语音聊天来静音人们的声音
问题描述
我 15 岁,我正在尝试制作一个不和谐的机器人,使用语音聊天使参与者的声音静音。为此,我正在使用 Python。这是我的代码,但它没有按预期工作。
from discord.ext import commands
client = commands.Bot(command_prefix=" !")
@client.event
async def on_ready():
print('BOT ACTIVATED')
@client.command()
async def mute(ctx):
voice_client = ctx.guild.voice_client
if not voice_client:
return
channel = voice_client.channel
await voice_client.main_ws.voice_state(ctx.guild.id, channel.id, self_mute=True)
client.run('')
我的想法是:我将输入的命令:!muteall 机器人将静音语音聊天中的所有参与者 我将输入的命令:!unmuteall 机器人将取消语音聊天中的所有参与者的静音
请有人帮助我!!!!!!!
解决方案
推荐阅读
- python - Python数据框新列的值基于其他行中的值
- sql - 如何在更实际的年份中选择去年的两个
- android - 安卓。从构建变体中排除 NativeBuild
- scikit-learn - sklearn 的分类准确率百分比
- jquery - AJAX URL 在一个刀片上工作,但在另一个刀片上不工作
- react-native - 如何在导航到屏幕之前加载 React 本机 WebView 堆栈屏幕?
- java - 在 Java(Kotlin) 中,如果 kafka 主题以编程方式创建而未指定 bootstrap-server 选项,它是否默认在 localhost:9092 上创建?
- java - GSON:如何自定义处理未知字段
- javascript - 在 IOS 上使用 webview 制作聊天框时输入错误
- javascript - 如何更改图表中特定数据范围的颜色