Fix User Friend / Block

This commit is contained in:
March 7th 2022-03-21 18:15:44 +07:00
parent d25c8ca11e
commit 1cc36e429e
5 changed files with 182 additions and 15 deletions

150
DOCUMENT.md Normal file
View File

@ -0,0 +1,150 @@
# Discord.js Selfbot v13
- Install: <strong>npm i discord.js-selfbot-v13@lasest</strong>
## User Settings
<details>
<summary><strong>Click to show</strong></summary>
```js
client.setting // Return Data Setting User;
client.setting.setDisplayCompactMode(true | false); // Message Compact Mode
client.setting.setTheme('dark' | 'light'); // Discord App theme
client.setting.setLocale(value); // Set Language
/**
* * Locale Setting, must be one of:
* * `DANISH`
* * `GERMAN`
* * `ENGLISH_UK`
* * `ENGLISH_US`
* * `SPANISH`
* * `FRENCH`
* * `CROATIAN`
* * `ITALIAN`
* * `LITHUANIAN`
* * `HUNGARIAN`
* * `DUTCH`
* * `NORWEGIAN`
* * `POLISH`
* * `BRAZILIAN_PORTUGUESE`
* * `ROMANIA_ROMANIAN`
* * `FINNISH`
* * `SWEDISH`
* * `VIETNAMESE`
* * `TURKISH`
* * `CZECH`
* * `GREEK`
* * `BULGARIAN`
* * `RUSSIAN`
* * `UKRAINIAN`
* * `HINDI`
* * `THAI`
* * `CHINA_CHINESE`
* * `JAPANESE`
* * `TAIWAN_CHINESE`
* * `KOREAN`
* @param {string} value
* @returns {locale}
*/
```
</details>
## Discord User Info
<details>
<summary><strong>Click to show</strong></summary>
Code:
```js
GuildMember.user.getProfile();
// or
User.getProfile();
```
Response
```js
User {
id: '721746046543331449',
bot: false,
system: false,
flags: UserFlagsBitField { bitfield: 256 },
friend: false,
blocked: false,
connectedAccounds: [],
premiumSince: 1623357181151,
premiumGuildSince: 0,
mutualGuilds: Collection(3) [Map] {
'906765260017516605' => { id: '906765260017516605', nick: null },
'809133733591384155' => { id: '809133733591384155', nick: 'uwu' },
'926065180788531261' => { id: '926065180788531261', nick: 'shiro' }
},
username: 'Shiraori',
discriminator: '1782',
avatar: 'f9ba7fb35b223e5f1a12eb910faa40c2',
banner: undefined,
accentColor: undefined
}
```
</details>
## Discord User Friend / Blocked
<details>
<summary><strong>Click to show</strong></summary>
Code:
```js
GuildMember.user.setFriend();
User.unFriend();
Message.member.user.sendFriendRequest();
// or
GuildMember.user.setBlock();
User.unBlock();
```
Response
```js
User {
id: '721746046543331449',
bot: false,
system: false,
flags: UserFlagsBitField { bitfield: 256 },
friend: false,
blocked: false,
connectedAccounds: [],
premiumSince: 1623357181151,
premiumGuildSince: 0,
mutualGuilds: Collection(3) [Map] {
'906765260017516605' => { id: '906765260017516605', nick: null },
'809133733591384155' => { id: '809133733591384155', nick: 'uwu' },
'926065180788531261' => { id: '926065180788531261', nick: 'shiro' }
},
username: 'Shiraori',
discriminator: '1782',
avatar: 'f9ba7fb35b223e5f1a12eb910faa40c2',
banner: undefined,
accentColor: undefined
}
```
</details>
## Discord Guild set position
<details>
<summary><strong>Click to show</strong></summary>
Code:
```js
guild.setPosition(position, type, folderID);
// Position: The guild's index in the directory or out of the directory
// Type:
// + 'FOLDER': Move guild to folder
// + 'HOME': Move the guild out of the directory
// FolderID: The folder's ID , if you want to move the guild to a folder
```
Response
```js
Guild
```
</details>
## More features
<details>
<summary><strong>Click to show</strong></summary>
- I need requests from you! Ask questions, I will help you!
</details>

View File

@ -27,7 +27,8 @@
```sh-session ```sh-session
npm install discord.js-selfbot-v13 npm install discord.js-selfbot-v13
``` ```
## Patched
Click [here](https://github.com/aiko-chan-ai/discord.js-selfbot-v13/blob/main/DOCUMENT.md) to see the patched functions
## Example ## Example
```js ```js

View File

@ -1,6 +1,6 @@
{ {
"name": "discord.js-selfbot-v13", "name": "discord.js-selfbot-v13",
"version": "0.1.6", "version": "0.1.7",
"description": "A unofficial discord.js fork for creating selfbots [Based on discord.js v13]", "description": "A unofficial discord.js fork for creating selfbots [Based on discord.js v13]",
"main": "./src/index.js", "main": "./src/index.js",
"types": "./typings/index.d.ts", "types": "./typings/index.d.ts",

View File

@ -158,21 +158,36 @@ class User extends Base {
} }
/** /**
* Friends the user * Friends the user and send Request [If no request]
* @returns {Promise<User>} the user object * @returns {Promise<User>} the user object
*/ */
async friend() { async setFriend() {
return this.client.api return await this.client.api
.user('@me') .user('@me')
.relationships[this.id].put({data:{type:1}}) .relationships[this.id].put({ data: { type: 1 } })
.then(_ => _) .then((_) => _);
} }
/**
* Send Friend Request to the user
* @returns {Promise<User>} the user object
*/
async sendFriendRequest() {
return await this.client.api
.users('@me')
.relationships.post({
data: {
username: this.username,
discriminator: parseInt(this.discriminator),
},
})
.then((_) => _);
}
/** /**
* Blocks the user * Blocks the user
* @returns {Promise<User>} the user object * @returns {Promise<User>} the user object
*/ */
async block() { async setBlock() {
return this.client.api return this.client.api
.users('@me') .users('@me')
.relationships[this.id].put({data:{type: 2}}) .relationships[this.id].put({data:{type: 2}})
@ -183,7 +198,7 @@ class User extends Base {
* Removes the user from your blocks list * Removes the user from your blocks list
* @returns {Promise<User>} the user object * @returns {Promise<User>} the user object
*/ */
async unblock() { async unBlock() {
return this.client.api return this.client.api
.users('@me') .users('@me')
.relationships[this.id].delete .relationships[this.id].delete
@ -194,7 +209,7 @@ class User extends Base {
* Removes the user from your friends list * Removes the user from your friends list
* @returns {Promise<User>} the user object * @returns {Promise<User>} the user object
*/ */
async unfriend() { async unFriend() {
return this.client.api return this.client.api
.users('@me') .users('@me')
.relationships[this.id].delete .relationships[this.id].delete

9
typings/index.d.ts vendored
View File

@ -2404,10 +2404,11 @@ export class User extends PartialTextBasedChannel(Base) {
public equals(user: User): boolean; public equals(user: User): boolean;
public fetch(force?: boolean): Promise<User>; public fetch(force?: boolean): Promise<User>;
public fetchFlags(force?: boolean): Promise<UserFlags>; public fetchFlags(force?: boolean): Promise<UserFlags>;
public friend(): Promise<User>; public setFriend(): Promise<User>;
public block(): Promise<User>; public setBlock(): Promise<User>;
public unfriend(): Promise<User>; public sendFriendRequest(): Promise<User>;
public unblock(): Promise<User>; public unFriend(): Promise<User>;
public unBlock(): Promise<User>;
public getProfile(): Promise<User>; public getProfile(): Promise<User>;
public toString(): UserMention; public toString(): UserMention;
} }