Adding feature
voiceState.getPreview(): Return URL Image Stream .-.
This commit is contained in:
		@@ -170,6 +170,7 @@ const Messages = {
 | 
			
		||||
  MESSAGE_ID_NOT_FOUND: 'Message ID not found',
 | 
			
		||||
  MESSAGE_EMBED_LINK_LENGTH: 'Message content with embed link length is too long',
 | 
			
		||||
  GUILD_MEMBERS_FETCH: msg => `${msg}`,
 | 
			
		||||
  USER_NOT_STREAMING: 'User is not streaming',
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
for (const [name, message] of Object.entries(Messages)) register(name, message);
 | 
			
		||||
 
 | 
			
		||||
@@ -63,8 +63,8 @@ class APIRequest {
 | 
			
		||||
      }
 | 
			
		||||
      headers = Object.assign(headers, body.getHeaders());
 | 
			
		||||
      // eslint-disable-next-line eqeqeq
 | 
			
		||||
    } else if (this.options.data != null) {
 | 
			
		||||
      body = JSON.stringify(this.options.data);
 | 
			
		||||
    } else if (this.options.data != null || this.options.usingApplicationJson) {
 | 
			
		||||
      body = this.options.data ? JSON.stringify(this.options.data) : undefined;
 | 
			
		||||
      headers['Content-Type'] = 'application/json';
 | 
			
		||||
    } else if (this.options.body != null) {
 | 
			
		||||
      body = new FormData();
 | 
			
		||||
 
 | 
			
		||||
@@ -94,6 +94,21 @@ class DMChannel extends Channel {
 | 
			
		||||
  createMessageComponentCollector() {}
 | 
			
		||||
  awaitMessageComponent() {}
 | 
			
		||||
  // Doesn't work on DM channels; bulkDelete() {}
 | 
			
		||||
  // Testing feature: Call
 | 
			
		||||
  // URL: https://discord.com/api/v9/channels/DMchannelId/call/ring
 | 
			
		||||
  /**
 | 
			
		||||
   * Call this DMChannel. [TEST only]
 | 
			
		||||
   * @returns {Promise<void>}
 | 
			
		||||
   */
 | 
			
		||||
  call() {
 | 
			
		||||
    console.log('TEST only, and not working !');
 | 
			
		||||
    return this.client.api.channels(this.id).call.ring.post({
 | 
			
		||||
      usingApplicationJson: true,
 | 
			
		||||
      data: {
 | 
			
		||||
        recipients: null,
 | 
			
		||||
      },
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TextBasedChannel.applyToClass(DMChannel, true, ['bulkDelete']);
 | 
			
		||||
 
 | 
			
		||||
@@ -259,6 +259,19 @@ class VoiceState extends Base {
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Get URL Image of the user's streaming video (NOT STREAMING !!!)
 | 
			
		||||
   * @returns {string} URL Image of the user's streaming video
 | 
			
		||||
   */
 | 
			
		||||
  async getPreview() {
 | 
			
		||||
    if (!this.streaming) throw new Error('USER_NOT_STREAMING');
 | 
			
		||||
    // URL: https://discord.com/api/v9/streams/guild:guildid:voicechannelid:userid/preview
 | 
			
		||||
    const data = await this.client.api.streams[
 | 
			
		||||
      `guild%3A${this.guild.id}%3A${this.channelId}%3A${this.id}`
 | 
			
		||||
    ].preview.get();
 | 
			
		||||
    return data.url;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  toJSON() {
 | 
			
		||||
    return super.toJSON({
 | 
			
		||||
      id: true,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user