Skip to content

Weky Overview

M3rcena edited this page Nov 5, 2026 · 3 revisions

๐ŸŽฎ @m3rcena/weky Overview & Core Architecture

@m3rcena/weky (v14.28.1) is the modern minigames and arcade engine for Discord.js v14 bots and web applications.


๐Ÿ—๏ธ Core Architecture

                       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                       โ”‚          WekyManager           โ”‚
                       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                       โ”‚
     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
     โ–ผ                  โ–ผ              โ–ผ              โ–ผ                  โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Minigames(17)โ”‚ โ”‚Arcade Suite  โ”‚ โ”‚Canvas Hubโ”‚ โ”‚ContextAdapter โ”‚ โ”‚  WekyBridge   โ”‚
โ”‚ 2048, Snake, โ”‚ โ”‚Hub, Tourney, โ”‚ โ”‚@napi-rs/ โ”‚ โ”‚Slash, Prefix, โ”‚ โ”‚Headless REST, โ”‚
โ”‚ Fight, etc.  โ”‚ โ”‚AI, Brackets  โ”‚ โ”‚canvas    โ”‚ โ”‚Components V2  โ”‚ โ”‚WebSocket Sync โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿš€ Initializing WekyManager

WekyManager is the central orchestrator that attaches to your Discord Client and coordinates lifecycle telemetry, audio dispatching, and bridge state synchronization:

import { Client } from "discord.js";
import { WekyManager } from "@m3rcena/weky";
import { M3rcenaBridge } from "@m3rcena/bridge";

// Optional: Connect to shared dashboard bridge
const bridge = new M3rcenaBridge();

export const weky = new WekyManager(client, {
  bridge,                                   // Attach to Bridge for web dashboard crossplay
  embedColor: "#5865F2",                    // Default brand accent color
  defaultTimeout: 120_000,                  // Inactivity timeout in ms (2 minutes)
  unauthorizedMessage: "โ›” You cannot interact with this game!",
  notifyUpdates: true,                      // Prints banner when new version is available
});

๐Ÿ“ก Lifecycle Events

WekyManager extends Node's EventEmitter, broadcasting strongly-typed lifecycle events:

// Game Started
weky.on("gameStart", (data) => {
  console.log(`๐Ÿ•น๏ธ [Weky] Started: ${data.game} in channel ${data.channelId}`);
});

// Game Over / Concluded
weky.on("gameOver", (data) => {
  console.log(`๐Ÿ [Weky] Over: ${data.game} | Outcome: ${data.outcome} | Score: ${data.score}`);
});

// Game Error
weky.on("gameError", (data) => {
  console.error(`โŒ [Weky] Error in ${data.game}:`, data.error);
});

// Unauthorized User Attempted Click
weky.on("unauthorizedClick", (data) => {
  console.warn(`โ›” [Weky] ${data.user.username} tried interacting with ${data.game}`);
});

๐Ÿ”„ The Universal ContextAdapter

@m3rcena/weky minigames work identically with Slash Command Interactions (ChatInputCommandInteraction), Button Interactions, Select Menus, or legacy Prefix Messages (Message).

The internal ContextAdapter normalizes replies, ephemeral messages, edits, and component updates automatically:

// 1. With Slash Command
client.on("interactionCreate", async (interaction) => {
  if (interaction.isChatInputCommand() && interaction.commandName === "play2048") {
    new Game2048(weky, { context: interaction }).start();
  }
});

// 2. With Prefix Message
client.on("messageCreate", async (message) => {
  if (message.content.startsWith("!2048")) {
    new Game2048(weky, { context: message }).start();
  }
});

๐ŸŽจ Discord Components V2 Integration

Every minigame in @m3rcena/weky v14.28.1 utilizes Discord's Components V2 containers (ContainerBuilder with type 17 and MessageFlags.IsComponentsV2).

Key Benefits:

  • Visual accent borders matching your bot's color scheme.
  • Media galleries (MediaGalleryBuilder) for clean canvas board rendering.
  • Interactive action rows with buttons, select menus, and modals.
  • Zero deprecation warnings on Discord.js v14.

Clone this wiki locally