Meowcord Logo
meowcord
DocsManaging Bot Presence

Managing Bot Presence

Learn how to customize your bot's activity and status in Discord.

Setting Bot Activity

Meowcord provides easy ways to set your bot's activity, which is what shows up in the "Playing...", "Watching...", etc. status on Discord.

You can use the client.presence method to set your bot's activity:

index.js
const { ActivityType } = require('discord.js');

// Set activity to "Playing meowcord"
bot.discordClient.user.setActivity("meowcord", { type: ActivityType.Playing });

// Set activity with a specific type  
bot.discordClient.user.setActivity("a movie", { type: ActivityType.Watching });
bot.discordClient.user.setActivity("Spotify", { type: ActivityType.Listening });

Setting Bot Status

You can also set your bot's status (online, idle, do not disturb, or invisible) using the client.userStatus method:

index.js
// Set status to online (green)
bot.discordClient.user.setStatus("online");

// Set status to idle (yellow)  
bot.discordClient.user.setStatus("idle");

// Set status to do not disturb (red)
bot.discordClient.user.setStatus("dnd");

// Set status to invisible (appears offline)
bot.discordClient.user.setStatus("invisible");

Combining Status and Activity

You can set both the status and activity together:

index.js
// Set status to idle and activity to "Waiting for commands"
bot.userStatus("idle");
bot.presence("Waiting for commands");

Mobile Status

Meowcord also supports setting a mobile status, which makes the bot appear as if it's online on a mobile device. This can be set when creating the client:

index.js
const bot = new Meow({
  intents: [Intents.Guilds, Intents.GuildMessages, Intents.MessageContent],
  prefix: "!",
  meowSettings: {
    mobileStatus: true
  },
});

Changing Presence Based on Events

You can change your bot's presence in response to events. For example, you might want to update the status to show the number of servers the bot is in:

index.js
bot.on("ready", () => {
  console.log(`Logged in as ${bot.discordClient.user.tag}!`);
  
  // Set initial presence
  bot.discordClient.user.setActivity(`in ${bot.discordClient.guilds.cache.size} servers`, { type: "PLAYING" });
});

bot.on("guildCreate", (guild) => {
  // Update presence when joining a new server
  bot.discordClient.user.setActivity(`in ${bot.discordClient.guilds.cache.size} servers`, { type: "PLAYING" });
  console.log(`Joined a new guild: ${guild.name}`);
});

bot.on("guildDelete", (guild) => {
  // Update presence when leaving a server
  bot.discordClient.user.setActivity(`in ${bot.discordClient.guilds.cache.size} servers`, { type: "PLAYING" });
  console.log(`Left a guild: ${guild.name}`);
});

Rotating Presence

index.js
const { ActivityType } = require('discord.js');

bot.on("ready", () => {
  console.log(`Logged in as ${bot.discordClient.user.tag}!`);
  
  // Array of presence options
  const activities = [
    { name: "with meowcord", type: ActivityType.Playing },
    { name: "for commands", type: ActivityType.Watching },
    { name: `in ${bot.discordClient.guilds.cache.size} servers`, type: ActivityType.Playing },
    { name: "to !help", type: ActivityType.Listening }
  ];
  
  let activityIndex = 0;
  
  // Change presence every 30 seconds
  setInterval(() => {
    const activity = activities[activityIndex];
    bot.discordClient.user.setActivity(activity.name, { type: activity.type });
    
    // Cycle through the activities
    activityIndex = (activityIndex + 1) % activities.length;
  }, 30000);
});

Complete Example

Here's a complete example demonstrating various presence features:

index.js
const { Meow, Intents } = require("meowcord");
const { ActivityType } = require("discord.js");

const bot = new Meow({
  intents: [Intents.Guilds, Intents.GuildMessages, Intents.MessageContent],
  prefix: "!",
  meowSettings: {
    returnBotInfosInConsole: true
  },
});

bot.on("ready", () => {
  console.log(`Logged in as ${bot.discordClient.user.tag}!`);
  
  // Set initial status and presence
  bot.discordClient.user.setStatus("online");
  bot.discordClient.user.setActivity("with meowcord", { type: ActivityType.Playing });
  
  // Array of presence options
  const activities = [
    { name: "with meowcord", type: ActivityType.Playing },
    { name: "for commands", type: ActivityType.Watching },
    { name: `in ${bot.discordClient.guilds.cache.size} servers`, type: ActivityType.Playing },
    { name: "to !help", type: ActivityType.Listening }
  ];
  
  let activityIndex = 0;
  
  // Change presence every 30 seconds
  setInterval(() => {
    const activity = activities[activityIndex];
    bot.discordClient.user.setActivity(activity.name, { type: activity.type });
    
    // Cycle through the activities
    activityIndex = (activityIndex + 1) % activities.length;
  }, 30000);
});

bot.start("YOUR_BOT_TOKEN");

Activity Types

Discord.js v14'te activity type'lar için enum kullanılır:

index.js
const { ActivityType } = require('discord.js');

// Available activity types:
ActivityType.Playing    // "Playing something"
ActivityType.Streaming  // "Streaming something" 
ActivityType.Listening  // "Listening to something"
ActivityType.Watching   // "Watching something"
ActivityType.Custom     // Custom status
ActivityType.Competing  // "Competing in something"