1.0.5 • Published 4 years ago
random-coinflip v1.0.5
random-coinflip
Npm: npmjs.com/random-coinflip
random-coinflip is a easy way to get a heads or tails! We use 0 dependencies!
How hard to use?
It is very easy download the package npm install random-coinflip and require it in your code and use the simple function!
How to install
npm install random-coinflip
Example
This is how you use this package!
//requiring the npm package
const coinflip = require('random-coinflip');
//console logging the function
//lowercase example: heads, tails
console.log(coinflip.getCoinLowerCase())
//uppercase example: Heads, Tails
console.log(coinflip.getCoinUpperCase())
Discord bot example
//please read!
//you need discord.js v12 npm for this code example
//requiring the npm packages
const Discord = require('discord.js')
const client = new Discord.Client();
const coinflip = require('random-coinflip');
client.on('message', async message => {
if (message.content.toLowerCase() === '!coinflip-lowercase') {
message.reply(`Coin: ${coinflip.getCoinLowerCase()}`)
}
if (message.content.toLowerCase() === '!coinflip-uppercase') {
message.reply(`Coin: ${coinflip.getCoinUpperCase()}`)
}
})
client.login("TOKEN")
Functions
getCoinLowerCase() - gets random coinflip (heads or tails)
getCoinUpperCase() - gets random coinflip (Heads or Tails)