E
E
Esternit2020-10-22 12:31:34
Python
Esternit, 2020-10-22 12:31:34

How to get a user's nickname on the server using a Python discord bot?

import discord

client = discord.Client()
@client.event
    if message.content.startswith('!имя') :
        caller = message.author
        caller = str(caller)
        await message.channel.send(caller)


This program takes the sender's nickname in the discord, but I need it to take the user's nickname on this server, how to implement this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
shurshur, 2020-10-22
@Esternit

If the message was written in private, and not in the channel, then nothing. Because privates work past the server and are not connected with it in any way. If in a channel, then message.author.nick will return the nickname on that server.
The bot can sort through its servers for the presence of this user on them to identify it, but since the bot with the user can have more than one common server, this idea is so-so.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question