gamer-discord-utils
v2.0.2
Published
A Light Weight Package Which is Very Easy To Use
Downloads
11
Maintainers
Readme
📝 Table Of Content
- Installation
- Examples
- Calculator
- WouldYouRather
- TicTacToe
- Fight
- chatBot
- FastType
- ChaosWords
- Snake
- RockPaperScissors
- ShuffleGuess
- Sudo
- Randomize String
- Randomize Number
- Flip
- passGen
- slots
- credits
- Support Server
Installation
$ npm i gamer-discord-utils
If you want to use functions with buttons, you have to install discord-buttons too
License
gamer-discord-utils NPM is licensed under the terms of Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International ("CC-BY-NC-SA-4.0"). Commercial use is not allowed under this license. This includes any kind of revenue made with or based upon the software, even donations.
The CC-BY-NC-SA-4.0 allows you to:
Share
-- copy and redistribute the material in any medium or format.
Adapt
-- remix, transform, and build upon the material.
Under the following terms:
- Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- NonCommercial — You may not use the material for commercial purposes.
- ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
More information can be found here.
credits
credits to weky-package and its author for majority of the code. BTW if you want to take the package down you cant cus i copied the older version of weky which license was CC-BY-NC-SA-4.0 and i gave credits so yeah.
Define the client
const discord = require('discord.js'); //ignore if you already have defined it
const client = new discord.Client(); //ignore if you already have defined it
const disbut = require('discord-buttons');
disbut(client);
enter this in your main file or else functions with discord-buttons wont work
Examples
Calculator
const { Calculator } = require('gamer-discord-utils')
await Calculator(message)
This function requires discord-buttons
TicTacToe
const opponent = message.mentions.users.first();
if (!opponent) return message.channel.send(`Please mention who you want to challenge at tictactoe.`);
const { TicTacToe } = require('gamer-discord-utils')
const game = new TicTacToe({
message: message,
opponent: opponent, // opponent
xColor: 'red', // x's color
oColor: 'blurple', //zero's color
xEmoji: '❌', //t he x emoji
oEmoji: '0️⃣' ,// the zero emoji
})
game.start()// start da game
This function requires discord-buttons
Fight
const opponent = message.mentions.users.first();
if (!opponent) return message.channel.send(`Please mention who you want to fight`);
const { fight } = require('gamer-discord-utils');
const battle = new fight({
client: client,
message: message,
acceptMessage: 'Click to fight with <@' + message.author + '>', //message sent to see if opponent accepts
challenger: message.author, // NOT CHANGEABLE
opponent: opponent, // NOT CHANGEABLE
hitButtonText: 'HIT', // Hit button text (Custom)
hitButtonColor: 'red', // Hit button color (Custom)
healButtonText: 'HEAL', // Heal button text (Custom)
healButtonColor: 'green', // Heal button color (Custom)
cancelButtonText: 'CANCEL', // Cancel button text (Custom)
cancelButtonColor: 'blurple', // Cancel button color (Custom)
});
battle.start(); // start da battle
This function requires discord-buttons
chatBot
const { chatBot } = require("reconlx");
/** @parameters
* message, message.channel
* input, input to give
*/
// example
chatBot(message, args.join(" "));
Would You Rather
const { WouldYouRather } = require('gamer-discord-utils')
await WouldYouRather(message)
This function requires discord-buttons
Snake
const { Snake } = require('gamer-discord-utils');
new Snake({
message: message,
embed: {
title: 'Snake', //embed title
color: "#gt4668", //embed color
gameOverTitle: "Game Over", //game over embed title
},
emojis: {
empty: '⬛', //zone emoji
snakeBody: '♿', //snake
food: '💩', //food emoji
//control
up: '⬆️',
right: '⬅️',
down: '⬇️',
left: '➡️',
},
}).start()
This function requires discord-buttons
RockPaperScissors
const opponent = message.mentions.users.first();
if(!opponent) return message.channel.send(`Please mention who you want to fight`);
const { RPS } = require('gamer-discord-utils')
const game = new RPS({
message: message,
opponent: opponent, // NOT CHANGEABLE
challenger: message.author, // NOT CHANGEABLE
acceptMessage: "Click to fight with <@" + message.author + '> at RPS!', // message sent to see if opponent accepts
})
game.start() // start the game
This function requires discord-buttons
FastType
const { FastType } = require('gamer-discord-utils');
const game = new FastType({
message: message,
winMessage: "GG you won!", // message sent when user types perfectly
sentence: 'some string', // sentence-to-be-typed
loseMessage: 'Lost ;(', // message sent when user misspell it
time: 50000, // time that user has in ms
startMessage: 'Good Luck!' // message sent when user starts playing
});
game.start(); // start da game
ChaosWords
const { ChaosWords } = require("gamer-discord-utils")
var randomWords = require('random-words');
const words = randomWords(2) // generating 2 words
await new ChaosWords({
message: message,
maxTries: 8, //max number of user's tries (ends when reach limit)
charGenerated: 20, //length of sentence (small length might throw error)
words: words, //words (array) => ['word']
embedTitle: 'Chaos words!', //understable
embedFooter: 'Find the words in the sentence!',
embedColor: 'RANDOM'
}).start()
ShuffleGuess
var randomWords = require('random-words');
const word = randomWords();
const { ShuffleGuess } = require('gamer-discord-utils');
const game = new ShuffleGuess({
message: message,
word: word, // or a simple word
winMessage: "GG you won!", // message sent when user's message matches with the word
colorReshuffleButton: 'green', // color of the reshuffle button (regen)
messageReshuffleButton: 'reshuffle', // text of the reshuffle button (regen)
colorCancelButton: 'red', // color of the cancel button (exit, quit, stop)
messageCancelButton: 'cancel', // text of the cancel button
client: client
});
game.start(); // start da game
This function requires discord-buttons
Sudo
const { sudo } = require('gamer-discord-utils');
const user = message.mentions.members.first();
const msg = args.slice(1).join(" ");
const xd = new sudo({
message: message,
text: msg,
member: user,
});
xd.start();
slots
const utils = require("gamer-discord-utils")
var slot = new utils.Slots({
message: message,
winMessage: "Nice, You've won the slots!",
loseMessage: "Lmao, better next time",
emojiOne: "some emoji 1",
emojiTwo: "some emoji 2",
emojiThree: "some emoji 3"
})
slot.start()
RandomizeString
const utils = require('gamer-discord-utils');
let food = ["🍏","🍐","🍋","🍌","🍉","🍇","🫐"];
let foodButRandom = utils.randomizeString(food);
console.log(foodButRandom);
/*output:
Some random string from the food array
*/
RandomizeNumber
const utils = require('gamer-discord-utils');
let randomNumber = utils.randomizeNumber(100,1000);
console.log(randomNumber);
/*output:
Some random number between 100 and 1000
*/
Flip
const utils = require('gamer-discord-utils');
console.log(utils.flip('Hello World'));
/*output:
plɹoM ollǝH
*/
PasswordGen
this is a simple function that can generate passwords using letters and numbers and the password length is custom so you can change it to any length you want!
Example:
// Defining the package
const utils = require('gamer-discord-utils')
// getting the passGen function from the package
const passGen = utils.passGen
// this will log the randomly generate password in your terminal
console.log(passGen(6)) // passGen(6) that mean it will generate a password from 6 characters.
// you can change it by changing passGen(here will be the length of the password)