This code allows the bot's status to be the member count! Please update the variable yourserver to the name of your server. This code will trigger when someone joins your server. Make sure you enable SERVER MEMBERS INTENT through the discord developer portal before installing.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let yourserver = `test`;
let guild = await lib.discord.guilds['@0.1.1'].retrieve({
guild_id: `${context.params.event.guild_id}`,
});
if (guild.name == yourserver) { // Only monitor one guild :p
let members = await lib.discord.guilds['@0.1.0'].retrieve({
guild_id: `${context.params.event.guild_id}`,
with_counts: true,
});
await lib.discord.users['@0.1.4'].me.status.update({
activity_name: `${yourserver} has ${members.approximate_member_count} members!`,
activity_type: 'GAME', // Best to use Game, as it is the easiest
status: 'ONLINE', //Set it to Do not disturb, invisible, etc it wont affect it.
});
}