Add /rulespanel which posts the server's rules and info as one Components V2 layout card in a channel from settings: a banner picture in a gallery at the top (a URL from settings, or one drawn with mee6.draw from the server name and icon when none is set), a # heading with an intro (the server icon as a thumbnail beside it), the rules from a list setting as numbered text blocks, separators, a few info sections from another list, up to five link buttons (website, socials) from a list setting, and a -# small print footer with the last update date. Only a staff role from settings can run it, and running it again edits the existing card in place instead of posting a new one. Check Discord's 4000-character limit before sending.
The rules-and-info post every server pins, built with Discord's new message layouts: a banner, a big welcome heading, your rules as a numbered list, a few info sections, link buttons to your website and socials, and small print with the date it was last updated.
How to use:
/rulespanel to post the card/rulespanel again: the same card is edited in place, no second post and no lost linkMade by MEE6. Remix it to get a copy of your own and change anything you like.
We're glad you're here! Take a minute to read the rules: they keep this place friendly for everyone.
1. Be respectful No harassment, hate speech or personal attacks. Disagree with ideas, not people.
2. Keep it safe for work No NSFW, gore or shock content — in messages, names or avatars.
3. No spam or self-promotion No floods, mass mentions or ads. Ask staff before sharing your own server.
4. Use the right channel Keep each topic where it belongs; the channel descriptions say what goes where.
5. Follow Discord's rules Discord's Terms of Service and Community Guidelines apply here too.
6. Staff have the final word Questions about a decision? Ask a moderator in private, not in public channels.
Mention a moderator or ask in the help channel. Please don't DM staff out of the blue.
Choose the pings you care about in the roles channel.
By staying on this server you agree to these rules. Last updated October 12, 2026
Posted the rules card in #rules.
Updated the rules card in #rules.
// Rules panel: the server's rules and info as one card — a banner, a heading,
// numbered rules, a few info sections, link buttons and small print. Everything
// comes from the settings, and running /rulespanel again updates the same card.
interface Rule {
title: string | null;
details: string | null;
}
interface InfoSection {
title: string | null;
text: string | null;
}
interface Link {
label: string | null;
url: string | null;
}
interface PanelRef {
channelId: string;
messageId: string;
}
const DEFAULT_COLOR = '#5865F2';
// Discord's limit for the text of one layout message, every block together.
const MAX_TEXT = 4000;
const URL_RE = /^https?:\/\/\S+$/i;
mee6.settings({
staff_role: {
type: 'role',
label: 'Who can post the panel',
description: 'Members with this role, and the server owner, can run /rulespanel.',
required: true,
sample: 'Staff',
},
channel: {
type: 'channel',
label: 'Panel channel',
description: 'Where the rules card lives.',
required: true,
sample: 'rules',
},
title: {
type: 'string',
label: 'Heading',
description: 'Leave empty for "Welcome to" and your server name.',
default: '',
},
intro: {
type: 'string',
label: 'Intro',
default: "We're glad you're here! Take a minute to read the rules: they keep this place friendly for everyone.",
},
rules: {
type: 'list',
label: 'Rules',
description: 'Numbered in this order.',
maxItems: 10,
fields: {
title: { type: 'string', label: 'Rule', required: true },
details: { type: 'string', label: 'Details' },
},
default: [
{
title: 'Be respectful',
details: 'No harassment, hate speech or personal attacks. Disagree with ideas, not people.',
},
{ title: 'Keep it safe for work', details: 'No NSFW, gore or shock content — in messages, names or avatars.' },
{
title: 'No spam or self-promotion',
details: 'No floods, mass mentions or ads. Ask staff before sharing your own server.',
},
{
title: 'Use the right channel',
details: 'Keep each topic where it belongs; the channel descriptions say what goes where.',
},
{
title: "Follow Discord's rules",
details:
"Discord's [Terms of Service](https://discord.com/terms) and [Community Guidelines](https://discord.com/guidelines) apply here too.",
},
{
title: 'Staff have the final word',
details: 'Questions about a decision? Ask a moderator in private, not in public channels.',
},
],
},
info: {
type: 'list',
label: 'Info sections',
description: 'Short sections under the rules: where to get help, roles, events…',
maxItems: 4,
fields: {
title: { type: 'string', label: 'Heading', required: true },
text: { type: 'string', label: 'Text', required: true },
},
default: [
{
title: '🆘 Need help?',
text: "Mention a moderator or ask in the help channel. Please don't DM staff out of the blue.",
},
{ title: '🎭 Pick your roles', text: 'Choose the pings you care about in the roles channel.' },
],
},
links: {
type: 'list',
label: 'Link buttons',
description: 'Up to 5 buttons under the card: your website, socials, an invite… Each URL starts with https://.',
maxItems: 5,
fields: {
label: { type: 'string', label: 'Label', required: true },
url: { type: 'string', label: 'URL', required: true },
},
default: [],
sample: [
{ label: 'Website', url: 'https://example.com' },
{ label: 'YouTube', url: 'https://www.youtube.com' },
{ label: 'Twitch', url: 'https://www.twitch.tv' },
],
},
show_banner: { type: 'boolean', label: 'Show a banner', default: true },
banner: {
type: 'string',
label: 'Banner picture URL',
description: "A wide picture shown at the top (https). Leave empty for a banner drawn with your server's name.",
default: '',
},
footer: {
type: 'string',
label: 'Small print',
default: 'By staying on this server you agree to these rules.',
},
color: { type: 'string', label: 'Card colour', description: 'A hex colour such as #5865F2.', default: DEFAULT_COLOR },
});
function cardColor(raw: unknown): string {
const value = String(raw ?? '').trim();
return /^#?[0-9a-f]{6}$/i.test(value) ? (value.startsWith('#') ? value : `#${value}`) : DEFAULT_COLOR;
}
function clean(raw: unknown): string {
return String(raw ?? '').trim();
}
// A banner in the card's colour with the server's name, for a server that has
// no picture of its own yet.
async function drawnBanner(name: string, iconUrl: string, color: string): Promise<string> {
const layers: Record<string, unknown>[] = [
// A few soft discs for depth, then a darker band along the bottom.
{ type: 'rect', x: 880, y: 24, width: 280, height: 280, radius: 140, color: '#FFFFFF', opacity: 9 },
{ type: 'rect', x: 1050, y: 190, width: 110, height: 110, radius: 55, color: '#FFFFFF', opacity: 12 },
{ type: 'rect', x: 40, y: 150, width: 150, height: 150, radius: 75, color: '#FFFFFF', opacity: 7 },
{ type: 'rect', x: 0, y: 300, width: 1200, height: 100, color: '#000000', opacity: 22 },
{
type: 'text',
text: 'RULES & INFO',
x: 0,
y: 300,
width: 1200,
height: 100,
size: 28,
font: 'ginto',
align: 'center',
valign: 'middle',
},
];
if (iconUrl) {
layers.push(
{ type: 'image', src: iconUrl, x: 90, y: 60, width: 180, height: 180, circle: true, border: '#FFFFFF' },
{
type: 'text',
text: name,
x: 310,
y: 60,
width: 820,
height: 180,
size: 72,
font: 'ginto',
weight: 'bold',
valign: 'middle',
shadow: true,
}
);
} else {
layers.push({
type: 'text',
text: name,
x: 60,
y: 60,
width: 1080,
height: 180,
size: 72,
font: 'ginto',
weight: 'bold',
align: 'center',
valign: 'middle',
shadow: true,
});
}
return await mee6.draw({ width: 1200, height: 400, background: color, layers });
}
function textLength(blocks: LayoutBlock[]): number {
let total = 0;
for (const block of blocks) {
if (block.type === 'text') total += block.text.length;
else if (block.type === 'section') total += [block.text].flat().join('').length;
else if (block.type === 'container') total += textLength(block.blocks);
}
return total;
}
mee6.command('rulespanel', { description: 'Post or update the rules and info card', ephemeral: true }, async (ctx) => {
const staff = ctx.settings.staff_role as string | null;
if (!staff) {
await ctx.reply('Choose who can post the panel in the dashboard settings first.');
return;
}
// The server owner may always post it, staff role or not
if (!ctx.author.roles.includes(staff) && ctx.author.id !== (await mee6.guild()).ownerId) {
await ctx.reply(`Only <@&${staff}> can post the rules panel.`);
return;
}
const channelId = ctx.settings.channel as string | null;
if (!channelId) {
await ctx.reply('No panel channel is set yet — an admin can choose one in the dashboard.');
return;
}
const guild = await mee6.guild();
const color = cardColor(ctx.settings.color);
const notes: string[] = [];
const blocks: LayoutBlock[] = [];
if (ctx.settings.show_banner) {
const banner = clean(ctx.settings.banner);
if (banner && URL_RE.test(banner)) {
blocks.push({ type: 'gallery', items: [{ url: banner, description: `${guild.name} banner` }] });
} else {
if (banner) notes.push('The banner URL is not a link (https://…), so a drawn banner stands in.');
blocks.push({ type: 'gallery', items: [await drawnBanner(guild.name, guild.iconUrl, color)] });
}
}
const title = clean(ctx.settings.title) || `Welcome to ${guild.name}`;
const intro = clean(ctx.settings.intro);
const heading = intro ? `# ${title}\n${intro}` : `# ${title}`;
// The server icon beside the heading when it has one, small, as a logo.
blocks.push(
guild.iconUrl ? { type: 'section', text: heading, thumbnail: guild.iconUrl } : { type: 'text', text: heading }
);
const rules = ((ctx.settings.rules as Rule[]) ?? []).filter((rule) => clean(rule.title));
if (rules.length) {
blocks.push({ type: 'separator', spacing: 'large' }, { type: 'text', text: '## 📜 Rules' });
rules.forEach((rule, i) => {
const details = clean(rule.details);
blocks.push({ type: 'text', text: `**${i + 1}. ${clean(rule.title)}**${details ? `\n${details}` : ''}` });
});
}
const info = ((ctx.settings.info as InfoSection[]) ?? []).filter((section) => clean(section.title));
if (info.length) {
blocks.push({ type: 'separator', spacing: 'large' });
for (const section of info)
blocks.push({ type: 'text', text: `### ${clean(section.title)}\n${clean(section.text)}` });
}
const links = ((ctx.settings.links as Link[]) ?? []).filter((link) => clean(link.label) && clean(link.url));
const usable = links.filter((link) => URL_RE.test(clean(link.url)));
if (usable.length < links.length)
notes.push(`${links.length - usable.length} link(s) left out: a URL must start with https://.`);
blocks.push({ type: 'separator' });
if (usable.length) {
blocks.push({
type: 'buttons',
buttons: usable
.slice(0, 5)
.map((link) => ({ label: clean(link.label).slice(0, 80), style: 'link', url: clean(link.url) })),
});
}
const footer = clean(ctx.settings.footer);
const updated = `Last updated <t:${Math.floor(Date.now() / 1000)}:D>`;
blocks.push({ type: 'text', text: footer ? `-# ${footer}\n-# ${updated}` : `-# ${updated}` });
const layout: LayoutBlock[] = [{ type: 'container', color, blocks }];
const length = textLength(layout);
if (length > MAX_TEXT) {
await ctx.reply(
`The card would hold ${length} characters of text and Discord allows ${MAX_TEXT} per message. Shorten a few rules or sections in the dashboard, then run /rulespanel again.`
);
return;
}
const payload = { layout };
const saved = await mee6.store.get<PanelRef | null>('panel', null);
let verb = 'Posted';
let where: PanelRef;
if (saved && saved.channelId === channelId && (await mee6.getMessage(saved.channelId, saved.messageId))) {
// Same channel, card still there: edit it, so its link and its place stay.
await mee6.editMessage(saved.channelId, saved.messageId, payload);
verb = 'Updated';
where = saved;
} else {
if (saved && saved.channelId !== channelId) {
// The panel moved channel: the old card goes, rather than two versions of the rules.
try {
await mee6.deleteMessage(saved.channelId, saved.messageId);
} catch {
mee6.log('the previous rules card could not be deleted; it may already be gone');
}
}
const sent = await ctx.send(channelId, payload);
where = { channelId: sent.channelId, messageId: sent.messageId! };
await mee6.store.set('panel', where);
}
await ctx.reply([`${verb} the rules card in <#${where.channelId}>.`, ...notes].join('\n'));
});