Skip to content

Repository files navigation

functions

Simple Klasa plugin that adds a functions store

How To Use

  1. Install the plugin.
npm i @kcp/functions
# If you use yarn
yarn add @kcp/functions
  1. Use @kcp/functions in your client.
const{ Client }=require("klasa");Client.use(require("@kcp/functions"));newClient({aliasFunctions: {returnMethod: "run",prefix: "funcs",enabled: true}}).login("Your Beautiful Token");

If you use TypeScript

import{Client}from'klasa';import{ClientasFunctionsClient}from'@kcp/functions';Client.use(FunctionsClient);newClient({aliasFunctions: {returnMethod: "run",prefix: "funcs",enabled: true}}).login("Your Beautiful Token");
  1. Create a new function in your functions folder with the name you want to access later, for example test.js or test.ts.
const{ Function }=require("@kcp/functions");module.exports=classextendsFunction{run(){// Your Code Here}}
  1. Use these functions in your bot.
this.client.funcs.test();
  1. ???... 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 the returnMethod.

License

This project is under the MIT license.

About

Simple plugin that adds reloadable functions to your Klasa Bot.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages