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

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

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

      <tfoot id='c3VWu'></tfoot>
    2. Discord.py on_member_join 不起作用,没有错误消息

      时间:2023-09-11

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

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

                本文介绍了Discord.py on_member_join 不起作用,没有错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我正在尝试使用 Discord.py 库制作一个不和谐机器人.带有 @client.command() 装饰器的命令对我来说工作正常,但我尝试过的事件都没有工作.

                I am trying to make a discord bot with the Discord.py library. The commands with the @client.command() decorator work fine for me, but none of the event ones that I tried work.

                
                @client.event
                async def on_member_join(member):
                    channel = client.get_channel(ChannelId) #I did define channel Id in my code
                    await channel.send("someone has joined")
                
                @client.event
                async def on_member_remove(member):
                    print("Someone has left")
                

                我希望这会输出到终端或我输入的频道 ID,但什么也没有出现,甚至没有错误消息.

                I would expect this to output to the terminal or in the channel id I put in, but nothing appears, not even an error message.

                *我用过客户端.对于所有功能.*我在 mac 上做这个.

                *I used client. for all functions. *I am doing this on mac.

                我不太确定它为什么起作用,我没有收到任何错误消息,而且我似乎找不到其他人遇到这个问题.

                Im not quite sure why its working, I do not get any error messages, and I cant seem to find anyone else with this problem.

                提前致谢

                推荐答案

                使用版本 >1.5.0 你可以这样做:

                With version >1.5.0 you can do something like this:

                import discord
                
                intents = discord.Intents.default()
                intents.members = True
                
                client = discord.Client(intents=intents)
                
                @client.event
                async def on_member_join(member):
                    await member.send("Welcome!")
                

                这篇关于Discord.py on_member_join 不起作用,没有错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:Discord 'on_member_join' 功能不起作用 下一篇:Mass DM 机器人工作正常,现在它不会发送消息

                相关文章

                最新文章

                  • <bdo id='7OtKb'></bdo><ul id='7OtKb'></ul>
                    <legend id='7OtKb'><style id='7OtKb'><dir id='7OtKb'><q id='7OtKb'></q></dir></style></legend>
                  1. <small id='7OtKb'></small><noframes id='7OtKb'>

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