1.0.0 • Published 7 years ago
@kcp/functions v1.0.0
Functions
A simple Klasa plugin which adds reloadable functions to your Klasa Bot
How To Use
- Install the plugin.
npm i @kcp/functions
# If you use yarn
yarn add @kcp/functions- Use
@kcp/functionsin your client.
const { Client } = require("klasa");
Client.use(require("@kcp/functions"));
new Client({ aliasFunctions: { returnMethod: "run", prefix: "funcs", enabled: true } }).login("Your Beautiful Token");If you use TypeScript
import { Client } from 'klasa';
import { Client as FunctionsClient } from '@kcp/functions';
Client.use(FunctionsClient);
new Client({ aliasFunctions: { returnMethod: "run", prefix: "funcs", enabled: true } }).login("Your Beautiful Token");- Create a new
functionin yourfunctionsfolder with the name you want to access later, for exampletest.jsortest.ts.
const { Function } = require("@kcp/functions");
module.exports = class extends Function {
run() {
// Your Code Here
}
}- Use these functions in your bot.
this.client.funcs.test();- ???... Enjoy!
Tips
- To allow multiple functions in a file so you can do something like
this.client.funcs.utils.toTitleCase(string)instead of using 1 file per function remove thereturnMethod.
License
This project is under the MIT license.
1.0.0
7 years ago