Skip to content

Commit

Permalink
Added statuses and fixed status when playing music
Browse files Browse the repository at this point in the history
  • Loading branch information
jasper-buijs committed Sep 6, 2023
1 parent 8015796 commit 4c02808
Show file tree
Hide file tree
Showing 4 changed files with 499 additions and 273 deletions.
2 changes: 2 additions & 0 deletions commands/play.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ module.exports = {
else if (result.durationMS > 1800000) return await interaction.editReply({ content: "Unfortunately, I'm not allowed to play songs longer than 30 minutes.", ephemeral: true });
const { track } = await client.player.play(interaction.member.voice.channel, result, {
nodeOptions: {
/*bufferingTimeout: 10000,
connectionTimeout: 10000,*/
leaveOnEmpty: true,
leaveOnEmptyCooldown: 0,
leaveOnEnd: true,
Expand Down
10 changes: 7 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@ const statusMessages = [
"https://pbs.twimg.com/media/F3w1DvqXUAAZXFB?format=png&name=large",
"*Vine Boom Sound Effect*",
"Willi! du du dudu du",
"Matrix. (wiskunde). In de lineaire algebra, een deelgebied van de wiskunde, is een matrix, meervoud: matrices,...",
"Matrix (wiskunde). In de lineaire algebra, een deelgebied van de wiskunde, is een matrix, meervoud: matrices,...",
"You already know who it is. It's ya boy ëRe ëRe āhha ëRe āhha ë-Ra ëRa ëRa ëRa ëRa- hÔaH hÔaH hÔaH fhreeēēēssshH.",
"Tanja had gelijk. Ieuw."
"Tanja had gelijk. Ieuw.",
"Oh the misery..",
"Aandacht, aandacht! Ophaling van oude metalen, oud ijzer, oude wasmashines, ...",
"🤡",
"all 📠 no 🖨️"

];
client.sessionStatusMessage = statusMessages[Math.floor(Math.random()*statusMessages.length)];
Expand Down Expand Up @@ -184,7 +188,7 @@ client.player.events.on("playerStart", async function(queue, track) {
new ButtonBuilder().setLabel("Open in Browser").setURL(track.url).setStyle(ButtonStyle.Link)
);
console.log(`> MUSIC playing "${track.title}" (${track.url}) by ${queue.metadata.requestMember.displayName}`);
client.user.setPresence({ activities: [{name: "custom", state: client.sessionStatusMessage, type: ActivityType.Custom}], status: "online" });
client.user.setPresence({ activities: [{ name: track.title, type: ActivityType.Playing }], status: "online" });
client.player.musicControlsMessage = await queue.metadata.textChannel.send({ content: `Started playing "${track.title}", as requested by <@${track.requestedBy.id}>.`, components: [controlButtons], flags: [MessageFlags.SuppressNotifications] });
});
// WHEN SONG STOPS PLAYING (END, STOP OR SKIP)
Expand Down
Loading

0 comments on commit 4c02808

Please sign in to comment.