Change your bot's name & avatar using '/bot' command. Only the bot owner can use it. You'll need to manually create the slash command via the command builder and give it two options for name and avatar here: https://autocode.com/tools/discord/command-builder/
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const botOwnerId = `${process.env.Bot_owner_id}`;
if (context.params.event.member.user.id === botOwnerId) {
if (!context.params.event.data.options.length) {
return await lib.discord.channels['@0.2.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `You need to supply options to this command!`,
});
}
let name = context.params.event.data.options.find(
(option) => option.name === 'name'
);
let avatar = context.params.event.data.options.find(
(option) => option.name === 'avatar'
);
console.log(name);
console.log(avatar);
if (name) {
await lib.discord.users['@0.1.4'].me.update({
username: name.value,
});
}
if (avatar) {
// Get the avatar image.
let avatarResponse = await lib.http.request['@1.1.5']({
method: 'GET',
url: `${avatar.value}`,
});
if (avatarResponse.body) {
await lib.discord.users['@0.1.4'].me.update({
avatar: avatarResponse.body,
});
}
}
await lib.discord.channels['@0.2.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `Bot updated!`,
});
} else {
return await lib.discord.channels['@0.2.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `This command is for only **Bot owner**!`,
});
}