@nesanya/ntr-discord

1.1.2 • Public • Published

NTR-discord

Easier work with discord API :)


NPM - Click here

GITHUB - Click here (Always the latest documentation)


The library was created in order to:

  • Increase development speed
  • Shorten code
  • Increase code readability

install - npm install @nesanya/ntr-discord


Code example:
const Discord = require("discord.js")
const client = new Discord.Client()
const { MsgDS, MainDS } = require("@nesanya/ntr-discord")
const main = new MainDS(client, "You'r token here")
const msg = new MsgDS(client, "You'r prefix")

main.start(function(){
    console.log(`Logged in as ${client.user.tag}!`)
})

msg.MsgReply("ping", "pong!", true)

msg.MsgCallback("pong", message => {
    message.reply("ping!")
}, true)

MainDS Class

Method start

Method start calling function client.login (Explanation here) and calling fucntion client.on("ready") (Explanation here)

Code example:
/** *@example start */
const Discord = require("discord.js")
const client = new Discord.Client()
const { MainDS } = require("@nesanya/ntr-discord")
const main = new MainDS(client, TOKEN_HERE)

main.start(() => {
  console.log(`Logged in as ${client.user.tag}!`)
})

SimpleWelcomer method

Welcomes new users to the server

Code example:
/** *@SimpleWelcomer example */
const Discord = require("discord.js")
const client = new Discord.Client()
const { MainDS } = require("@nesanya/ntr-discord")
const main = new MainDS(client, TOKEN_HERE)

main.SimpleWelcomer("YOU'R WELCOME_CHAT", "Hello World Message")

CallbackWelcomer method

Welcomes new user to the server with callback

Code example:
/** *@CallbackWelcomer example */
const Discord = require("discord.js")
const client = new Discord.Client()
const { MainDS } = require("@nesanya/ntr-discord")
const main = new MainDS(client, TOKEN_HERE)

main.CallbackWelcomer( member => {
 const channel = member.guild.channels.cache.find(ch => ch.name === textChat)
 if(!channel) {
  throw new Error("NTR-Discord: channel not find (SimpleWeclomer)")
 }
 channel.send(`Hello ${member}`)
})

Msg Class

Method MsgReply

The MsgReply method calls fucntion client.on ("message") (Explanation here) , and it works like question/asnwer

Code example:
/** *@example MsgReply */
const Discord = require("discord.js")
const client = new Discord.Client()
const { MsgDS } = require("@nesanya/ntr-discord")
const msg = new MsgDS(client, "PREFIX")

msg.MsgReply("ping (question)", "pong (answer)", true) // last function param check, is bot? If true => return

// To call, enter the channel "YOUR_PREFIX" + ping into your discord

Method MsgCallback

MsgCallback works like MsgReply, but instead of answering you call your function (function parameters: message (Explanation here))

Code example:
/** *@example MsgCallback */
const Discord = require("discord.js")
const client = new Discord.Client()
const { MsgDS } = require("@nesanya/ntr-discord")
const msg = new MsgDS(client, "YOUR PREFIX")

msg.MsgCallback("pong", message => {
    message.reply("ping!")
}, true) // last function param check, is bot? If true => return

// Returned: ping!

Admin class

Act method

This method kicked or banned member's on pinged

Code example:
/** *@Act example */
const Discord = require("discord.js")
const client = new Discord.Client()
const { AdminDS } = require("@nesanya/ntr-discord")
const Admin = new AdminDS(client, "YOUR_PREFIX")

Admin.Act("kick" // If you wrote ban, member was been banned
"Command to kick & ban here",
"Permission warning here",
"Isn't guild warning here",
"Kick reason here",
"Bot_Permission Error here",
"Successfully kicked message/embed here")

// !kick @user#0001 => Successfully kicked/banned message/embed here && warning/error

Package Sidebar

Install

npm i @nesanya/ntr-discord

Weekly Downloads

14

Version

1.1.2

License

MIT

Unpacked Size

9.62 kB

Total Files

4

Last publish

Collaborators

  • nesanya