mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-09 09:12:07 +02:00
Remove SoundCloud (no longer works)
This commit is contained in:
@@ -1,61 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const moment = require('moment');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const request = require('node-superfetch');
|
||||
const { shorten, formatNumber, embedURL } = require('../../util/Util');
|
||||
const { SOUNDCLOUD_KEY } = process.env;
|
||||
|
||||
module.exports = class SoundcloudCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'soundcloud',
|
||||
aliases: ['scloud', 'sc'],
|
||||
group: 'search',
|
||||
memberName: 'soundcloud',
|
||||
description: 'Searches SoundCloud for your query.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
credit: [
|
||||
{
|
||||
name: 'SoundCloud',
|
||||
url: 'https://soundcloud.com/',
|
||||
reason: 'API',
|
||||
reasonURL: 'https://developers.soundcloud.com/'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'query',
|
||||
prompt: 'What song would you like to search for?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { query }) {
|
||||
try {
|
||||
const { body } = await request
|
||||
.get('http://api.soundcloud.com/tracks')
|
||||
.query({
|
||||
q: query,
|
||||
client_id: SOUNDCLOUD_KEY
|
||||
});
|
||||
if (!body.length) return msg.say('Could not find any results.');
|
||||
const data = body[0];
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0xFF5500)
|
||||
.setAuthor('SoundCloud', 'https://i.imgur.com/ctft3v7.png', 'https://soundcloud.com/')
|
||||
.setURL(data.permalink_url)
|
||||
.setThumbnail(data.artwork_url)
|
||||
.setTitle(data.title)
|
||||
.setDescription(data.description ? shorten(data.description) : 'No description available.')
|
||||
.addField('❯ Artist', embedURL(data.user.username, data.user.permalink_url), true)
|
||||
.addField('❯ Release Date', moment.utc(new Date(data.created_at)).format('MM/DD/YYYY'), true)
|
||||
.addField('❯ Genre', data.genre || '???', true)
|
||||
.addField('❯ Likes', formatNumber(data.likes_count), true);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user