Build a pet system under one command: /pet adopt gives a member a pet, its hunger and happiness drop over time, /pet feed and /pet play restore them, and /pet status shows how it is doing
A virtual pet system where members can adopt and care for their own pets.
Commands:
/pet adopt — Choose and adopt a pet (dog, cat, rabbit, hamster, lizard, or bird)/pet status — Check your pet's hunger and happiness levels/pet feed — Feed your pet to restore fullness (30min cooldown)/pet play — Play with your pet to boost happiness (30min cooldown)Your pet's hunger increases and happiness decreases over time at 1% per hour. Keep them well-fed and entertained to maintain a thriving pet!
Made by MEE6. Remix it to get a copy of your own and change anything you like.
🎉 Congratulations! You adopted Buddy!
Status: 💚 Thriving
██████████ 100%
██████████ 100%
2 months ago
🎉 Congratulations! You adopted Whiskers!
Status: 💚 Thriving
██████████ 100%
██████████ 100%
2 months ago
🍖 Buddy is still full! Wait 1800s before feeding again.
Here's how Buddy is doing:
Status: 💛 Needs care
█████░░░░ 52%
█████░░░░ 52%
2 months ago
🍖 You fed Buddy! They're happy and full.
Status: 💛 Needs care
██████████ 100%
█████░░░░ 52%
2 months ago
🎾 You played with Buddy! They did a trick and had a great time.
Status: 💚 Thriving
██████████ 100%
██████████ 100%
2 months ago
🎾 You played with Whiskers! They jumped around and had a great time.
Status: 💛 Needs care
█████░░░░ 52%
██████████ 100%
2 months ago
// Pet system: adopt, care for, and check on your virtual pet
interface Pet {
name: string;
type: string;
adoptedAt: number;
lastFed: number;
lastPlayed: number;
}
const PET_TYPES = ['🐶 Dog', '🐱 Cat', '🐰 Rabbit', '🐹 Hamster', '🦎 Lizard', '🐦 Bird'];
const DECAY_RATE = 1; // 1% per hour
const FEED_COOLDOWN = 1800; // 30 minutes
const PLAY_COOLDOWN = 1800; // 30 minutes
function getHunger(pet: Pet): number {
const hoursSinceFed = (Date.now() - pet.lastFed) / 1000 / 3600;
const hunger = Math.min(100, Math.floor(hoursSinceFed * DECAY_RATE));
return hunger;
}
function getHappiness(pet: Pet): number {
const hoursSincePlayed = (Date.now() - pet.lastPlayed) / 1000 / 3600;
const sadness = Math.min(100, Math.floor(hoursSincePlayed * DECAY_RATE));
return 100 - sadness;
}
function getStatusEmbed(pet: Pet, userId: string): object {
const hunger = getHunger(pet);
const happiness = getHappiness(pet);
let healthStatus = '💚 Thriving';
let color = '#2ecc71';
if (hunger > 70 || happiness < 30) {
healthStatus = '💔 Critical';
color = '#e74c3c';
} else if (hunger > 40 || happiness < 60) {
healthStatus = '💛 Needs care';
color = '#f39c12';
}
const hungerBar = '█'.repeat(Math.floor((100 - hunger) / 10)) + '░'.repeat(Math.floor(hunger / 10));
const happyBar = '█'.repeat(Math.floor(happiness / 10)) + '░'.repeat(Math.floor((100 - happiness) / 10));
return {
title: `${pet.type} ${pet.name}`,
description: `**Status:** ${healthStatus}`,
color,
fields: [
{ name: '🍖 Fullness', value: `${hungerBar} ${100 - hunger}%`, inline: false },
{ name: '😊 Happiness', value: `${happyBar} ${happiness}%`, inline: false },
{ name: '📅 Adopted', value: `<t:${Math.floor(pet.adoptedAt / 1000)}:R>`, inline: true },
],
footer: { text: 'Use /pet feed and /pet play to care for your pet!' },
};
}
mee6.command(
'pet adopt',
{
description: 'Adopt a new pet',
options: [
{ name: 'name', type: 'string', description: "Your pet's name", required: true },
{
name: 'type',
type: 'string',
description: 'Type of pet',
required: true,
choices: PET_TYPES.map((t, i) => ({ name: t, value: String(i) })),
},
],
},
async (ctx) => {
const m = mee6.store.member(ctx.author.id);
const existing = await m.get<Pet>('pet');
if (existing) {
await ctx.reply({
content: `You already have ${existing.type} **${existing.name}**! Take care of them first.`,
ephemeral: true,
});
return;
}
const name = ctx.option<string>('name');
const typeIndex = parseInt(ctx.option<string>('type'));
const now = Date.now();
const pet: Pet = {
name,
type: PET_TYPES[typeIndex],
adoptedAt: now,
lastFed: now,
lastPlayed: now,
};
await m.set('pet', pet);
await ctx.reply({
content: `🎉 Congratulations! You adopted **${name}**!`,
embed: getStatusEmbed(pet, ctx.author.id),
});
}
);
mee6.command('pet feed', { description: 'Feed your pet' }, async (ctx) => {
const m = mee6.store.member(ctx.author.id);
const pet = await m.get<Pet>('pet');
if (!pet) {
await ctx.reply({ content: "You don't have a pet yet! Use `/pet adopt` first.", ephemeral: true });
return;
}
const now = Date.now();
const timeSinceFed = (now - pet.lastFed) / 1000;
if (timeSinceFed < FEED_COOLDOWN) {
const waitTime = Math.ceil(FEED_COOLDOWN - timeSinceFed);
await ctx.reply({
content: `🍖 **${pet.name}** is still full! Wait ${waitTime}s before feeding again.`,
ephemeral: true,
});
return;
}
pet.lastFed = now;
await m.set('pet', pet);
await ctx.reply({
content: `🍖 You fed **${pet.name}**! They're happy and full.`,
embed: getStatusEmbed(pet, ctx.author.id),
});
});
mee6.command('pet play', { description: 'Play with your pet' }, async (ctx) => {
const m = mee6.store.member(ctx.author.id);
const pet = await m.get<Pet>('pet');
if (!pet) {
await ctx.reply({ content: "You don't have a pet yet! Use `/pet adopt` first.", ephemeral: true });
return;
}
const now = Date.now();
const timeSincePlayed = (now - pet.lastPlayed) / 1000;
if (timeSincePlayed < PLAY_COOLDOWN) {
const waitTime = Math.ceil(PLAY_COOLDOWN - timeSincePlayed);
await ctx.reply({
content: `🎾 **${pet.name}** is tired! Wait ${waitTime}s before playing again.`,
ephemeral: true,
});
return;
}
pet.lastPlayed = now;
await m.set('pet', pet);
const activities = ['fetched a ball', 'did a trick', 'ran in circles', 'chased their tail', 'jumped around'];
const activity = activities[Math.floor(Math.random() * activities.length)];
await ctx.reply({
content: `🎾 You played with **${pet.name}**! They ${activity} and had a great time.`,
embed: getStatusEmbed(pet, ctx.author.id),
});
});
mee6.command('pet status', { description: 'Check on your pet' }, async (ctx) => {
const m = mee6.store.member(ctx.author.id);
const pet = await m.get<Pet>('pet');
if (!pet) {
await ctx.reply({ content: "You don't have a pet yet! Use `/pet adopt` first.", ephemeral: true });
return;
}
const hunger = getHunger(pet);
const happiness = getHappiness(pet);
let message = `Here's how **${pet.name}** is doing:`;
if (hunger > 70) {
message += '\n⚠️ Your pet is very hungry!';
}
if (happiness < 30) {
message += '\n⚠️ Your pet is very sad!';
}
await ctx.reply({
content: message,
embed: getStatusEmbed(pet, ctx.author.id),
});
});