From deab0d34402f3471cb20886ac166f51526790e41 Mon Sep 17 00:00:00 2001
From: Elysia <71698422+aiko-chan-ai@users.noreply.github.com>
Date: Mon, 15 Jan 2024 18:08:11 +0700
Subject: [PATCH] feat: setUsername with password
---
src/structures/ClientUser.js | 7 ++++---
typings/index.d.ts | 2 +-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/structures/ClientUser.js b/src/structures/ClientUser.js
index 080e1d7..e251d77 100644
--- a/src/structures/ClientUser.js
+++ b/src/structures/ClientUser.js
@@ -147,15 +147,16 @@ class ClientUser extends User {
* Changing usernames in Discord is heavily rate limited, with only 2 requests
* every hour. Use this sparingly!
* @param {string} username The new username
+ * @param {string} password Current Password
* @returns {Promise}
* @example
* // Set username
- * client.user.setUsername('discordjs')
+ * client.user.setUsername('discordjs', 'passw@rd')
* .then(user => console.log(`My new username is ${user.username}`))
* .catch(console.error);
*/
- setUsername(username) {
- return this.edit({ username });
+ setUsername(username, password) {
+ return this.edit({ username, password });
}
/**
diff --git a/typings/index.d.ts b/typings/index.d.ts
index d73d255..2be280b 100644
--- a/typings/index.d.ts
+++ b/typings/index.d.ts
@@ -860,7 +860,7 @@ export class ClientUser extends User {
public setAvatar(avatar: BufferResolvable | Base64Resolvable | null): Promise;
public setPresence(data: PresenceData): ClientPresence;
public setStatus(status: PresenceStatusData, shardId?: number | number[]): ClientPresence;
- public setUsername(username: string): Promise;
+ public setUsername(username: string, password: string): Promise;
public purchasedFlags: PurchasedFlags;
public premiumUsageFlags: PremiumUsageFlags;
public phone: string | null;