Reputation: 457
I am making a discord bot with discord.py on python 3.8.6.
My other functions, such as on_ready
and other commands, work. However, on_member_join
is never called when a member joins.
from discord.ext import commands
bot = commands.Bot(command_prefix =".")
@bot.event
async def on_ready():
print('logged on salaud')
@bot.event
async def on_member_join(member):
print("test")
bot.run("TOKEN")
Why is on_member_join
not being called, and how can I resolve this?
Upvotes: 1
Views: 361
Reputation: 88
discord.py
v1.5 introduces intents
An intent basically allows a bot to subscribe into specific buckets of events.
In order to be able to get server data you need to:
Enable Server Member intents in your application
And Implement discord.Intents
at the beginning of your code.
import discord
intents = discord.Intents.all()
bot = discord.Client(intents=intents)
# or
from discord.ext import commands
bot = commands.Bot(command_prefix = ".", intents=intents)
For more information, read about Intents | documentation
Upvotes: 2