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

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

    1. <i id='wEK4t'><tr id='wEK4t'><dt id='wEK4t'><q id='wEK4t'><span id='wEK4t'><b id='wEK4t'><form id='wEK4t'><ins id='wEK4t'></ins><ul id='wEK4t'></ul><sub id='wEK4t'></sub></form><legend id='wEK4t'></legend><bdo id='wEK4t'><pre id='wEK4t'><center id='wEK4t'></center></pre></bdo></b><th id='wEK4t'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='wEK4t'><tfoot id='wEK4t'></tfoot><dl id='wEK4t'><fieldset id='wEK4t'></fieldset></dl></div>
        <bdo id='wEK4t'></bdo><ul id='wEK4t'></ul>
        <tfoot id='wEK4t'></tfoot>
        <legend id='wEK4t'><style id='wEK4t'><dir id='wEK4t'><q id='wEK4t'></q></dir></style></legend>
      1. Python - DM 一個(gè)用戶 Discord 機(jī)器人

        Python - DM a User Discord Bot(Python - DM 一個(gè)用戶 Discord 機(jī)器人)

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

                  <bdo id='75SBN'></bdo><ul id='75SBN'></ul>
                • <legend id='75SBN'><style id='75SBN'><dir id='75SBN'><q id='75SBN'></q></dir></style></legend>

                  <small id='75SBN'></small><noframes id='75SBN'>

                  本文介紹了Python - DM 一個(gè)用戶 Discord 機(jī)器人的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我正在使用 Python 開發(fā) User Discord Bot.如果 bot 所有者鍵入 !DM @user,那么 bot 將 DM 所有者提到的用戶.

                  I'm working on a User Discord Bot in Python .If the bot owner types !DM @user then the bot will DM the user that was mentioned by the owner.

                  @client.event
                  async def on_message(message):
                      if message.content.startswith('!DM'):
                          msg = 'This Message is send in DM'
                          await client.send_message(message.author, msg)
                  

                  推薦答案

                  最簡(jiǎn)單的方法是使用 discord.ext.commands 擴(kuò)展.這里我們使用 converter 來獲取目標(biāo)用戶,和一個(gè) keyword-only 參數(shù)發(fā)送給他們的可選消息:

                  The easiest way to do this is with the discord.ext.commands extension. Here we use a converter to get the target user, and a keyword-only argument as an optional message to send them:

                  from discord.ext import commands
                  import discord
                  
                  bot = commands.Bot(command_prefix='!')
                  
                  @bot.command(pass_context=True)
                  async def DM(ctx, user: discord.User, *, message=None):
                      message = message or "This Message is sent via DM"
                      await bot.send_message(user, message)
                  
                  bot.run("TOKEN")
                  


                  對(duì)于較新的 1.0+ 版本的 discord.py,您應(yīng)該使用 send 而不是 send_message

                  from discord.ext import commands
                  import discord
                  
                  bot = commands.Bot(command_prefix='!')
                  
                  @bot.command()
                  async def DM(ctx, user: discord.User, *, message=None):
                      message = message or "This Message is sent via DM"
                      await user.send(message)
                  
                  bot.run("TOKEN")
                  

                  這篇關(guān)于Python - DM 一個(gè)用戶 Discord 機(jī)器人的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  python: Two modules and classes with the same name under different packages(python:不同包下同名的兩個(gè)模塊和類)
                  Configuring Python to use additional locations for site-packages(配置 Python 以使用站點(diǎn)包的其他位置)
                  How to structure python packages without repeating top level name for import(如何在不重復(fù)導(dǎo)入頂級(jí)名稱的情況下構(gòu)造python包)
                  Install python packages on OpenShift(在 OpenShift 上安裝 python 包)
                  How to refresh sys.path?(如何刷新 sys.path?)
                  Distribute a Python package with a compiled dynamic shared library(分發(fā)帶有已編譯動(dòng)態(tài)共享庫(kù)的 Python 包)

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

                    • <legend id='pHnUN'><style id='pHnUN'><dir id='pHnUN'><q id='pHnUN'></q></dir></style></legend>

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

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

                            主站蜘蛛池模板: 91看片在线观看 | 久久精品一区二区三区四区 | 最新国产精品视频 | 亚洲国产情侣 | 欧美成人二区 | 午夜视频网站 | 久久久久久一区 | 日日摸夜夜添夜夜添特色大片 | 欧美精品一二三区 | av免费看片 | 九九热精品在线 | 一本综合久久 | 在线午夜电影 | 激情欧美一区二区三区 | 日本久久久久久久久 | 国产精品久久久久久中文字 | 精品国产乱码久久久久久中文 | 九色国产| 国产一区二区三区在线看 | 免费av观看 | 精品国产欧美日韩不卡在线观看 | 综合久久综合久久 | 日韩一区二区三区在线视频 | 久久久精品高清 | 91久久看片 | 国产欧美精品一区二区色综合 | 影音先锋中文字幕在线观看 | 成人av网页 | 亚洲在线一区二区三区 | 91爱爱·com| 国产91丝袜在线播放 | av在线免费观看网址 | 99精品在线免费观看 | 91视频入口 | 久久精品国产99国产精品 | 亚洲午夜一区二区 | 午夜欧美a级理论片915影院 | 色综合久久久久 | 成人福利电影 | a a毛片| 91精品国产92 |