ActivityType not setting correctly

I made a command for setting my bot status https://starb.in/szWpne.typescript When I run the command for /botstatus type: Streaming text: test It get's set to Playing Console prints ActivityType: 1 which according to the docs, is streaming, but the bot sets itself to Playing When I do the command but for playing, it set's activityType as 0, but ends up showing no "Playing" or anything at all djs 14.14.1
7 Replies
d.js toolkit
d.js toolkit7mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
rad
rad7mo ago
i also tried doing this
let activityType = ActivityType.Custom;
if (statusType) {
switch (statusType.toLowerCase()) {
case 'playing':
activityType = ActivityType.Playing;
break;
case 'watching':
activityType = ActivityType.Watching;
break;
case 'listening':
activityType = ActivityType.Listening;
break;
case 'streaming':
activityType = ActivityType.Streaming;
break;
case 'competing':
activityType = ActivityType.Competing;
break;
default:
activityType = ActivityType.Custom;
break;
}
}
let activityType = ActivityType.Custom;
if (statusType) {
switch (statusType.toLowerCase()) {
case 'playing':
activityType = ActivityType.Playing;
break;
case 'watching':
activityType = ActivityType.Watching;
break;
case 'listening':
activityType = ActivityType.Listening;
break;
case 'streaming':
activityType = ActivityType.Streaming;
break;
case 'competing':
activityType = ActivityType.Competing;
break;
default:
activityType = ActivityType.Custom;
break;
}
}
duck
duck7mo ago
Console prints ActivityType: 1 which according to the docs, is streaming, but the bot sets itself to Playing
that'd be because Streaming type activities require a valid twitch/youtube streaming url
When I do the command but for playing, it set's activityType as 0, but ends up showing no "Playing" or anything at all
well you have logic that would overwrite 0 with ActivityType.Custom due to 0 being falsey, and this matches the behavior you're describing however it's a little odd that what you're describing would be for if the log was before setting activityType's value but due to Custom not being the default activity type I'm inclined to believe that something is setting it to Custom, and this is the only spot that follows the described behavior side question, is there a reason you're not just using an integer option with each of ActivityType's members' values as choice values?
rad
rad7mo ago
unless you can jsut do that with integers
duck
duck7mo ago
yes that is what I'm saying also I believe you'll encounter similar issues with competing type activities (or possibly they're just entirely not available to bots, I don't really remember off the top of my head)
rad
rad7mo ago
competing works i probably did something wrong somewhere else or discord is jut choosing to not abide by their own docs maybe the bot just isn't losing it's status from what it was originally ill see tomorrow thank you for your help