I tried to make a discord bot that tracks who logged in and out, but I failed. Please help me, thank you.
from disnake.ext import commands
intents = disnake.Intents.default() #
intents.presences = True
bot = commands.Bot(command_prefix='!', intents=intents)
@bot.event
async def on_ready():
print('Бот готов к работе.')
@bot.event
async def on_member_update(before, after):
if before.status != disnake.Status.online and after.status == disnake.Status.online:
print(f'{after.name} зашел в сеть.')
elif before.status == disnake.Status.online and after.status !=:
print(f'{after.name} вышел из сети.')
disnake.Status.online
bot.run("TOKEN")```
You need to enable the Intents.members intent in your code. Also go to the Developer Portal and the Bot section to enable the
Membersintent.