Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Discord 发送消息时更改昵称_Discord - Fatal编程技术网

Discord 发送消息时更改昵称

Discord 发送消息时更改昵称,discord,Discord,这似乎是一个相当奇怪的问题,但是否有可能在发送任何消息时在某个服务器中自动更改您自己的昵称?我对js或py的经验几乎为零,所以我甚至不知道从哪里开始。如果能够做到这一点,我将非常感谢您的详细解释。您可以使用更改您的机器人的昵称。这是一个机器人,每当它响应消息Hello import discord client = discord.Client() counter = 0 @client.event async def on_message(message): global cou

这似乎是一个相当奇怪的问题,但是否有可能在发送任何消息时在某个服务器中自动更改您自己的昵称?我对js或py的经验几乎为零,所以我甚至不知道从哪里开始。如果能够做到这一点,我将非常感谢您的详细解释。

您可以使用更改您的机器人的昵称。这是一个机器人,每当它响应消息
Hello

import discord

client = discord.Client()

counter = 0

@client.event
async def on_message(message):
    global counter
    if message.author.bot:
        return
    if "hello" in message.content.lower():
        if message.guild is None:
            return
        counter += 1
        await message.guild.me.edit(nick=f"Responses: {counter}")
        await message.channel.send("Nickname changed")

client.run("your token")

使用可以调用协同程序来更改昵称。如果你想更改其他用户的昵称,你需要“管理昵称”权限。好的,如果我只想更改我自己的昵称,我该怎么做?假设我想运行一个自助机器人,每当我从同一个帐户发送消息时,它都会做出反应。本质上,它会在检测到“自己”发送的消息时更改自己的名称。可能吗?编辑:我所说的消息是指任何消息是的,您只需更改
hello
复选框,检查
message.author.id
是否等于您的id。