【发布时间】:2021-03-24 11:11:29
【问题描述】:
当有人加入语音频道时,如何制作一个标记@role 的不和谐机器人?
例子:
@role {user} 已加入 Support 1 Channel
【问题讨论】:
-
到目前为止你尝试了什么?
标签: discord discord.py
当有人加入语音频道时,如何制作一个标记@role 的不和谐机器人?
例子:
@role {user} 已加入 Support 1 Channel
【问题讨论】:
标签: discord discord.py
@bot.event
async def on_voice_state_update(member, before, after):
# Checking if the member has joined channel
if before.voice is None and after.voice is not None:
# Getting the channel and a role
channel = bot.get_channel(channel_id)
role = member.guild.get_role(role_id)
# Sending some info
await channel.send(f'{role.mention} {member.mention} has joined `{str(after.voice.channel)}`')
【讨论】: