catsndogs

1.0.5 • Public • Published

catsndogs

Fetches a random image of a Dog or a Cat.
This is 'random-animal' but fixed.
My Discord: **MrScopes#5546**

Basic Usage

const random = require('catsndogs');

// Get a random image of a Cat via random.cat
random.cat().then(url => console.log(url)).catch(err => console.log(err.message));

// Get a random image of a Dog via random.dog 
random.dog().then(url => console.log(url)).catch(err => console.log(err.message));

Examples

  • discord.js | cat command (with handler)
const Discord = require('discord.js');

module.exports.run = async (client, message, args) => {
	const random = require('catsndogs');
	return await random.cat().then(url => message.channel.send(new Discord.Attachment(url, 'cat.jpg'))).catch();
}
  • discord.js | cat command (without handler)
const Discord = require('discord.js');

client.on('message', msg => {
	if (msg.content === 'cat') {
		return await random.cat().then(url => message.channel.send(new Discord.Attachment(url, 'cat.jpg'))).catch();
	}
});

Readme

Keywords

Package Sidebar

Install

npm i catsndogs

Weekly Downloads

6

Version

1.0.5

License

MIT

Unpacked Size

3.32 kB

Total Files

4

Last publish

Collaborators

  • mrscopes