Discord.py error in client.send_message(), need help

Asked

Viewed 104 times

-1

I am very beginner and started making a bot with the Discord.py library, but when using this code:

@client.event
async def on_member_join(member):
    canal = client.get_channel("50694371938855479491")
    mensagem = (f'============BEM VINDO AO DISCORD DA GUEEG GAMING, {member.mention}!============" \
               "\n Para me chamar basta escrever "Oi Krienza" ou apenas "Krienza" ta ligado?'
                f'\n Zepeto Zepeturr Hhaha zomplerin')

    await message.channel.send(canal, mensagem)

I switched from client.send_message to message.channel.send() which is how I ended up reading in the documentation for the new version of Discord.py. But I get error like 'Message unassigned'''

1 answer

0


I found a similar problem: https://stackoverflow.com/questions/59333157/discord-py-send-message-to-channel

I took the following test:

    mensagem = (f'============BEM VINDO AO DISCORD DA GUEEG GAMING, {member.mention}!============" \
           "\n Para me chamar basta escrever "Oi Krienza" ou apenas "Krienza" ta ligado?'
            f'\n Zepeto Zepeturr Hhaha zomplerin')

    channel = bot.get_channel(725359504417357835)

    await channel.send(mensagem)

I hope I’ve helped.

  • I wouldn’t even try, because I had done something extremely similar, but I did and it really continued the problem, but it was only I changed it in "Channel = bot.get_channel(725359504417357835)" that you sent by "Channel = client.get_channel(725359504417357835)" since the event I created was by @client.Event and not bot and it worked. Thank you very much friend!

  • Ali was only a matter of variable name, thanks!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.