Mallard
Donate Dashboard

JavaScript automation for Discord

Your Discord bot, built your way.

Write commands, automate your server, and connect the services you use—all from one dashboard. No bot hosting required.

Free to startJavaScript & TypeScript84 triggers
Mallard Studiodashboard / scripts
Write and configure scripts in Studio. Click to enlarge.
The Studio workspace showing a moderation script, file explorer, and slash command settings.

How it works

From event to action.

Choose what starts a script, write the behavior, and let Mallard run it for your server.

  1. 01

    Choose a trigger

    A Discord command, a stream going live, a webhook, or a new feed item.

  2. 02

    Write or adapt

    Use Studio to edit a starter script or template, with autocomplete for Mallard’s API.

  3. 03

    Run on your server

    Save your script, then inspect its runs and errors in the dashboard.

Built for server owners who code

Everything you need to build and run custom automations without DevOps or hosting overhead.

⚡ Your code, no hosting Write scripts in Studio, then save them to run on your server under per-server budgets.
🗄️ Data that stays Store settings and state in your server's key-value database, or build rankings with sorted sets.
📡 More than Discord React to Twitch and YouTube events, incoming webhooks, and new items in RSS or Atom feeds.
🔬 See what happened Inspect execution traces, console logs, and follow every change in the audit history.

More than a script editor

Connect services and build forms alongside your scripts. Here’s what that looks like in the dashboard.

dashboard / integrations

Connect your services

Link streaming channels, follow feeds, receive webhooks, and configure AI from the dashboard.

The Integrations page showing Twitch, YouTube, incoming webhooks, RSS feeds, and OpenRouter AI.
dashboard / forms

Forms for your community

Build public forms with a live preview, collect responses, and run scripts when someone submits.

The form editor with settings and a live preview of a community feedback form.
Built in

Connect the services your community uses

Connect services from the dashboard, then decide what happens in your scripts. Streaming events, incoming requests, feeds, and AI each have their own place in Mallard.

Twitch
Available

React to streams, channel updates, raids, and more. Chat and some viewer events require an authorized Twitch account.

TwitchStreamOnline TwitchRaid
YouTube
Available

Follow channels for video and live stream events, including updates and deletions. Filter Shorts with ctx.youtube.isShort.

YouTubeVideoPublished YouTubeStreamOnline
Incoming webhooks Available

Give a script a URL for GitHub, Ko-fi, Stripe, Patreon, or your own service. Optional signature checks help verify supported senders.

IncomingWebhookLearn more →
RSS & Atom feeds Available

Follow blogs, subreddits, GitHub releases, podcasts, and other feeds. New items trigger scripts on a regular polling schedule.

OpenRouter AI Available

Add your OpenRouter key to use AI in scripts and Ask Mallard, the dashboard assistant. Keys are write-only and aren't exposed to scripts.

free for every server; limits may change as usage grows

What a script looks like

Plain JavaScript against a small API. Discord actions, an HTTP client, per-guild storage, and native AI and streaming integrations.

attachments.js

Catch attachment spam automatically

MessageCreate
// Count messages containing attachments, not ordinary text messages
if (ctx.message.attachments.length === 0) return;

const key = `imgspam.${ctx.message.authorId}`;
const recent = JSON.parse(await getKV(key, { lock: true }) || "[]")
    .filter(e => Date.now() - e.timestamp < 10000);
recent.push({ messageId: ctx.message.id, timestamp: Date.now() });

if (recent.length >= 3) {
    await deleteKV(key);
    const target = await ctx.guild.members.fetch(ctx.message.authorId);
    if (target) await target.timeout(1440 * 60000, "Attachment spam");
    if (ctx.env.mod_alert_channel_id) {
        await discord.channels.createMessage(ctx.env.mod_alert_channel_id, "🖼️ Timed out for attachment spam. Please review.");
    }
} else {
    await setKV(key, JSON.stringify(recent), 60);
}
Discord Outcome // what happens in your server
spammer
posting repeat image attachments...
MallardBOT
🖼️ Timed out for attachment spam. Please review.
ai-summary.js

Summarize recent chat with AI

SlashCommand
// OpenRouter AI is configured on the Integrations page, so scripts
// call aiChat() directly without exposing any API keys
const chat = (await getMessages(ctx.channelId, 100)).reverse()
    .map(function (m) { return m.authorDisplayName + ": " + m.content; })
    .join("\n");

const res = await aiChat("Summarize this chat:\n" + chat, {
    model: "google/gemini-3.5-flash-lite"
});
await ctx.interaction.editReply(res.content);
Discord Outcome // what happens in your server
Moderator
/summarize
MallardBOT
Summary of last 100 messages: The server discussed moving from MEE6 to Mallard, tested reaction roles, and configured Twitch announcements.
golive.js

Announce when you go live

TwitchStreamOnline
// Twitch events arrive as triggers just like Discord ones
if (ctx.env.twitch_announce_channel_id) {
    await discord.channels.createMessage(ctx.env.twitch_announce_channel_id, {
        embeds: [{
            title: "🔴 Live now: " + ctx.twitch.title,
            description: "Playing " + ctx.twitch.category
                + " at twitch.tv/" + ctx.twitch.broadcasterLogin
        }]
    });
}
Discord Outcome // what happens in your server
MallardBOT
🔴 Live now: Building custom Discord bots in JS! Playing Software and Game Development at twitch.tv/mallarddev
youtube-announcer.js

Post YouTube uploads automatically

YouTubeVideoPublished
// Fires on upload without RSS polling. ctx.youtube gives you title, url, etc.
if (ctx.youtube.isShort) return; // Skip YouTube Shorts if desired

await discord.channels.createMessage(ctx.env.yt_announce_channel_id || ctx.channelId,
    `📺 New video from **${ctx.youtube.channelTitle}**: **${ctx.youtube.title}**\n${ctx.youtube.url}`);
Discord Outcome // what happens in your server
MallardBOT
📺 New video from **DougDoug**: **We cloned our voices with AI and had them argue** https://www.youtube.com/watch?v=dQw4w9WgXcQ

Browse the full template library

Start with what you need

Install the bot, explore the starter scripts, and customize them as your server grows. Add new commands in JavaScript whenever you're ready. The docs cover every trigger and function.

Mallard is free forever. If you'd like to help with hosting, you can buy me a coffee.

Questions, or want to see what other servers are running? The support server has a scripts hub.