Pin any message that gets 10 ๐ reactions, and unpin it if the reactions drop back below 10
Automatic message pinning based on community voting.
React with ๐ to any message โ when it reaches the threshold (default: 10 reactions), it's automatically pinned. If the reactions drop back below the threshold, it's unpinned.
Configuration:
Members can vote on what's important by adding ๐ reactions. The bot handles pinning and unpinning automatically.
Made by MEE6. Remix it to get a copy of your own and change anything you like.
// Automatically pin messages that reach the reaction threshold
mee6.settings({
threshold: {
type: 'integer',
label: 'Reactions needed to pin',
default: 10,
sample: 10,
},
});
// Track when reactions are added
// Only ๐ reactions wake the module
mee6.on('reaction_add', { emoji: ['๐'] }, async (ctx) => {
const threshold = ctx.settings.threshold ?? 10;
// Fetch the message to check total reaction count
const message = await ctx.fetchMessage();
if (!message) return;
// Count ๐ reactions on this message
const pinCount = message.reactions?.find((r) => r.emoji === '๐')?.count ?? 0;
// Pin if we've reached the threshold and message isn't already pinned
if (pinCount >= threshold && !message.pinned) {
await ctx.pin();
mee6.log(`Pinned message ${message.id} with ${pinCount} ๐ reactions`);
}
});
// Track when reactions are removed
mee6.on('reaction_remove', { emoji: ['๐'] }, async (ctx) => {
const threshold = ctx.settings.threshold ?? 10;
// Fetch the message to check current reaction count
const message = await ctx.fetchMessage();
if (!message) return;
// Count ๐ reactions on this message
const pinCount = message.reactions?.find((r) => r.emoji === '๐')?.count ?? 0;
// Unpin if we've dropped below threshold and message is currently pinned
if (pinCount < threshold && message.pinned) {
await ctx.unpin();
mee6.log(`Unpinned message ${message.id} - now ${pinCount} ๐ reactions`);
}
});