title: Discord Self-Bot: Direct messaging a user when joining a server/guild
body: <p>I am trying to create a bot to run through my personal discord account, and direct message people when they join a specific discord server I am in. However, my on_member_join(member) method is not running when a member joins a server (not printing &quot;registered&quot; in terminal). I am curious how to make the bot listen for a specific server or just register this event in general. Note on_connect() and spam() both function properly.</p>
  <pre><code>import discord
  import asyncio
  import requests
  from discord.ext import commands
  yer=commands.Bot(command_prefix=&quot;!&quot;,help_command=None,self_bot=True)
  token=&quot;TOKEN&quot;
  
  class SelfBot(commands.Cog):
      def __init__(self,yer):
          self.yer=yer
  
     @yer.command()
     async def spam(ctx):
          for i in range(50):
              await ctx.send(&quot;Hello!&quot;)
              await asyncio.sleep(0.7)
  
      @yer.event
      async def on_connect():
          await yer.change_presence(status=discord.Status.idle,activity=discord.Game(&quot;Game&quot;))
  
     @yer.event
     async def on_member_join(member):
         print(&quot;registered&quot;)
  
  yer.run(token,bot=False)
  </code></pre>