npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mixmediayt

v6.0.1

Published

This npm package is designed especially for beginners to help them understand JavaScript, as well as help them to learn about discord.js using MongoDB. This package hopefully will make the use of MongoDB/Mongoose easy for beginners. I hope that this packa

Downloads

13

Readme

⁉ mixmediayt

A simple api to configure and enhance the ways on coding your discord bot. Compatible with discord.js v12 but it should also work on older versions. Variety of different usages for this api. (Works on TypeScript as well.) NOTE: This packages needs you to some knowledge of MongoDB


Installation

First install Node.js. Then:

$ npm install mixmediayt

✈ Importing

// Using Node.js `require()`
const mixmediayt = require("mixmediayt");

// Using ES6 imports
import mixmediayt from "mixmediayt";

📭 Help

If you encounter any problem or if you find a bug in the npm package please report it to our Discord Server -> https://discord.gg/VEkx6UKxEN


🤔 How to USE


ReactionPages

Example :

// Example on checking how long the member's account was created.
// Import the package
const mixmediayt = require("mixmediayt");
// Destructure the package
const ReactionPages = mixmediayt.ReactionPages;
// You can use any version of embeds, such as Rich Embed or just Embed (depends on which version of djs your are using)
// Keep in mind that Embeds should't have their footers set since the pagination method sets page info there
const { MessageEmbed } = require("discord.js");
const embed1 = new MessageEmbed().setTitle("1");
const embed2 = new MessageEmbed().setTitle("2");
// Create an array of embeds.
const pages = [embed1, embed2];
// Change pages when sending numbers.
const textPageChange = true;
// Create an emojilist, first emoji being page back and second emoji being page front. Defaults are set to  ['⏪', '⏩'].
const emojis = ["⏪", "⏩"];h is 60 seconds. Time on how long you want the embed to be interactable
// Define a time in ms, defaults are set to 60000ms whic
const time = 30000;
// Call the ReactionPages method, use the <message> parameter to initialize it.
ReactionPages(msg, pages, textPageChange, emojis, time);
//There you go, now you have embed pages.

Preview on a music 🎼 list :

preview


Confirmation

// destructure the package
const { confirmation } = require("mixmediayt");
// Here is an example on using it in banning members.
message.channel.send("Confirmation for banning members").then(async (msg) => {
    // parameters used(which msg to react on, who can acess it, reactions, time(optional))
    const emoji = await confirmation(msg, ["✅", "⚔"], 30000);
    if (emoji === "✅") {
        //if author reacts on check
        //delete the confirmation message
        msg.delete();
        //ban the member
        guildMember.ban();
    }
    if (emoji === "⚔") {
        // if author reacts on cross
        // delete the confirmation message
        msg.delete();
    }
});

DaysAgo

// Example on checking how long the member's account was created.
// Import the package
const mixmediayt = require("mixmediayt");
// Destructure the package
const daysAgo = recon.DaysAgo;
const discord = require("discord.js");

client.on("guildMemberAdd", async (member) => {
    console.log(daysAgo(member.user.createdAt)); // return days.
});

fetchTranscript

// destructure the package
const { fetchTransript } = require("mixmediayt");

// here is how you use it

// template
// fetchTranscript(message: any, numberOfMessages: number, sendToAuthor: boolean)

// returns buffer

//example
module.exports = {
    name: "transcript",
    run: async (client, message) => {
        fetchTranscript(message, 5).then((data) => {
            const file = new MessageAttachment(data, "index.html");
            message.channel.send(file);
        });
    },
};
// it will fetch 5 messages in the current channel.

timeout

// destructure the package
const { timeout } = require("mixmediayt");

// example

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

// using the method
// template => timeout(message: who can acess, msgToDelete: which message to delete,time: time before the emoji gets deleted)
timeout(message, messageToDelete, 5000); // only message.author can areact, messageToDelete is going to deleted if collected reactions, if no reactions after 5 seconds the reaction will be removed.

chatBot

const { chatBot } = require("mixmediayt);

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

// example

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

hangman (one of my favourites)

//importing
const { hangman } = require("mixmediayt");

// parameters
/**
 * @name hangman
 * @param {Object} options options
 * @param {String} [options.channelID] channel to send to (channel.id)
 * @param {any} [options.message] parameter used for message event
 * @param {String} [options.permission] required permission to use this command (optional); default is set to everyone.
 * @param {String} [options.word] word that needed to be guessed (oooo OwO)
 * @param {any} [options.client] client used to defined Discord.Client
 */

// making hangman *wait what!!!)
const hang = new hangman({
    message: message,
    word: args.slice(1).join(" "),
    client: client,
    channelID: message.mentions.channels.first(),
});

// starting the game
hang.start();

Preview

preview

tictactoe

//importing
const { tictactoe } = require("mixmediayt");//tic cross, tic cross, i won yay

// 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(),
});



oldmixmediayt

1. Importing the package

const { oldmixmediayt } = require("mixmediayt");
// or
import { oldmixmediaytB } from "mixmediayt";

2. Establishing and exporting oldmixmediayt

const db = new oldmixmediaytB({
    uri: "your mongodb connection string",
});

module.exports = db;

3. Example on using it

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

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

mixmediayt

1. Importing the package

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

2. Establishing and exporting mixmediayt

const db = new mixmediayt(client, {
    uri: "your mongodb connection string",
});

module.exports = db;

3. Example on using it

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

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(mixmediayt.collection())

GiveawayClient

Initialising the client

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

  /**
   * @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?
});

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
 */