python - discord.py 问题:如何在不和谐中检查第一个加入语音聊天的用户
问题描述
所以我正在制作一个机器人,当人们加入特定的 VC 时它会喜欢它。它将使用首先加入该特定 vc 的人创建新的语音通道。不要介意我的英语,我知道我的英语很烂。:c 我正在尝试这个
from discord.ext import commands
import discord
import os
bot = commands.Bot(command_prefix = ">")
client = discord.Client()
@commands.command()
async def join_voice(self, ctx):
connected = ctx.author.voice
if connected:
await create_voice_channel("I want to add a person who triggered the bot by join specific VC to set name of new VC to their name.")
client.run(os.getenv('TOKEN'))
解决方案
我认为您正在寻找的是on_voice_state_update
协程功能。我不太确定你想对传递给函数的数据做什么,但你可能可以在这里找到你想要的。
对于任何其他问题,请尝试检查discord.py API 参考
推荐阅读
- javascript - 如何用 firebase 数据填充手风琴?
- java - LibGDX 游戏突然口吃?
- android - 以日期为标题的标签
- ssh - 使用 ssh-rsa-cert-v01 类型证书的 SSH 证书身份验证
- javascript - 我怎样才能知道通过 jQuery 更改了一个类?
- android - 指南针使用传感器,与谷歌地图相比表现不佳
- flutter - 如何在颤动中制作全屏警报对话框
- c# - 如何将多个参数从 Angular 8 传递到 .NET Core API
- sql - SQL Server:从该 id 的每个状态中获取 min(lastupdatedate)
- php - 将 json 对象保存为文件中的解码 PHP 数组