Skip to content

Commit

Permalink
feat: use name as fallback state
Browse files Browse the repository at this point in the history
  • Loading branch information
advaith1 authored and Jiralite committed Aug 12, 2023
1 parent 57292e8 commit 6aa4aad
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/discord.js/src/structures/ClientPresence.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const { GatewayOpcodes } = require('discord-api-types/v10');
const { GatewayOpcodes, ActivityType } = require('discord-api-types/v10');
const { Presence } = require('./Presence');
const { DiscordjsTypeError, ErrorCodes } = require('../errors');

Expand Down Expand Up @@ -51,7 +51,13 @@ class ClientPresence extends Presence {
if (typeof activity.name !== 'string') {
throw new DiscordjsTypeError(ErrorCodes.InvalidType, `activities[${i}].name`, 'string');
}
activity.type ??= 0;

activity.type ??= ActivityType.Playing;

if (activity.type === ActivityType.Custom && !activity.state) {
activity.state = activity.name;
activity.name = 'Custom Status';
}

data.activities.push({
type: activity.type,
Expand Down

0 comments on commit 6aa4aad

Please sign in to comment.