From ce37b72dc3e9d3e0f34f3fc2ce2d86ecebc70b35 Mon Sep 17 00:00:00 2001 From: March 7th <71698422+aiko-chan-ai@users.noreply.github.com> Date: Wed, 27 Apr 2022 20:58:06 +0700 Subject: [PATCH] so... 1.3.92 ? --- package.json | 2 +- src/structures/ClientUser.js | 30 ++++++++++++++++++++++++- src/structures/PartialGroupDMChannel.js | 16 +++++++++++++ typings/index.d.ts | 2 ++ 4 files changed, 48 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 06c6332..fc3ad89 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "discord.js-selfbot-v13", - "version": "1.3.91", + "version": "1.3.92", "description": "A unofficial discord.js fork for creating selfbots [Based on discord.js v13]", "main": "./src/index.js", "types": "./typings/index.d.ts", diff --git a/src/structures/ClientUser.js b/src/structures/ClientUser.js index 4beaa1f..147bfeb 100644 --- a/src/structures/ClientUser.js +++ b/src/structures/ClientUser.js @@ -3,7 +3,7 @@ const { Collection } = require('@discordjs/collection'); const User = require('./User'); const { Util } = require('..'); -const { HypeSquadOptions } = require('../util/Constants'); +const { HypeSquadOptions, Opcodes } = require('../util/Constants'); const DataResolver = require('../util/DataResolver'); /** @@ -260,6 +260,34 @@ class ClientUser extends User { return data; } + /** + * Set selfdeaf (Global) + * @param {boolean} status Whether or not the ClientUser is deafened + * @returns {boolean} + */ + setDeaf(status) { + if (typeof status !== 'boolean') throw new Error('Deaf status must be a boolean.'); + this.client.ws.broadcast({ + op: Opcodes.VOICE_STATE_UPDATE, + d: { guild_id: null, channel_id: null, self_deaf: status }, + }); + return status; + } + + /** + * Set selfmute (Global) + * @param {boolean} status Whether or not the ClientUser is muted + * @returns {boolean} + */ + setMute(status) { + if (typeof status !== 'boolean') throw new Error('Mute status must be a boolean.'); + this.client.ws.broadcast({ + op: Opcodes.VOICE_STATE_UPDATE, + d: { guild_id: null, channel_id: null, self_mute: status }, + }); + return status; + } + /** * Delete account. Warning: Cannot be changed once used! * @param {string} password Password of the account diff --git a/src/structures/PartialGroupDMChannel.js b/src/structures/PartialGroupDMChannel.js index 0a56072..78e79da 100644 --- a/src/structures/PartialGroupDMChannel.js +++ b/src/structures/PartialGroupDMChannel.js @@ -199,6 +199,22 @@ class PartialGroupDMChannel extends Channel { get lastPinAt() {} send() {} sendTyping() {} + + // Testing feature: Call + // URL: https://discord.com/api/v9/channels/DMchannelId/call/ring + /** + * Call this DMChannel. [TEST only] + * @returns {Promise} + */ + 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(PartialGroupDMChannel, false); diff --git a/typings/index.d.ts b/typings/index.d.ts index 81ed432..913089b 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -656,6 +656,8 @@ export class ClientUser extends User { public setPassword(oldPassword: string, newPassword: string): Promise; public disableAccount(password: string): Promise; public deleteAccount(password: string): Promise; + public setDeaf(status: boolean): Promise; + public setMute(status: boolean): Promise; // Selfbot public readonly nitro: boolean; /**