5

I feel like I've tried everything. My bot's name is currently "TestApp" and I would like to change it to something else. Do I have to remove it completely, create a whole new app inside of https://discordapp.com/developers/, assign it a proper name, then add a bot inside there? Then obviously change the token inside my Discord.js application and re-invite the bot to the channel.

I've tried:

Let me know if you can actually change the username/nickname of a Discord bot, without removing it and starting over with the configuration. I can't seem to find this answer anywhere.

4 Answers 4

13

With Discord's new Dashboard, it's actually really easy to change the username using ANY language! On your applications page, if you go to the "Bot" tab, you can change both the user avatar as well as the username there. After you hit "save changes" it will apply the new username and avatar to Discord. Like before, you won't notice the change immediately, but it will happen.

OLD ANSWER:

As of Discord.js v11.2, When you create a new bot client using Discord.js, you can use .setUsername on the new client to change the name instead of sending a request to the API. You will not notice the change immediately, but it will happen. To rename the application on the developers page, you just need to click on the application itself.

Here's an example login method to change the name, as stated in the documentation.

const Discord = require('discord.js');
const bot = new Discord.Client();
bot.on('ready', function() {
    bot.user.setUsername("MyNewUsername");
}
bot.login("token");

Or, if you have an eval command, you can simply run the below. If your bot client is named something other than "bot", use that instead.

bot.user.setUsername("MyNewUsername");
Sign up to request clarification or add additional context in comments.

Comments

7

Well who knew, you can send a PATCH request to their server with your new information in it (you can also change avatar like this):

curl -H 'Authorization: Bot TOKEN_GOES_HERE' -H "Content-Type: application/json" -X PATCH -d '{"username": "NEWNAMEHERE"}' https://discordapp.com/api/users/@me

Found this in their documentation here.

Comments

0
const Discord = require('discord.js')
const client  = new Discord.Client()

client.on('message', (msg) =>{
if(msg.author.bot || msg.channel.type == "dm" || msg.channel.type== 'group')return
if(msg.content.startsWith(prefix) != true)return
if(msg.content.startsWith(`${prefix}nick`)){
      if(msg.author.id != ownerID)
     msg.guild.members.get(client.user.id).setNickname(/*'Nickname goes here'*/)
  }
})

1 Comment

const Discord = require('discord.js') const client = new Discord.Client() client.on('message', (msg) =>{ if(msg.author.bot || msg.channel.type == "dm" || msg.channel.type== 'group')return if(msg.content.startsWith(prefix) != true)return const args = msg.content.slice(prefix.length).split(' '); if(msg.content.startsWith(${prefix}nick)){ if(msg.author.id != ownerID) msg.guild.members.get(client.user.id).setNickname(args.toLocaleString()) } }) if you want to do that with custom input lul
0
client.user.setUsername("NewUsernameHere");

1 Comment

Your answer could be improved by adding more information on what the code does and how it helps the OP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.