• <small id='zxCZm'></small><noframes id='zxCZm'>

    1. <legend id='zxCZm'><style id='zxCZm'><dir id='zxCZm'><q id='zxCZm'></q></dir></style></legend>
        <bdo id='zxCZm'></bdo><ul id='zxCZm'></ul>

        <tfoot id='zxCZm'></tfoot>
        <i id='zxCZm'><tr id='zxCZm'><dt id='zxCZm'><q id='zxCZm'><span id='zxCZm'><b id='zxCZm'><form id='zxCZm'><ins id='zxCZm'></ins><ul id='zxCZm'></ul><sub id='zxCZm'></sub></form><legend id='zxCZm'></legend><bdo id='zxCZm'><pre id='zxCZm'><center id='zxCZm'></center></pre></bdo></b><th id='zxCZm'></th></span></q></dt></tr></i><div id='zxCZm'><tfoot id='zxCZm'></tfoot><dl id='zxCZm'><fieldset id='zxCZm'></fieldset></dl></div>

        Discord.py 如何提及命令中提到的人

        时间:2023-09-09

          <tbody id='294rQ'></tbody>
        <tfoot id='294rQ'></tfoot><legend id='294rQ'><style id='294rQ'><dir id='294rQ'><q id='294rQ'></q></dir></style></legend>
      1. <i id='294rQ'><tr id='294rQ'><dt id='294rQ'><q id='294rQ'><span id='294rQ'><b id='294rQ'><form id='294rQ'><ins id='294rQ'></ins><ul id='294rQ'></ul><sub id='294rQ'></sub></form><legend id='294rQ'></legend><bdo id='294rQ'><pre id='294rQ'><center id='294rQ'></center></pre></bdo></b><th id='294rQ'></th></span></q></dt></tr></i><div id='294rQ'><tfoot id='294rQ'></tfoot><dl id='294rQ'><fieldset id='294rQ'></fieldset></dl></div>
          <bdo id='294rQ'></bdo><ul id='294rQ'></ul>

            • <small id='294rQ'></small><noframes id='294rQ'>

                  本文介绍了Discord.py 如何提及命令中提到的人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我在这里创建了这些代码,当有人有权将@user 告上法庭"时它会说将@user 送上法庭";但这里的代码不起作用:

                  Iv created these code here that when someone rights "send @user to court" it will say "sending @user to court" but it doesn't work here's the code:

                  import discord
                  from discord.ext import commands
                  import ctx
                  import re
                  
                  class MyClient(discord.Client):
                  
                      async def on_ready(self):
                         print('Logged on as', self.user)
                  
                      async def on_message(self, message):
                          if message.author == self.user:
                              return
                  
                          messageContent = message.content
                          if len(messageContent) > 0:
                              if re.search("^send.*court$", messageContent):
                                  user_id = message.mentions[0].id
                                  user = self.get_user(user_id)
                                  await message.channel.send("sending", user, "to court!")
                  
                  client = MyClient()
                  client.run('My secret token')
                  

                  推荐答案

                  您正在发送一个用户对象.要发送提及,您必须执行 <@{userid}" 提及

                  You are sending a user object. To send a mention you have to do "<@{userid}" to mention

                  这是你需要做的事情

                  await message.channel.send(
                                      f"sending <@{user_id}> to court!"
                                  )
                  
                  

                  这篇关于Discord.py 如何提及命令中提到的人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何让 discord.py 机器人 DM 特定用户 下一篇:Discord.py 机器人不阅读其他机器人的消息

                  相关文章

                  最新文章

                  <legend id='aTvtb'><style id='aTvtb'><dir id='aTvtb'><q id='aTvtb'></q></dir></style></legend>
                  1. <i id='aTvtb'><tr id='aTvtb'><dt id='aTvtb'><q id='aTvtb'><span id='aTvtb'><b id='aTvtb'><form id='aTvtb'><ins id='aTvtb'></ins><ul id='aTvtb'></ul><sub id='aTvtb'></sub></form><legend id='aTvtb'></legend><bdo id='aTvtb'><pre id='aTvtb'><center id='aTvtb'></center></pre></bdo></b><th id='aTvtb'></th></span></q></dt></tr></i><div id='aTvtb'><tfoot id='aTvtb'></tfoot><dl id='aTvtb'><fieldset id='aTvtb'></fieldset></dl></div>
                    <tfoot id='aTvtb'></tfoot>

                    <small id='aTvtb'></small><noframes id='aTvtb'>

                      <bdo id='aTvtb'></bdo><ul id='aTvtb'></ul>