Closed KnorpelSenf closed 1 year ago
// bot.ts import { Bot } from "https://deno.land/x/grammy@v1.13.1/mod.ts"; import { distribute, run } from "./mod.ts"; // Create bot const bot = new Bot("token"); // Add the usual middleware, yada yada bot.command("start", (ctx) => ctx.reply("Got your message.")); bot.use(distribute("./worker.ts")); // Run it concurrently! run(bot);
// worker.ts import { BotWorker } from "./mod.ts"; const bot = new BotWorker("token"); bot.on("message", (ctx) => ctx.reply("yay!"));
Closes #6.
Should probably add a protection against doing run(worker).
run(worker)
Perhaps we should extract this into a separate plugin? That way, we could keep the runner free of deps
Closes #6.