-
Notifications
You must be signed in to change notification settings - Fork 0
/
goose.js
36 lines (30 loc) · 877 Bytes
/
goose.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const Giphy = require('giphy-js-sdk-core');
const giphy = Giphy(process.env.GIPHY);
function playHonk(channel) {
channel
.join()
.then(connection => {
const dispatcher = connection.playFile(
`./honks/honk_${Math.ceil(Math.random() * 10)}.mp3`
);
dispatcher.on('end', end => {
channel.leave();
});
})
.catch(console.error);
}
function sendGif(channel) {
giphy.random('gifs', { tag: 'goose' }).then(res => {
channel.send(res.data.url);
});
}
// DEPRECATED
// function switchNicknames(members) {
// let memberA = members.random();
// let memberB = members.random();
// while (memberA === memberB) memberB = members.random();
// let temp = memberA.nickname || 'Goose';
// memberA.setNickname(memberB.nickname || 'Goose');
// memberB.setNickname(temp);
// }
module.exports = { playHonk, sendGif };