Build a word chain game in a channel I choose: each word must start with the last letter of the previous one, no word twice, nobody twice in a row, and a wrong word resets the chain and posts the record
Word Chain is a collaborative word game for your server.
Post words in the designated word chain channel. Each word must:
Break any rule and the chain resets! The longest chain is saved as the record.
/chain — Check the current chain status and recordSet a dedicated channel for the word chain game in the creation settings.
Made by MEE6. Remix it to get a copy of your own and change anything you like.
dragon must start with E
5
5
tree must start with R
3
5
// Word Chain game — keep a chain going with words that start with the last letter
mee6.settings({
chain_channel: {
type: 'channel',
label: 'Word chain channel',
required: true,
sample: 'word-chain',
},
});
interface Chain {
words: string[]; // words in the chain
lastUserId: string; // who said the last word
record: number; // longest chain ever
}
// Only messages in the chain channel wake the module (none while it is not set)
mee6.on('message', { channels: [mee6.setting('chain_channel')] }, async (ctx) => {
const word = ctx.message.content.trim().toLowerCase();
// Must be a single word, letters only
if (!word || !/^[a-z]+$/.test(word)) return;
const m = mee6.store.member(ctx.author.id);
const chain = await mee6.store.get<Chain>('chain', {
words: [],
lastUserId: '',
record: 0,
});
// First word of a new chain
if (chain.words.length === 0) {
chain.words = [word];
chain.lastUserId = ctx.author.id;
await mee6.store.set('chain', chain);
await ctx.react('✅');
return;
}
// Check rules
const lastWord = chain.words[chain.words.length - 1];
const expectedLetter = lastWord[lastWord.length - 1];
const violations: string[] = [];
// Rule 1: Must start with the last letter of the previous word
if (word[0] !== expectedLetter) {
violations.push(`must start with **${expectedLetter.toUpperCase()}**`);
}
// Rule 2: No word twice
if (chain.words.includes(word)) {
violations.push('already used');
}
// Rule 3: Nobody twice in a row
if (ctx.author.id === chain.lastUserId) {
violations.push("can't go twice in a row");
}
// If any rule broken, reset and announce
if (violations.length > 0) {
const chainLength = chain.words.length;
const wasRecord = chainLength > chain.record;
if (wasRecord) {
chain.record = chainLength;
}
await ctx.react('❌');
await ctx.reply({
embed: {
title: '💥 Chain broken!',
description: `**${word}** ${violations.join(', ')}`,
fields: [
{ name: 'Chain length', value: `${chainLength}`, inline: true },
{ name: 'Record', value: `${chain.record}`, inline: true },
],
color: '#e74c3c',
footer: { text: `Last word was "${lastWord}" — start a new chain with any word!` },
},
});
// Reset chain
chain.words = [];
chain.lastUserId = '';
await mee6.store.set('chain', chain);
return;
}
// Valid word — add to chain
chain.words.push(word);
chain.lastUserId = ctx.author.id;
await mee6.store.set('chain', chain);
await ctx.react('✅');
// Every 10 words, show progress
if (chain.words.length % 10 === 0) {
await ctx.reply({
embed: {
title: '🔥 Chain growing!',
description: `**${chain.words.length}** words so far`,
fields: [{ name: 'Record', value: `${chain.record}`, inline: true }],
color: '#2ecc71',
footer: { text: `Next word must start with ${word[word.length - 1].toUpperCase()}` },
},
});
}
});
// Command to check current status
mee6.command('chain', { description: 'Check the word chain status' }, async (ctx) => {
const channelId = ctx.settings.chain_channel;
if (!channelId) {
await ctx.reply('No word chain channel is set yet — an admin can choose one in the dashboard.');
return;
}
const chain = await mee6.store.get<Chain>('chain', {
words: [],
lastUserId: '',
record: 0,
});
if (chain.words.length === 0) {
await ctx.reply({
embed: {
title: '🔗 Word Chain',
description: `Post a word in <#${channelId}> to start a new chain!`,
fields: [{ name: 'Record', value: `${chain.record}`, inline: true }],
color: '#3498db',
},
});
return;
}
const lastWord = chain.words[chain.words.length - 1];
const nextLetter = lastWord[lastWord.length - 1].toUpperCase();
const recent = chain.words.slice(-5).join(' → ');
await ctx.reply({
embed: {
title: '🔗 Word Chain',
description: `Chain is **${chain.words.length}** words long`,
fields: [
{ name: 'Recent words', value: recent },
{ name: 'Next letter', value: nextLetter, inline: true },
{ name: 'Record', value: `${chain.record}`, inline: true },
],
color: '#2ecc71',
footer: { text: `Playing in #${channelId}` },
},
});
});