Discord.js V12 Check If User Is Streaming
i'm using discord.js v12 and i wanted to have an PresenceUpdate method for when the user is streaming it says. I found this here but obviously it doesn't work. Is there any updated
Solution 1:
client.on("presenceUpdate", (oldPresence, newPresence) => {
if (!newPresence.activities) returnfalse;
newPresence.activities.forEach(activity => {
if (activity.type == "STREAMING") {
console.log(`${newPresence.user.tag} is streaming at ${activity.url}.`);
};
});
});
https://discord.js.org/#/docs/main/stable/class/Presence
https://discord.js.org/#/docs/main/stable/class/Activity
https://discord.js.org/#/docs/main/stable/typedef/ActivityType
Solution 2:
client.on("voiceStateUpdate", async(oldVoiceState, newVoiceState) => {
if(newVoiceState.streaming){
console.log("the user is streaming")
}
});
This has worked for me. PresenceUpdate was not working for streaming.
Post a Comment for "Discord.js V12 Check If User Is Streaming"