Answer the question
In order to leave comments, you need to log in
Why are events not working in discord.py?
I am writing a discord bot in python, I want to display a welcome message when a user logs into the server.
import discord
from discord.ext import commands
TOKEN = settings ['token']
bot = commands.Bot (command_prefix = settings ['prefix'])
@bot.event
async def on_member_join (member):
print(f'Присоединился {member.user}')
await member.send("Hi!")
bot.run (TOKEN)
Answer the question
In order to leave comments, you need to log in
Event on_member_join
requires members intent: https://discordpy.readthedocs.io/en/stable/api.htm...
Enable required intents in bot control panel:
And then add argument intents
to bot constructor:
https://discordpy.readthedocs.io /en/stable/intents...
intents = discord.Intents.default()
intents.members = True
bot = commands.Bot(..., intents=intents)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question