Dan106632
Dan106632

Reputation: 21

Discord Bot Python - Changing Bot's nickname

I'm trying to get the bot's name to change every time it runs. I've check the discord.py docs but nothing there has been of use and none of them throw up any errors. Any ideas?

Has perms 'admin' and 'change nickname'

import discord
from discord.ext import commands
from discord.ext.commands import bot

bot = commands.Bot(command_prefix=PREFIX)
bot.remove_command('help')


@bot.event
async def on_ready():
    await bot.user.edit(nick="New Nickname")

bot.run(TOKEN)

Upvotes: 1

Views: 1151

Answers (1)

Axisnix
Axisnix

Reputation: 2907

You must have the member object of your bot to change your nickname as nicknames are done in guild's. Then you must edit it.

@bot.event
async def on_ready():
    for guild in bot.guilds:
        await guild.me.edit(nick="new nickname")

Upvotes: 2

Related Questions