久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<tfoot id='sAQH5'></tfoot>

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

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

    1. <legend id='sAQH5'><style id='sAQH5'><dir id='sAQH5'><q id='sAQH5'></q></dir></style></legend>
    2. 如何正確解析我的 Discord 機器人中的標記用戶?

      How can I properly parse for a tagged user in my Discord bot?(如何正確解析我的 Discord 機器人中的標記用戶?)

    3. <small id='mFph7'></small><noframes id='mFph7'>

      <i id='mFph7'><tr id='mFph7'><dt id='mFph7'><q id='mFph7'><span id='mFph7'><b id='mFph7'><form id='mFph7'><ins id='mFph7'></ins><ul id='mFph7'></ul><sub id='mFph7'></sub></form><legend id='mFph7'></legend><bdo id='mFph7'><pre id='mFph7'><center id='mFph7'></center></pre></bdo></b><th id='mFph7'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='mFph7'><tfoot id='mFph7'></tfoot><dl id='mFph7'><fieldset id='mFph7'></fieldset></dl></div>
      <legend id='mFph7'><style id='mFph7'><dir id='mFph7'><q id='mFph7'></q></dir></style></legend>
        <bdo id='mFph7'></bdo><ul id='mFph7'></ul>
          <tbody id='mFph7'></tbody>
        <tfoot id='mFph7'></tfoot>

              • 本文介紹了如何正確解析我的 Discord 機器人中的標記用戶?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我正在向我的 Discord 機器人添加個人資料卡,但我遇到了一個問題.當有人鍵入 !profile @user 我不確定如何正確解析 @user 以便機器人知道要查找哪個個人資料卡.

                I am adding profile cards onto my Discord bot, but I've come across one issue. When someone types !profile @user I am not sure how to properly parse for @user so the bot knows which profile card to lookup.

                我首先解析 message.content,然后刪除消息內(nèi)容的前 9 個字符(始終是 !profile),但消息內(nèi)容的其余部分返回看起來 < 的 user_id;@289583108183948460> 而不是用戶的歧視.我曾嘗試使用 re.sub 刪除特殊字符(@、> 和 <),如下所示:

                I first parse message.content and then remove the 9 first chars of the message content (which is always !profile) but the rest of the message content returns the user_id which looks <@289583108183948460> instead of the user's discrim. I have tried using re.sub to remove the special characters (@, >, and <) like this:

                a = str(message.content[9:])
                removeSpecialChars = re.sub("[!@#$%^&*()[]{};:,./<>?|`~-=_+]", " ", a)
                print(removeSpecialChars)
                

                但是當我只想要數(shù)字時,奇怪的字符仍然存在,因此我可以輕松地在數(shù)據(jù)庫中搜索它.我確信有更好的方法可以做到這一點,但我想不通.

                But the weird characters are still there when I only want the number so I can search it in the database easily. I'm sure there's a way better way to do this though but I can't figure it out.

                推薦答案

                discord.py 的消息對象包含 Message.mentions 屬性,因此您可以遍歷 Member.以下是 async 和 的文檔列表 rel="nofollow noreferrer">重寫.

                discord.py's message objects include a Message.mentions attribute so you can iterate over a list of Member. Here are the doc listings for async and rewrite.

                有了這個,你可以簡單地迭代提及:

                With this you can simply iterate over the mentions as so:

                for member in ctx.message.mentions:
                    # do stuff with member
                

                你真正想要的

                discord.py 允許您從帶有 discord.Member 對象"nofollow noreferrer">類型提示.只需將以下內(nèi)容添加到命令中

                what you actually want

                discord.py allows you to grab discord.Member objects from messages with type hinting. simply add the following to the command

                @bot.command()
                async def profile(ctx, member: discord.Member=None):
                    member = member or ctx.message.author
                

                這篇關于如何正確解析我的 Discord 機器人中的標記用戶?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!

                相關文檔推薦

                How to make a discord bot that gives roles in Python?(如何制作一個在 Python 中提供角色的不和諧機器人?)
                Discord bot isn#39;t responding to commands(Discord 機器人沒有響應命令)
                Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“關于我嗎?Discord 機器人的功能?(不和諧.py))
                message.channel.id Discord PY(message.channel.id Discord PY)
                How do I host my discord.py bot on heroku?(如何在 heroku 上托管我的 discord.py 機器人?)
                discord.py - Automaticaly Change an Role Color(discord.py - 自動更改角色顏色)

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

                1. <legend id='ioc5l'><style id='ioc5l'><dir id='ioc5l'><q id='ioc5l'></q></dir></style></legend><tfoot id='ioc5l'></tfoot>

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

                            <tbody id='ioc5l'></tbody>
                          主站蜘蛛池模板: 欧美综合视频在线 | 国产中文区二幕区2012 | 在线观看亚洲 | 毛片一级片 | 夜夜爽99久久国产综合精品女不卡 | 91精品国产91久久久久久最新 | 欧美精品一区二区三区四区 在线 | 视频在线一区二区 | 在线国产精品一区 | 欧美久久久久 | 欧美一区二区三区在线观看 | 免费一二区 | 麻豆久久久9性大片 | 欧美一级二级在线观看 | 另类 综合 日韩 欧美 亚洲 | 久久久久久久一区 | 一区二区在线免费观看 | 精品国产乱码久久久久久a丨 | 中文字幕一区二区三区四区五区 | 亚洲区视频 | 先锋资源站 | 精品免费视频一区二区 | 久久久亚洲一区 | 日韩在线观看 | 成年人的视频免费观看 | 精品国产乱码久久久久久丨区2区 | 国产h视频 | 国产欧美一区二区三区日本久久久 | 美女黄18岁以下禁止观看 | 在线视频 亚洲 | www日本在线观看 | 日韩精品成人免费观看视频 | 天堂久久天堂综合色 | h视频在线观看免费 | 亚洲免费视频网址 | 亚洲精品一区二区三区蜜桃久 | 久久久久久色 | 亚洲国产一区二区在线 | 久久久久亚洲精品 | 欧美男人天堂 | 亚洲欧美综合精品久久成人 |