1.1.2 • Published 4 years ago

@nesanya/ntr-discord v1.1.2

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

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
1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago