Coder Social home page Coder Social logo

ez-games.js's Introduction

ez-games.js

  • Made For Discord bots which use Discord.js
  • Make Sure To Install quick.db Before Using Package!
  • Report Bugs, Errors, Problems In Support Server

Usage πŸ“•

  • Speed Game
const Discord = require('discord.js')
const client = new Discord.Client()
const db = require('quick.db')
client.on('ready', () => {
   console.log('im in!')
})


const ezgames = require('ez-games.js')
client.on('message', async message => {
if(!message.guild) return;
if(message.content.toLowerCase().startsWith('speed')) {

let data = await ezgames.speed(message.author.id, message.guild.id, message.author.displayAvatarURL({ format: 'png'}), client.user.username)
 /**
  * user => message.author.id 
  * guild => message.guild.id
  * image => the generated image from api.
  * word => the word that generated from the package
  */
 let embed = new Discord.MessageEmbed()
.setTitle(`You Have 15Seconds To Type the word`)
.setImage(data.image)
.setFooter(message.guild.name , message.guild.iconURL())
.setTimestamp()
 message.channel.send(embed)
 let author = m => m.author.id === message.author.id;
 let pointcollecter = new Discord.MessageCollector(message.channel, author , { max: 1 , time: 15000 }); 
 pointcollecter.on('collect', async msg => {
     let word = data.word;
     if(msg.content.toLowerCase() === word.toLowerCase()) {
   message.channel.send(`You've Got one Point!`)  
   db.add(`points_${message.author.id}`, 1)
   db.add(`wins_${message.author.id}`, 1)

} else {
   message.channel.send(`Incorrect the right word is ${word.toLowerCase()}`)
   db.add(`loses_${message.author.id}`, 1)
     }
 })
}
})
  • Get User Points
client.on('message',  async message => {
  if(message.content.toLowerCase().startsWith('points')) {
   if(!message.guild) return;
   let data = await ezgames.points(message.author.id)
   /**
    * total => user points  
    * wins => user wins
    * loses => user loses
    */
   message.channel.send(`Total Points: ${data.total}`)
  }
})

Why ez-games.js

  • Fast and easy to use
  • Note : This Package Is Using Quick.db (Database)
  • This Package Is Made With πŸ’– By ! Darkboy🍭#9966

ez-games.js's People

Contributors

darkboy-js avatar

Stargazers

Purge avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.