Answer the question
In order to leave comments, you need to log in
Why doesn't Heroku see the on_member_join event in discord.py?
Here is the code:
from discord.ext import commands
from discord.utils import get
import os
import discord
import asyncio
intents = discord.Intents.default()
ds = commands.Bot(command_prefix='!')
@ds.event
async def on_member_join(member, intents=intents):
channel = ds.get_channel(713305916044214292)
vk = get(ds.emojis, name='vk')
twitch = get(ds.emojis, name='twitch')
role = discord.utils.get(member.guild.roles, name="Без роли")
await member.add_roles(role)
await channel.send(f"Приветствую тебя, {member.mention} :wave:")
emb = discord.Embed()
emb.color = discord.Colour.gold()
emb.add_field(name = " ", value = f"""**В первую очередь рекомендуем получить**
**роль для доступа ко всем каналам**
**:closed_lock_with_key:[Получить роль](https://discord.gg/Bv85HnT)**
**Для комфортного времяпрепровождения**
**рекомендуем озокомиться с**
**:clipboard:[Правилами Discord](https://discord.gg/YGXUGva)**
**Полезные ссылки:**
{vk}[Группа Вк](https://vk.com/diadem.mine)
{twitch}[Twitch](https://www.twitch.tv/d1adem_)""")
emb.set_thumbnail(url = "https://images-ext-1.discordapp.net/external/1AXiajN3xjbjin6VR-J4QNOG4Gy4wPP-uabVCUGMAp0/https/media.discordapp.net/attachments/713367810985689110/714404218777239614/anim.gif")
emb.set_author(name = """Добро пожаловать в официальный Discord
канал проекта Diadem!""", icon_url=member.avatar_url)
await channel.send(embed = emb)
token = os.environ.get("BOT_TOKEN")
ds.run(token)
Answer the question
In order to leave comments, you need to log in
Because it on_member_join
requires the "members" intent: https://discordpy.readthedocs.io/en/stable/api.htm...
And the intents argument is not passed to the listener, but to the bot's constructor.
intents = discord.Intents.default()
intents.members = True
# либо «intents = discord.Intents.all()» если оба intents доступны
ds = commands.Bot(command_prefix='!', intents=intents)
@ds.event
async def on_member_join(member):
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question