Skip to content

Modules

Roj edited this page Aug 9, 2022 · 6 revisions

Installing a module

Reply the module file with the following command:

\install

⚠️ Disclaimer

Modules you install can have full control of your account. Please be sure that you are installing modules from a trusted source, like the Xor Modules Directory.

In case if something wrong happens, the Xor authors will not be responsible for your carelessness.

List all modules

\modules

Disabling modules

\disable mod1 mod2 mod3

Enabling modules

\enable mod1 mod2 mod3

Uninstalling modules

\uninstall mod1 mod2 mod3

Writing modules

A Xor module is a TypeScript file that exports a set of message handlers and a unique name. Any developer can write them easily.

Here’s an simple example:

import { CommandHandler, type Module } from "$xor";

const hello: Module = {
  name: "hello",
  handlers: new CommandHandler(
    "hello",
    async ({ event }) => {
      await event.message.reply({ message: "Hello you!" });
    },
  ),
};

export default hello;

For more information on handlers and types, please refer to the source code for now.

Clone this wiki locally