Repository navigation
Installation and Setup
This page covers installation requirements, standard package managers (npm/pnpm/yarn/bun), local Git submodule installation, the Rust-style Submodule Resolver, and standalone local hosting for @m3rcena/weky.
-
Node.js:
>= 22.0.0(LTS 22, 24, 26). -
Discord.js:
^14.28.1 -
Rust Canvas:
@napi-rs/canvas(Used for blazingly fast high-resolution board rendering)
If you prefer standard package management via npm registry:
# npm
npm install @m3rcena/weky @napi-rs/canvas discord.js
# pnpm
pnpm add @m3rcena/weky @napi-rs/canvas discord.js
# yarn
yarn add @m3rcena/weky @napi-rs/canvas discord.js
# bun
bun add @m3rcena/weky @napi-rs/canvas discord.jsIf you prefer vendoring and hosting @m3rcena/weky locally via Git submodules rather than installing from the npm registry, @m3rcena/weky features a Rust/Cargo-inspired Submodule Resolver.
# Clone directly into your submodules/ or vendor/ directory
git submodule add https://github.com/M3rcena/m3rcena-weky.git submodules/m3rcena-weky
git submodule update --init --recursiveAdd this single line at the very top of your entry file (e.g. src/index.ts or bot.js):
import "@m3rcena/weky/register";Or pass it as a flag when executing Node / TSX:
# TSX
tsx -r @m3rcena/weky/register src/index.ts
# Node.js
node --import @m3rcena/weky/register dist/index.js-
Local-First Discovery: The resolver automatically scans standard vendor paths (
./submodules/m3rcena-weky,./vendor/m3rcena-weky,./packages/m3rcena-weky,./libs/m3rcena-weky). -
Transparent Interception: Patches module resolution so that
import { WekyManager } from '@m3rcena/weky'redirects seamlessly to your local submodule without changing your code. -
NPM Fallback: If the local submodule is removed, it automatically and silently falls back to standard
node_modules/@m3rcena/wekyfrom npm. -
Source vs Build: In TypeScript environments (
tsx,ts-node), it automatically loads TypeScript sources (src/index.ts) directly without requiring pre-compilation.
For instant IDE autocompletion directly from the local submodule sources:
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"paths": {
"@m3rcena/weky": [
"./submodules/m3rcena-weky/src",
"./submodules/m3rcena-weky/dist/index.mjs",
"./submodules/m3rcena-weky"
]
}
}
}💡 Tip: You can generate the exact paths object dynamically in Node by running:
import { generateTsConfigPaths } from "@m3rcena/weky/resolver"; console.log(generateTsConfigPaths());
You can optionally place an m3rcena.resolver.json in your project root to customize paths or prefer source mode:
{
"submodulesDir": "./submodules",
"preferSource": true,
"packages": {
"@m3rcena/weky": "./submodules/m3rcena-weky"
}
}Alternatively, override using environment variables:
export M3RCENA_WEKY_PATH="./submodules/m3rcena-weky"@m3rcena/weky can be hosted as an independent local microservice without a Discord bot connection!
Inside the submodule directory:
cd submodules/m3rcena-weky
npm install
npm run hostThis starts the Weky Headless Arcade Service on http://localhost:4001:
-
GET /health: Health status, version, and canvas engine diagnostics. -
GET /catalog: Metadata on all 17 minigames, player limits, and controls. -
GET /render/pokemon: Headless canvas rendering preview. -
POST /weky/*: Real-time session state machine routes.
For chat-based minigames (FastType, ChaosWords, GuessThePokemon), your bot requires MessageContent intent enabled in the Discord Developer Portal:
import { Client, GatewayIntentBits, Partials } from "discord.js";
import { WekyManager } from "@m3rcena/weky";
export const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent, // Required for chat-based minigame answers
GatewayIntentBits.GuildMessageTyping, // Optional: anti-cheat detection in FastType
],
partials: [Partials.Channel, Partials.Message],
});
export const weky = new WekyManager(client, {
embedColor: "#5865F2",
});GitHub: M3rcena/m3rcena-weky • NPM: @m3rcena/weky