Giter Club home page Giter Club logo

revolthandler.js's Introduction

revolthandler.js

Description

Easy command handling for revolt.js

Table of contents

Warn

This version work with [email protected]

About

command handler for revolt.js bot project

Badges

NPM Downloads

Install

npm i revolthandler.js

Example

Setup

CommonJS

const revolt = require("revolt.js");
const client = new revolt.Client();
const revoltHandler = require("revolthandler.js");
const handler = new revoltHandler.Handler({
  client: client, //required
  prefix: "!", //required
  owners: ["Your Revolt ID"], //required , optional add more owner Id
  path: "./commands", //optional, (default : "./commands")
});
client.once("ready", () => {
  handler.start();
});
client.loginBot("YOUR_BOT_TOKEN_HERE");

EsModule

//...
import { Handler } from "revolthandler.js";
const handler = new Handler({
  client: client, //required
  prefix: "!", //required
  owners: ["Your Revolt ID"], //required , optional add more owner Id
  path: "./commands", //optinal, (default : "./commands")
});
//...

Standart using example

CommonJS

//"./commands/general/ping.js"
exports.default = {
  name: "ping",
  description: "Ping!", //description :P
  //Be careful
  code(message, args, client) {
    //Your code here
    message.channel.sendMessage("Pong");
  },
};

EsModule

export default {
  name:"ping",
  description:"Ping!"
  code(message:any,args:string[],client:any){
    //Your code here
  }
}

Aliases example

//"./commands/general/ping.js"
exports.default = {
  name: "ping",
  aliases: ["delay"],
  description: "Ping!", //description :P
  //Be careful
  code(message, args, client) {
    //Your code here
  },
};

Only owner command example

//"./commands/owner/test.js"
exports.default = {
  name: "eval",
  aliases: ["eval"],
  ownerOnly: {
    status: true,
    errorMsg(message, author, command) {
      //optional
      message.reply("You can't use this command");
    },
  },
  code(message, args, client) {
    //your code here
  },
};

Only perm(s) command example

//"./commands/moderate/perm.js"
exports.default = {
  name: "perm",
  ownerPerms: {
    perms: ["KickMembers"], //You can see the perm names in : https://revolt.js.org/modules/permissions_definitions.html#Permission (onlyString)
    errorMsg(message, member, command, perms) {
      //optional
      message.reply(
        `You must have ${perms.join(",")} permission(s) to use this command`
      );
    },
    code(msg, args, client) {
      //Your code here
    },
  },
};

Allow DM

//"./commands/general/indm.js"
exports.default = {
  name: "indm",
  allowDM: {
    //be careful "DM", not "Dm or dm"
    status: true,
    errorMsg(message, author, client) {
      //optional
      message.reply("You can't use this commmand in dm or group");
    },
    code(message, args, client) {
      //Your code here
    },
  },
};

Non Prefixed

//"./commands/general/nonprefixed.js"
exports.default = {
  name: "withoutprefix", //WARN : The command name is case sensitive here!
  nonPrefixed: true,
  code(message, args, client) {
    //Your code here
  },
};

Will add new features in the future

revolthandler.js

revolthandler.js's People

Contributors

ramazaneris avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.