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

      <tfoot id='jHiLE'></tfoot><legend id='jHiLE'><style id='jHiLE'><dir id='jHiLE'><q id='jHiLE'></q></dir></style></legend>

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

          <bdo id='jHiLE'></bdo><ul id='jHiLE'></ul>
      1. 如何在 discord.py 中提及用户?

        时间:2023-09-11
        <tfoot id='K0ZTU'></tfoot>

          <tbody id='K0ZTU'></tbody>

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

          1. <small id='K0ZTU'></small><noframes id='K0ZTU'>

                • <bdo id='K0ZTU'></bdo><ul id='K0ZTU'></ul>
                • <legend id='K0ZTU'><style id='K0ZTU'><dir id='K0ZTU'><q id='K0ZTU'></q></dir></style></legend>
                  本文介绍了如何在 discord.py 中提及用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试使用 discord.py 编写一个简单的机器人,所以我开始使用有趣的命令来熟悉这个库.

                  I'm trying to code a simple bot using discord.py, so I started with the fun commands to get familiar with the library.

                  import discord
                  
                  client = discord.Client()
                  
                  @client.event
                  async def on_message(message):
                      # we do not want the bot to reply to itself
                      if message.author == client.user:
                          return
                  
                      if message.content.startswith('!hug'):
                          await message.channel.send(f"hugs {message.author.mention}")
                  
                      if message.content.startswith('!best'):
                          user_id = "201909896357216256"
                          user_mention = ???  # How to convert user_id into a mention
                          await message.channel.send(f'{user_mention} is the best')
                  

                  推荐答案

                  所以经过几天的反复试验,我终于想出了如何做到这一点,希望其他人能从中受益,并且比我实际拥有的痛苦更少..解决方案最终很简单..

                  So I finally figured out how to do this after few days of trial and error hoping others would benefit from this and have less pain than I actually had.. The solution was ultimately easy..

                    if message.content.startswith('!best'):
                          myid = '<@201909896357216256>'
                          await client.send_message(message.channel, ' : %s is the best ' % myid)
                  

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

                  上一篇:为什么多个 on_message 事件不起作用? 下一篇:如何在 discord.py 中使用 cogs?

                  相关文章

                  最新文章

                    • <bdo id='FF8DQ'></bdo><ul id='FF8DQ'></ul>

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

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