проблемы с командой приветствия дискорд.ру

async def on_member_join(member):
    chanel = bot.get_channel(a)
    await chanel.send(f'{member.name} присоиединился')
@bot.command()
async def setchanel(ctx,*,chanel):
    setchanel = chanel
    return setchanel```

я хочу чтобы через команду setchanel можно было задать айди канала, в который будут приходить сообщения о заходе участников. но выдает ошибку. помогите пожалуйста

Ответы (1 шт):

Автор решения: Corrygan

Я не применял id канала..

@bot.event
async def on_member_join(member):
    global chanel
    await chanel.send(f'{member.name} присоединился')

@bot.command()
async def setchanel(ctx, channel: discord.TextChannel)
    global chanel
    chanel = channel

А здесь уже с применением id

@bot.event
async def on_member_join(member):
    global chanel
    await chanel.send(f'{member.name} присоединился')

@bot.command()
async def setchanel(ctx, channel_id)
    global chanel
    chanel = bot.get_channel(channel_id)
→ Ссылка