README
A basic API for configuring and improving the ways you code your Discord bot, also get coding as neat and comfortable as possible.
How to use 📃
Importing 🐱👤
// Using Node.js `require()`
const nekoyasui = require("nekoyasui");
// Using ES6 imports
import nekoyasui from "nekoyasui";
Methods 📚
Chat Method
// Using Node.js `require()`
const { search, chat } = require("nekoyasui");
client.on("message", async message => {
const master = await search.user(message, "817238971255488533");
if(!(master)) console.log("Oh! noooooo.. where r u master!");
const bot = {
username: message.client.user.username,
birthdate: "11/02/2002",
prefix: message.client.prefix,
gender: "male",
description: "I'm Discord Bot with many features.",
country: "Philippines",
city: "South Cotabato, General Santos"
};
const owner = {
id: master.id,
username: master.username,
discriminator: master.discriminator,
invite: "n6EnQcQNxg"
}
const res = await chat(String(message.content), message.author.id, bot, owner);
if(!(res.status)) return console.log(res.cnt);
return message.channel.send(res.cnt);
});
Logs Method
// Using Node.js `require()`
const { logs } = require("nekoyasui");
client.on("message", async message => {
try {
console.log();
} catch(e) {
logs(message, e, "error");
}
});
Timeout Method
// Using Node.js `require()`
const { logs, timeout } = require("nekoyasui");
client.on("message", async message => {
try {
const msg = await message.channel.send("ohayoo!");
timeout(message, msg, 5000);
} catch(e) {
logs(message, e, "error");
}
});
Search Method
// Using Node.js `require()`
const { search } = require("nekoyasui");
exports.run = async(client, message, args) => {
const Method = args[0] ? args[0].toLowerCase() : "";
switch(Method) {
case "search":
const Option = args[1] ? args[1].toLowerCase() : "";
switch(Option) {
case "user":
const user = await search.user(message, args[2]);
console.log(user);
return message.channel.send(`${user.username}#${user.discriminator}`);
case "member":
const member = await search.member(message, args[2], {
current: true
});
console.log(member);
return message.channel.send(`${member.user.username}#${member.user.discriminator}`);
case "channel":
const channel = await search.channel(message, args[2], {
current: true
});
console.log(channel);
return message.channel.send(channel.name);
case "role":
const role = await search.role(message, args[2]);
if(!role) return;
console.log(role);
return message.channel.send(role.name);
case "emoji":
const emoji = await search.emoji(message, args[2]);
console.log(emoji);
return message.channel.send(`<:${emoji.name}:${emoji.id}> \`\`<:${emoji.name}: ${emoji.id}>\`\``);
default:
return message.channel.send("wrong search option");
}
}
};
Prompt Method - Reply
// Using Node.js `require()`
const { prompt } = require("nekoyasui");
exports.run = async(client, message, args) => {
const ops = {
userID: message.author.id,
//startswith?: string;
//includesOf?: string | any[];
//type?: string - number|word;
//required?: boolean - false (OR) | true (AND) - default: true;
//timeout?: number;
//failIfTimeout?: boolean;
//timeout?: number; - default: 30000
//failIfTimeout?: boolean; - default: false
};
const reply = await prompt.reply(message.channel, "Reply to me!", ops);
if(!(reply)) return console.log("Timeout!");
return message.channel.send(reply);
};
Prompt Method - Reaction
// Using Node.js `require()`
const { prompt } = require("nekoyasui");
exports.run = async(client, message, args) => {
const ops = {
userID: message.author.id,
//timeout?: number; - default: 30000
//failIfTimeout?: boolean; - default: false
};
const reaction = await prompt.reaction(client, message.channel, "React to the message..", ops);
if(!(reaction)) return console.log("Timeout!");
return message.channel.send(reaction);
};
Image Petpet Method - GIF
// Using Node.js `require()`
const { search, image } = require("nekoyasui");
const { MessageAttachment } = require("discord.js");
exports.run = async(client, message, [...value]) => {
const member = await search.member(message, value.join(" "), { current: true });
const petpet = await image.petpet(member.user.displayAvatarURL({ size: 4096, format: "png" }), {
frames: 40, //- Default: 40
better: true //- Default: false
});
return message.channel.send(new MessageAttachment(petpet, `${member.user.username}_petpet.png`));
};
Image Circle Method - GIF
// Using Node.js `require()`
const { search, image } = require("nekoyasui");
const { MessageAttachment } = require("discord.js");
exports.run = async(client, message, [...value]) => {
const member = await search.member(message, value.join(" "), { current: true });
const circle = await image.circle(member.user.displayAvatarURL({ size: 4096, format: "png" }));
return message.channel.send(new MessageAttachment(circle, `${member.user.username}_circle.png`));
};