Customizing GramUS.
GramUS can be customized with modules. GramUS modules are JavaScript files hosted in a GitHub repository, which includes some handlers that will be added to a GramUS instance after they are installed. A GramUS module can be written by you or someone else, in either JavaScript or TypeScript. But if one writes a module in TypeScript, they should build it to JavaScript before it works and gets published.
The goal of this repository is to collect useful modules for you (and by you). Anyone can add their modules to here by sending a PR.
For installing modules in a GramUS instance, simply use the .update
command with the following syntax:
.update <user>/<repo>/<module_name>(/<branch>)
1️⃣ The < and > signs are just to tell you that the value can change, they should not be included when using the command.
2️⃣ Arguments inside ( and ) are optional.
- Clone the GramUS repository:
git clone https://github.com/gramus/gramus
- Open the cloned folder with an editor.
- Create a new file named
hello.ts
in thesrc/handlers
folder with the following code:
import { CommandHandler } from "../userbot";
export default new CommandHandler(
async (client, event) => {
await event.message.reply({ message: "world!" });
},
{ commands: "hello" }
);
- Run your bot, and try if it works.
- Find your handler's compiled JavaScript file in the
dist
folder and fix the imports from other directories, for example replace../userbot
with../dist/userbot
. - Upload it to a GitHub repository in a folder with the same name of your handler file without
.js
. - Install it with the instruction above.