Repository: discordjs/discord.js
File: packages/discord.js/src/structures/VoiceState.js (JavaScript)

Code before:

    if (!['boolean', 'undefined'].includes(typeof options.suppressed)) {
      throw new DiscordjsTypeError(ErrorCodes.VoiceStateInvalidType, 'suppressed');
    }

    await this.client.rest.patch(Routes.guildVoiceState(this.guild.id, target), {
      body: {
        channel_id: this.channelId,
        request_to_speak_timestamp: options.requestToSpeak
          ? new Date().toISOString()
          : options.requestToSpeak === false
            ? null
            : undefined,
        suppress: options.suppressed,
      },
    });
    return this;
  }

  /**
   * Fetches this voice state.
   * @param {boolean} [force=true] Whether to skip the cache check and request the API
   * @returns {Promise<VoiceState>}
   */
  fetch(force = true) {
    return this.guild.voiceStates.fetch(this.member, { force });
  }

  /**
   * Toggles the request to speak in the channel.
   * Only applicable for stage channels and for the client's own voice state.
   * @param {boolean} [requestToSpeak=true] Whether or not the client is requesting to become a speaker.
   * @example
   * // Making the client request to speak in a stage channel (raise its hand)
   * guild.members.me.voice.setRequestToSpeak(true);
   * @example
   * // Making the client cancel a request to speak
   * guild.members.me.voice.setRequestToSpeak(false);
   * @returns {Promise<VoiceState>}
   */
  setRequestToSpeak(requestToSpeak = true) {
    return this.edit({ requestToSpeak });
  }

  /**
   * Suppress/unsuppress the user. Only applicable for stage channels.
   * @param {boolean} [suppressed=true] Whether or not the user should be suppressed.
   * @example
   * // Making the client a speaker
   * guild.members.me.voice.setSuppressed(false);
   * @example

Review comment (suggestion):
Yes, it resolves, but I think id would be more suitable
```suggestion
    return this.guild.voiceStates.fetch(this.id, { force });
```

Code after:

    if (!['boolean', 'undefined'].includes(typeof options.suppressed)) {
      throw new DiscordjsTypeError(ErrorCodes.VoiceStateInvalidType, 'suppressed');
    }

    await this.client.rest.patch(Routes.guildVoiceState(this.guild.id, target), {
      body: {
        channel_id: this.channelId,
        request_to_speak_timestamp: options.requestToSpeak
          ? new Date().toISOString()
          : options.requestToSpeak === false
            ? null
            : undefined,
        suppress: options.suppressed,
      },
    });
    return this;
  }

  /**
   * Fetches this voice state.
   * @param {boolean} [force=true] Whether to skip the cache check and request the API
   * @returns {Promise<VoiceState>}
   */
  fetch(force = true) {
    return this.guild.voiceStates.fetch(this.id, { force });
  }

  /**
   * Toggles the request to speak in the channel.
   * Only applicable for stage channels and for the client's own voice state.
   * @param {boolean} [requestToSpeak=true] Whether or not the client is requesting to become a speaker.
   * @example
   * // Making the client request to speak in a stage channel (raise its hand)
   * guild.members.me.voice.setRequestToSpeak(true);
   * @example
   * // Making the client cancel a request to speak
   * guild.members.me.voice.setRequestToSpeak(false);
   * @returns {Promise<VoiceState>}
   */
  setRequestToSpeak(requestToSpeak = true) {
    return this.edit({ requestToSpeak });
  }

  /**
   * Suppress/unsuppress the user. Only applicable for stage channels.
   * @param {boolean} [suppressed=true] Whether or not the user should be suppressed.
   * @example
   * // Making the client a speaker
   * guild.members.me.voice.setSuppressed(false);
   * @example