【问题标题】:Is there a way to ping(mention) mods when ticket bot sends a message?当票务机器人发送消息时,有没有办法 ping(提及)mod?
【发布时间】:2022-01-08 13:05:37
【问题描述】:

当票务机器人发送消息时,我想 ping 模组或管理员? 我的代码:

import discord
from discord.ext import commands
import random

client = commands.Bot(command_prefix="+")

@client.event
async def on_ready():
    print("Bot is online")

ticket = ["915745817694961664"]

@client.event
async def on_message(msg):
    for word in ticket:
        if word in msg.content:
            await ctx.send("Someone created a ticket! @Mods @Admins")

client.run("TOKEN")

我不知道这是否可能,但我希望有办法做到这一点

【问题讨论】:

    标签: python discord discord.py


    【解决方案1】:

    你需要像这样使用角色ID:

    if word in msg.content:
                await ctx.send("Someone created a ticket! <@&883807051548065833> <@&876611793227755550>")
    

    要获取角色的 ID,请启用开发者模式 在用户设置的外观部分,然后转到角色 服务器设置中的菜单,然后右键单击您想要的角色 的ID,然后点击“复制ID”。

    【讨论】:

      猜你喜欢
      • 2021-01-26
      • 2021-01-08
      • 2018-07-27
      • 2021-04-02
      • 1970-01-01
      • 2021-01-23
      • 2022-12-01
      • 2019-09-23
      • 2023-01-24
      相关资源
      最近更新 更多