Skip to content

Instantly share code, notes, and snippets.

@Neodevils
Created November 28, 2025 16:19
Show Gist options
  • Select an option

  • Save Neodevils/450f97812260187fabba2448e7d0738f to your computer and use it in GitHub Desktop.

Select an option

Save Neodevils/450f97812260187fabba2448e7d0738f to your computer and use it in GitHub Desktop.
Update your Discord app/bot is profile for global/server specific.
import { Client, Events, GatewayIntentBits } from "discord.js";
const BOT_TOKEN = ""; // Your Discord bot token
const GUILD_ID = ""; // Optional: target guild to clear overrides
const APP_AVATAR = ""; // Application avatar
const BOT_AVATAR = ""; // Bot avatar
const BANNER_URL = ""; // Application banner
const APP_BIO = ""; // App description
const APP_TAGS = []; // App tags
if (!TOKEN) {
throw new Error("BOT_TOKEN is required in env.");
}
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.once(Events.ClientReady, async () => {
console.log(`Logged in as ${client.user?.tag}`);
try {
// Ensure application is fetched to access edit()
await client.application?.fetch();
if (!client.application) {
throw new Error("client.application is not available.");
}
// Update global application profile
// You can pass URL strings or a Buffer for avatar/banner.
await client.application.edit({
icon: APP_AVATAR_URL,
// description: APP_BIO,
// tags: APP_TAGS
});
client.user.setAvatar(BOT_AVATAR);
client.user.setBanner(BANNER_URL);
console.log("✅ Application profile updated.");
// Optionally clear guild-specific member profile overrides so global avatar shows
if (GUILD_ID) {
const guild = await client.guilds.fetch(GUILD_ID);
const me = await guild.members.fetchMe();
if (!me) throw new Error("Bot is not in the guild or fetchMe failed.");
// Clear guild profile overrides (nick/avatar/banner/bio)
await me.edit({
nick: null,
avatar: null,
banner: null,
bio: null,
});
console.log("✅ Cleared guild-specific profile overrides.");
}
} catch (err) {
console.error("❌ Failed to update profile:", err);
} finally {
// Give Discord a moment to accept changes, then destroy the client
setTimeout(() => client.destroy(), 1000);
}
});
client.login(TOKEN);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment