trigger: scrnd
This commit is contained in:
parent
f6fc8d37d0
commit
674ffeecf5
|
@ -13,6 +13,7 @@ import parser from "./parser";
|
|||
import quotes from "./quotes";
|
||||
import rape from "./rape";
|
||||
import sandbox from "./sandbox";
|
||||
import soundcloud from "./soundcloud";
|
||||
import urban from "./urban";
|
||||
import nxy from "./useless_nxy";
|
||||
import uwe from "./useless_uwe";
|
||||
|
@ -21,6 +22,6 @@ import wttr from "./wttr";
|
|||
export default [
|
||||
cfg, chatbot, coins, cookie, core, debug,
|
||||
drugs, help, kernel, lastfm, mcmaniac,
|
||||
parser, quotes, rape, sandbox,
|
||||
parser, quotes, rape, sandbox, soundcloud,
|
||||
urban, nxy, uwe, wttr
|
||||
];
|
22
src/inc/trigger/soundcloud.mjs
Normal file
22
src/inc/trigger/soundcloud.mjs
Normal file
|
@ -0,0 +1,22 @@
|
|||
import rp from "request-promise";
|
||||
import { cfg } from "../../inc/cfg";
|
||||
|
||||
export default bot => {
|
||||
bot._trigger.set("scrnd", new bot.trigger({
|
||||
call: /^(\.|\/)scrnd/i,
|
||||
help: {
|
||||
text: "get random track from Flummi's soundcloud favorites",
|
||||
usage: "[b].scrnd[/b]"
|
||||
},
|
||||
f: e => {
|
||||
rp(`http://api.soundcloud.com/users/${cfg.main.soundcloud.val.user}/favorites?client_id=${cfg.main.soundcloud.val.clientid}`, { json: true })
|
||||
.then(res => {
|
||||
const track = res[~~((Math.random() * res.length) + 1)];
|
||||
e.reply(`${track.permalink_url}\n[b]${track.title}[/b] - length [b]${track.duration}[/b] - [b]${track.user.username}[/b] on [b]${track.created_at}[/b]`);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
}));
|
||||
};
|
Loading…
Reference in New Issue
Block a user