K
K
keva1z2021-03-29 21:07:11
Python
keva1z, 2021-03-29 21:07:11

How to get user by id discord.py?

I get the user id from a folder and convert it to an int.

elif n == ":":
                            mesg = mesg.join(wordo)


                            wordo.clear()
                            wordo.append(mesg)
                            print(wordo)
                            member = bot.get_user(mesg)
                            break


        else:
            await channel.send(f"Item ``{item}`` not found. ``>list`, to get list of items")

    else:
        await channel.send(f"u cant do it in this channel")
    if findor == 1:
        await author.send(f"U buying ``{item}`` from ``{member}``")
        await member.get_user(mesg).send(f"``{author}`` want buy your ``{item}``")
    elif findor == 0:
        await channel.send(f"Item ``{item}`` not in sell.")
f
and get an error
AttributeError: 'NoneType' object has no attribute 'get_user'

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
keva1z, 2021-03-29
@keva1z

sorry here is the reason in bot.get_user(mesg) and await member.get_user(mesg).send(f"``{author}`` want buy your ``{item}``") i just forgot to change

mesg = mesg.join(wordo)


                            wordo.clear()
                            wordo.append(mesg)
                            print(wordo)
                            member = bot.get_user(mesg)
                            break

S
soremix, 2021-03-29
@SoreMix

bot = None, what to add

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question