Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@moscowcity/djs-eval

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

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.

  • 1.2.0
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
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 discord-js-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) => {
  Eval.run(message, { bot: 0 });
};

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

Package last updated on 27 Oct 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc