1.0.9 • Published 3 years ago

modelvnn v1.0.9

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

modelvnn-api

một package tiếng Việt do ModelVNN tạo ra

Server

Tham gia server của tui -> https://discord.io/peachlovervietnam

Info

Một api đơn giản để định cấu hình và nâng cao các cách mã hóa bot bất hòa của bạn. Tương thích với discord.js v13.

🛠 Các lệnh

  • ReactionPages - phân trang đơn giản để làm cho "MessageEmbed" của bạn có thể tương tác được.
  • Confirmation - Một bộ thu thập phản ứng trả về biểu tượng cảm xúc đầu tiên được thu thập, có thể được sử dụng làm lời nhắc xác nhận.
  • timeout - Giúp việc xóa tin nhắn theo nhu cầu của bạn dễ dàng hơn
  • tictactoe - Trò chơi TicTacToe bây giờ có thể chơi được trong discord.
  • GiveawayClient - Giveaway Client, cách dễ dàng để quản lý giveaway của bạn
  • chatBot - Một chatbot dễ dàng không cần api (chỉ hỗ trợ tiếng Anh)

nhiều tính năng sắp ra mắt! (hoặc tui lười tui ko lm nx :v)

✈ Import

// Dùng Node.js `require()`
const modelpack = require("modelvnn");
............
// Dùng ES6 import
import modelpack from "modelvnn";

🙋‍♂️ Support

Tham gia server này để được hỗ trợ -> https://discord.io/ModelDev


🔧 Cách dùng


ReactionPages

Ví dụ :

const modelpack = require("modelvnn");
const ReactionPages = modelpack.ReactionPages;

const { MessageEmbed } = require("discord.js");

const embed1 = new MessageEmbed().setTitle("1");

const embed2 = new MessageEmbed().setTitle("2");

const pages = [embed1, embed2];

const textPageChange = true;

const emojis = ["⏪", "⏩"];

const time = 30000;

ReactionPages(msg, pages, textPageChange, emojis, time);

Preview trong danh sách nhạc :

preview


Confirmation

const { confirmation } = require("modelvnn");
message.channel.send("Confirmation for banning members").then(async (msg) => {
    const emoji = await confirmation(msg, ["✅", "❌"], 30000);
    if (emoji === "✅") {
        msg.delete();
        guildMember.ban();
    }
    if (emoji === "❌") {
        msg.delete();
    }
});

timeout

const { timeout } = require("modelvnn");

// ví dụ

const messageToDelete = await message.channel.send("Hello There 👋");

timeout(message, messageToDelete, 5000);

Preview

preview


chatBot

const { chatBot } = require("modelvnn");

/** @parameters
 * message, message.channel
 * input, input to give
 */


chatBot(message, args.join(" "));

Preview

preview


tictactoe

//importing
const { tictactoe } = require("modelvnn");

// parameters
/**
 * @name tictactoe
 * @param {Object} options options
 * @param {any} [options.message] parameter used for message event
 * @param {any} [options.player_two] second player in the game.
 */

// start the game

var game = new tictactoe({
    message: message,
    player_two: message.mentions.members.first(),
});

Preview

preview



GiveawayClient

Initialising the client

const Discord = require('discord.js')
const client = new Discord.Client();
const { GiveawayClient } = require("modelvnn");

  /**
   * @name GiveawayClient
   * @kind constructor
   * @param {Client} client
   * @param {Object} options Options
   * @param {String} [options.mongoURI] mongodb connection string
   * @param {String} [options.emoji] emoji for reaction (must be a unicode)
   * @param {String} [options.defaultColor] default colors for giveaway embeds
   * @description Initiating the giveaway client
   */

const giveaway = new GiveawayClient(client, {
  mongoURI?
  emoji?
  defaultColor?
}); //giveaway cần phải có mongoose

module.exports = giveaway;

Methods

start

/**
 * @method
 * @param {Object} options options
 * @param {TextChannel} [options.channel] Channel for the giveaway to be in
 * @param {Number} [options.time] Duration of this giveaway
 * @param {User} [options.hostedBy] Person that hosted the giveaway
 * @param {String} [options.description] Description of the giveaway
 * @param {Number} [options.winners] Amount of winners for the giveaway
 * @param {String} [options.prize] Prize for the  giveaway
 */

end

/**
 * @method
 * @param {String} MessageID Message ID for the giveaway
 * @param {Boolean} getWinner Choose a winner?
 * @description End a giveaway, choose a winner (optional)
 */

reroll

/**
 * @method
 * @param {String} channel channel of the giveaway
 * @param {String} id message id
 * @param {Number} winners amount of winners
 * @description Change the winners for a giveaway!
 */

getCurrentGiveaways

/**
 * @method
 * @param {Boolean} activatedOnly display activated giveaways only?
 * @param {Boolean} all display giveaways of  all guilds?
 * @param {Message} message message if (all = false)
 * @description Get data on current giveaways hosted by the bot
 */

removeCachedGiveaways

/**
 * @method
 * @param {Boolean} all Get data from all guilds?
 * @param {String} guildID guild id if all=false
 * @description Removes (activated = false) giveaways
 */

modelvnnDB

1. Importing the package

const { modelvnnDB } = require("modelvnn");
// or
import { modelvnnDB } from "modelvnn";

2. Establishing and exporting modelvnnDB

const db = new modelvnnDB(client, {
    uri: "link kết nối mongodb của bạn",
});

module.exports = db;

3. Ví dụ về cách sử dụng nó

const db = require("./db.js"); // replace db.js with the file path to modelvnnDB

db.set("numbers", "123");

Methods

.set

// saves data to database
db.set("key", "value");

.get

// gets value from key
db.get("key"); // returns => value

.has

// returns boolean
db.has("key"); // returns => true

.delete

// deletes data
db.delete("key");

// checking for data
db.has("key"); // returns => false

.collection

//returns the cached data
console.log(modelvnnDB.collection())