@superphantomuser/discordjs-minigames

1.2.2 • Public • Published

Discordjs-minigames

Discordjs-minigames is an npm package created by the head developer of the bot Coin Flipper. It's designed to let you easily integrate minigames, like in Coin Flipper, into your bot with ease.

This package lets you have full customization over your minigames, letting you change things like the minigame being played (or random), the list of words it chooses from, the color of the embed, and much more!

To start, in your shell/command prompt, do:

npm install @superphantomuser/discordjs-minigames

Now that you have the package installed, you're able to easily integrate minigames into your bot!

Examples

Simple minigame

const Discord = require('discord.js'); //define Discord
const client = new Discord.Client(); //create your client constructor

const minigames = require('@superphantomuser/discordjs-minigames'); //define the minigame package

client.on("message", message => {

  if (message.content == "minigame") {
    minigames.minigame(message, "random"); //creates a minigame, with a random type
  }

});

Customizing minigames

//NOTE THAT ONLY message AND type ARE NEEDED
minigames.minigame(
  message, //the message constructor
  "random", //the type of minigame (can be "repeat", "unscramble", or "timing", or you can use "random" to chooes a random one)
  {
    color: "RED", //the color of the embed
    before_time: 3000, //the time between the initial embed being sent and the minigame being started
    after_time: 15000, //the time the bot allows users to send the message
    embedTitle: "A minigame has been started!", //the embed title when the host starts the minigame
    embedDescription: "<host> started a minigame! Get ready!", //the embed description when the host starts the minigame
    message: "<winner> won the minigame!", //the message it sends if someone won the minigame
    list: ["npm", "package", "discord"], //the list of words the bot chooses from for minigames
    after: function(winner){} //anything that you want it to do after a user wins (winner is the winners ID)
  }
);

Fully customized minigame

const Discord = require('discord.js'); //define Discord
const client = new Discord.Client(); //create your client constructor

const minigames = require('@superphantomuser/discordjs-minigames'); //define the minigame package

client.on("message", message => {

  if (message.content == "bee minigame") {
    minigames.minigame(message, "unscramble", {
      color: "YELLOW", 
      before_time: 2000, 
      after_time: 10000, 
      embedTitle: "Bzzzz minigame time!",
      embedDescription: "The bee <host> startd a minigame!",
      message: "Buzz! <winner> wins!", 
      list: ["bee", "buzz", "hive", "honey", "stinger", "wings"],
      after: function(winner) { 
        let user = bot.users.cache.get(winner.toString());
        user.send("Bzz congrats on winning the minigame!").catch(err => {});
      }
    });
    //A fully customized minigame for a Bee Bot
  }

});

We hope you have fun with this package and being able to fully integrate Coin Flipper's minigames into your own bot! But if you don't want to make your own bot and just want to play these minigames, invite Coin Flipper today! https://coinflipperbot.glitch.me/

Readme

Keywords

none

Package Sidebar

Install

npm i @superphantomuser/discordjs-minigames

Weekly Downloads

0

Version

1.2.2

License

ISC

Unpacked Size

8.65 kB

Total Files

4

Last publish

Collaborators

  • superphantomuser