1.0.2 • Published 4 years ago

duck-img v1.0.2

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
4 years ago

duck-img

Npm: npmjs.com/duck-img

duck-img is a easy way to get a picture of a duck We use 0 dependencies!

How hard to use?

It is very easy download the package npm install duck-img and require it in your code and use the simple function!

How to install

npm install duck-img

Example

This is how you use this package!

//requiring the npm package
const duck = require('duck-img');

//console logging the function

//picture
console.log(duck.getImg())

//gif
console.log(duck.getGif())

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 duck = require('duck-img');

client.on('message', async message => {
  if (message.content.toLowerCase() === '!img') {
    const img = new Discord.MessageEmbed()
    .setTitle(`Duck IMG`)
    .setImage(duck.getImg())
    message.channel.send(img)
  }

  if (message.content.toLowerCase() === '!gif') {
    const gif = new Discord.MessageEmbed()
    .setTitle(`Duck GIF`)
    .setImage(duck.getGif())
    message.channel.send(gif)
  }
})

client.login("TOKEN")

Functions

getImg() - Gets a random image of a duck
getGif() - Gets a random gif of a duck

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago