1.0.9 • Published 3 years ago

ez-games.js v1.0.9

Weekly downloads
39
License
ISC
Repository
github
Last release
3 years ago

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__
```js
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
    * lose => user loses
    */
   message.channel.send(`Total Points: ${data.total}`)
  }
})
  • Flags Games
  client.on('message', async message => {{
      if(message.content.toLowerCase().startsWith('flags')) {
          if(!message.guild) return;
        /*
        * data.countryname => flag country name
        * data.countryflag => country flag url that  generated from the package.
        * 
        */
          let data = await ezgames.flags(message.author.id , message.guild.id)
          let embed = new Discord.MessageEmbed()
          .setAuthor(message.author.username, message.author.displayAvatarURL())
          .setDescription(`You have 15 Seconds to guess country name from the flag..`)
          .setImage(data.countryflag)
          .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 => {
          if(msg.content.toLowerCase() === data.countryname) {
            msg.channel.send(`Correct you've got apoint`)
            db.add(`points_${message.author.id}`, 1)
            db.add(`wins_${message.author.id}`, 1)
         
         } else {
            message.channel.send(`Incorrect the flag name is ${data.countryname.toLowerCase()}`)
            db.add(`loses_${message.author.id}`, 1)
         
          }
          })
          }
  }})

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
1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago