Skip to content
GitHub

Example bots

MeoCord 4.3

Whole bots built with MeoCord, what each one shows and where the Guide teaches it, and how to run one.

Before this

The MeoCord examples repository holds whole bots, each created as a new app and grown from there. The Guide's examples show one piece at a time; a bot shows the pieces working together, with its tests. Every bot is tested on each change and daily, with the meocord version its lockfile pins and with the newest release, so a release that breaks one shows up there first.

Feedback

A feedback form a server's staff approve or reject. /feedback opens a form, once every five minutes for each member. A submitted form is posted to a review channel with Approve and Reject buttons, which only members with the staff role can use. A verdict marks the post, removes its buttons, and tells the author by direct message.

feedback/ on GitHub

Besides its token, the bot needs a staff role, and a channel for reviews where it has View Channel, Send Messages and Embed Links, since each review is posted as an embed. Their IDs go in .env as STAFF_ROLE_ID and FEEDBACK_CHANNEL_ID, and the bot stops as it starts if either is missing or isn't an ID. Feedback is kept in memory, so a restart forgets it, and a review button left from before the restart says the feedback is gone.

Moderation

Warnings, timeouts and bans for a server's moderators, with every case logged in SQLite. /mod warn records a warning at once; /mod timeout and /mod ban ask the moderator to confirm first, privately, and act only on Confirm. /mod case shows a case and completes its number as you type, and the Apps menu lists a member's cases or warns a message's author. Every action needs Moderate Members, a ban Ban Members too, and a moderator can act only on members ranked below both them and the bot.

moderation/ on GitHub

Besides its token, the bot needs Moderate Members and Ban Members, and its role above the members it moderates. MODERATION_DB in .env sets where the case log is kept, moderation.db in the working directory unless set. The case log uses node:sqlite, which ships with Node.js; on Node.js 22 it prints one experimental-feature warning as the bot starts.

Running a bot

Every bot runs the same way, on Node.js 22.13 or later. It needs a bot token from the Discord Developer Portal, and the bot invited to a server with the bot and applications.commands scopes.

git clone https://github.com/meocord/examples.git
cd examples/feedback
npm ci
cp .env.example .env
npm run start:dev
git clone https://github.com/meocord/examples.git
cd examples/feedback
bun ci
cp .env.example .env
bun run start:dev
git clone https://github.com/meocord/examples.git
cd examples/feedback
pnpm install --frozen-lockfile
cp .env.example .env
pnpm start:dev
git clone https://github.com/meocord/examples.git
cd examples/feedback
yarn install --immutable
cp .env.example .env
yarn start:dev

Set DISCORD_TOKEN and the bot's own settings in .env, which git ignores; never commit a token. The token and the test server covers .env and DEV_GUILD_ID. npm run start:dev watches the code, rebuilding and restarting the bot on each change. npm test runs the bot's tests with mock interactions, with no Discord connection or token, and npm run build:prod followed by npm start runs it as it runs in production.