【问题标题】:How do I make a discord bot that tags如何制作带有标签的不和谐机器人
【发布时间】:2021-03-24 11:11:29
【问题描述】:

当有人加入语音频道时,如何制作一个标记@role 的不和谐机器人? 例子: @role {user} 已加入 Support 1 Channel

【问题讨论】:

  • 到目前为止你尝试了什么?

标签: discord discord.py


【解决方案1】:
@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)}`')

【讨论】:

    猜你喜欢
    • 2021-02-12
    • 2020-10-08
    • 1970-01-01
    • 2021-05-25
    • 1970-01-01
    • 2021-01-17
    • 2021-04-12
    • 2021-10-02
    • 2021-11-08
    相关资源
    最近更新 更多