forked from Supositware/Haha-Yes
Bing wallpaper of the day
This commit is contained in:
parent
64105bbc89
commit
d8c19c32b1
1 changed files with 38 additions and 0 deletions
38
commands/utility/wallpaper.js
Normal file
38
commands/utility/wallpaper.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
const { Command } = require('discord-akairo');
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
class wallpaperCommand extends Command {
|
||||
constructor() {
|
||||
super('wallpaper', {
|
||||
aliases: ['wallpaper'],
|
||||
category: 'fun',
|
||||
clientPermissions: ['SEND_MESSAGES', 'ATTACH_FILES'],
|
||||
description: {
|
||||
content: 'Show the Bing wallpaper of the day',
|
||||
usage: '',
|
||||
examples: ['']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async exec(message) {
|
||||
fetch('https://bing.biturl.top/?mkt=en-US')
|
||||
.then(res => {
|
||||
return res.json();
|
||||
})
|
||||
.then(res => {
|
||||
console.log(res);
|
||||
|
||||
const wallpaperEmbed = this.client.util.embed()
|
||||
.setColor(message.member.displayHexColor)
|
||||
.setTitle('Bing wallpaper of the day')
|
||||
.addField('Copyright', `[${res.copyright}](${res.copyright_link})`)
|
||||
.setDescription('[1366](https://bing.biturl.top/?resolution=1366&format=image&mkt=en-US) | [1920](https://bing.biturl.top/?resolution=1920&format=image&mkt=en-US)')
|
||||
.setImage(res.url);
|
||||
|
||||
return message.channel.send(wallpaperEmbed);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = wallpaperCommand;
|
Loading…
Reference in a new issue