Socket
Socket
Sign inDemoInstall

@moscowcity/djs-eval

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @moscowcity/djs-eval

This package helps you quickly evaluate any thing via discord.js bot.


Version published
Weekly downloads
6
increased by200%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

@moscowcity/djs-eval

This package helps you quickly evaluate any thing via discord.js bot.

  • 2 lines setup!
  • Multilanguage!

Installation

Package requires Node.js v10+ to run.

Install package using this command:

$ npm install @moscowcity/djs-eval

Usage

First, declare requirement.

const _eval = require('@moscowcity/djs-eval');

Then create command:

const _evalCommand = new _eval.Eval([ 'owner', 'Ids' ], 'locale'); // Locales: ru/en

Only 1 thing left, call 'run' function. 2nd argument

_evalCommand.run(messageObject);

To run with dependencies (client, message, args, etc) use this:

_evalCommand.run(messageObject, {bot: client, etc: 'etc'});

Example eval command

const _eval = require("@moscowcity/djs-eval");
const Eval = new _eval.Eval(["323424226889433088"], "ru");

module.exports.run = async (client, message) => {
  const evaluated = await Eval.run(message, { bot: 0 });
  message.channel.send({ content: '```JS\n' + evaulated + '```'}); // or message.reply('```JS\n' + evaulated + '```');
};

Imagine that message content is:

const moment = require("moment")
moment(Date.now()).format("DD.MM.YYYY HH:mm")

If author id is not the same as specified, output message:

You are not permitted to use this command!

If everything is correct, output message:

06.08.2021 11:47 // example

Included methods

Reply from code with .catch(), or just send callback use 'doReply()' or 'doReply' in your code. To make callback with error, use doReply in .catch():

doReply('test');
or
doSomething().then(doSomethingElse()).catch(doReply);

To get all methods of class, use 'getMethods(obj)'

doReply(getMethods(require('@moscowcity/djs-eval')))

Keywords

FAQs

Last updated on 28 Apr 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc