1.3.3
Change logs: + New Event: > relationshipAdd: user.id, type > relationshipRemove: user.id > client.relationships: RelationshipsManager > User.relationships > Update Document .-. - DEPRECATED > client.blocked > client.friends > clientUser.findFriend > User.blocked > User.friend > some console.log()
This commit is contained in:
parent
89d8b08a08
commit
f73525f278
@ -93,6 +93,7 @@ User {
|
||||
|
||||
Code:
|
||||
```js
|
||||
// You can use client.relationships to manage your friends and blocked users.
|
||||
GuildMember.user.setFriend();
|
||||
User.unFriend();
|
||||
Message.member.user.sendFriendRequest();
|
||||
@ -208,6 +209,7 @@ And you can change the status 5 times every 20 seconds!
|
||||
await client.user.setHypeSquad('HOUSE_BRAVERY');
|
||||
await client.user.setHypeSquad('HOUSE_BRILLIANCE');
|
||||
await client.user.setHypeSquad('HOUSE_BALANCE');
|
||||
await client.user.setHypeSquad('LEAVE');
|
||||
// Set Note to User
|
||||
await user.setNote('Hello World');
|
||||
// Set Username
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "discord.js-selfbot-v13",
|
||||
"version": "1.3.2",
|
||||
"version": "1.3.3",
|
||||
"description": "A unofficial discord.js fork for creating selfbots [Based on discord.js v13]",
|
||||
"main": "./src/index.js",
|
||||
"types": "./typings/index.d.ts",
|
||||
|
@ -29,8 +29,7 @@ const Options = require('../util/Options');
|
||||
const Permissions = require('../util/Permissions');
|
||||
const Sweepers = require('../util/Sweepers');
|
||||
// Patch
|
||||
const FriendsManager = require('../managers/FriendsManager');
|
||||
const BlockedManager = require('../managers/BlockedManager');
|
||||
const RelationshipsManager = require('../managers/RelationshipsManager');
|
||||
const ClientUserSettingManager = require('../managers/ClientUserSettingManager');
|
||||
|
||||
/**
|
||||
@ -129,8 +128,7 @@ class Client extends BaseClient {
|
||||
/** Patch
|
||||
*
|
||||
*/
|
||||
this.friends = new FriendsManager(this);
|
||||
this.blocked = new BlockedManager(this);
|
||||
this.relationships = new RelationshipsManager(this);
|
||||
this.setting = new ClientUserSettingManager(this);
|
||||
/**
|
||||
* All of the guilds the client is currently handling, mapped by their ids -
|
||||
|
@ -38,9 +38,9 @@ module.exports = (client, { d: data }, shard) => {
|
||||
// console.log(data);
|
||||
if (client.options.checkUpdate) {
|
||||
try {
|
||||
checkUpdate()
|
||||
checkUpdate();
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
console.log(e);
|
||||
}
|
||||
};
|
||||
client.session_id = data.session_id;
|
||||
@ -52,11 +52,6 @@ module.exports = (client, { d: data }, shard) => {
|
||||
client.users.cache.set(client.user.id, client.user);
|
||||
}
|
||||
|
||||
console.log(`
|
||||
${chalk.yellow(
|
||||
`Can you take a look at this notice and give me your opinion?\nhttps://github.com/aiko-chan-ai/discord.js-selfbot-v13/issues/29`,
|
||||
)}`);
|
||||
|
||||
client.user.setAFK(false);
|
||||
|
||||
client.setting.fetch().then(async (res) => {
|
||||
@ -88,13 +83,7 @@ ${chalk.yellow(
|
||||
client.guilds._add(guild);
|
||||
}
|
||||
|
||||
for (const r of data.relationships) {
|
||||
if (r.type == 1) {
|
||||
client.friends.cache.set(r.id, new User(client, r.user));
|
||||
} else if (r.type == 2) {
|
||||
client.blocked.cache.set(r.id, new User(client, r.user));
|
||||
}
|
||||
}
|
||||
client.relationships._setup(data.relationships);
|
||||
|
||||
shard.checkReady();
|
||||
};
|
||||
|
15
src/client/websocket/handlers/RELATIONSHIP_ADD.js
Normal file
15
src/client/websocket/handlers/RELATIONSHIP_ADD.js
Normal file
@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
const { Events } = require('../../../util/Constants');
|
||||
|
||||
module.exports = (client, { d: data }) => {
|
||||
data.user ? client.users._add(data.user) : null;
|
||||
client.relationships.cache.set(data.id, data.type);
|
||||
/**
|
||||
* Emitted whenever a relationship is updated.
|
||||
* @event Client#relationshipUpdate
|
||||
* @param {UserID} user The userID that was updated
|
||||
* @param {Number} type The new relationship type
|
||||
*/
|
||||
client.emit(Events.RELATIONSHIP_ADD, data.id, data.type);
|
||||
};
|
13
src/client/websocket/handlers/RELATIONSHIP_REMOVE.js
Normal file
13
src/client/websocket/handlers/RELATIONSHIP_REMOVE.js
Normal file
@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
const { Events } = require('../../../util/Constants');
|
||||
|
||||
module.exports = (client, { d: data }) => {
|
||||
client.relationships.cache.delete(data.id);
|
||||
/**
|
||||
* Emitted whenever a relationship is updated.
|
||||
* @event Client#relationshipUpdate
|
||||
* @param {UserID} user The userID that was updated
|
||||
*/
|
||||
client.emit(Events.RELATIONSHIP_REMOVE, data.id);
|
||||
};
|
@ -3,6 +3,8 @@
|
||||
const handlers = Object.fromEntries([
|
||||
['READY', require('./READY')],
|
||||
['RESUMED', require('./RESUMED')],
|
||||
['RELATIONSHIP_ADD', require('./RELATIONSHIP_ADD')],
|
||||
['RELATIONSHIP_REMOVE', require('./RELATIONSHIP_REMOVE')],
|
||||
['APPLICATION_COMMAND_CREATE', require('./APPLICATION_COMMAND_CREATE')],
|
||||
['APPLICATION_COMMAND_DELETE', require('./APPLICATION_COMMAND_DELETE')],
|
||||
['APPLICATION_COMMAND_UPDATE', require('./APPLICATION_COMMAND_UPDATE')],
|
||||
@ -16,7 +18,7 @@ const handlers = Object.fromEntries([
|
||||
['GUILD_MEMBER_UPDATE', require('./GUILD_MEMBER_UPDATE')],
|
||||
['GUILD_MEMBERS_CHUNK', require('./GUILD_MEMBERS_CHUNK')],
|
||||
['GUILD_MEMBER_LIST_UPDATE', require('./GUILD_MEMBER_LIST_UPDATE.js')],
|
||||
['GUILD_INTEGRATIONS_UPDATE', require('./GUILD_INTEGRATIONS_UPDATE')],
|
||||
['GUILD_INTEGRATIONS_UPDATE', require('./GUILD_INTEGRATIONS_UPDATE')],
|
||||
['GUILD_ROLE_CREATE', require('./GUILD_ROLE_CREATE')],
|
||||
['GUILD_ROLE_DELETE', require('./GUILD_ROLE_DELETE')],
|
||||
['GUILD_ROLE_UPDATE', require('./GUILD_ROLE_UPDATE')],
|
||||
|
@ -65,6 +65,7 @@ exports.UserManager = require('./managers/UserManager');
|
||||
exports.VoiceStateManager = require('./managers/VoiceStateManager');
|
||||
exports.WebSocketManager = require('./client/websocket/WebSocketManager');
|
||||
exports.WebSocketShard = require('./client/websocket/WebSocketShard');
|
||||
exports.RelationshipsManager = require('./managers/RelationshipsManager');
|
||||
|
||||
// Structures
|
||||
exports.Activity = require('./structures/Presence').Activity;
|
||||
|
@ -432,7 +432,6 @@ class GuildMemberManager extends CachedManager {
|
||||
},
|
||||
});
|
||||
} else {
|
||||
console.log('send lazy quest')
|
||||
let channel;
|
||||
let channels = this.guild.channels.cache.filter(c => c.isText());
|
||||
channels = channels.filter(c => c.permissionsFor(this.guild.me).has('VIEW_CHANNEL'));
|
||||
|
115
src/managers/RelationshipsManager.js
Normal file
115
src/managers/RelationshipsManager.js
Normal file
@ -0,0 +1,115 @@
|
||||
'use strict';
|
||||
|
||||
const { Collection } = require('@discordjs/collection');
|
||||
const { GuildMember } = require('../structures/GuildMember');
|
||||
const { Message } = require('../structures/Message');
|
||||
const ThreadMember = require('../structures/ThreadMember');
|
||||
const User = require('../structures/User');
|
||||
const { RelationshipTypes } = require('../util/Constants');
|
||||
|
||||
/**
|
||||
* Manages API methods for users and stores their cache.
|
||||
*/
|
||||
class RelationshipsManager {
|
||||
constructor(client, users) {
|
||||
this.client = client;
|
||||
this.cache = new Collection();
|
||||
this._setup(users);
|
||||
}
|
||||
|
||||
_setup(users) {
|
||||
if (!Array.isArray(users)) return;
|
||||
for (const relationShip of users) {
|
||||
this.cache.set(relationShip.id, relationShip.type);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves a {@link UserResolvable} to a {@link User} id.
|
||||
* @param {UserResolvable} user The UserResolvable to identify
|
||||
* @returns {?Snowflake}
|
||||
*/
|
||||
resolveId(user) {
|
||||
if (user instanceof ThreadMember) return user.id;
|
||||
if (user instanceof GuildMember) return user.user.id;
|
||||
if (user instanceof Message) return user.author.id;
|
||||
if (user instanceof User) return user.id;
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains a user from Discord, or the user cache if it's already available.
|
||||
* @param {UserResolvable} user The user to fetch
|
||||
* @param {BaseFetchOptions} [options] Additional options for this fetch
|
||||
* @returns {Promise<User>}
|
||||
*/
|
||||
async fetch(user, { cache = true, force = false } = {}) {
|
||||
const id = this.resolveId(user);
|
||||
if (!force) {
|
||||
const existing = this.cache.get(id);
|
||||
if (existing && !existing.partial) return existing;
|
||||
}
|
||||
|
||||
const data = await this.client.api.users['@me'].relationships.get();
|
||||
await this._setup(data);
|
||||
return this.cache.get(id);
|
||||
}
|
||||
|
||||
// some option .-.
|
||||
|
||||
async deleteFriend(user) {
|
||||
const id = this.resolveId(user);
|
||||
// check if already friends
|
||||
if (this.cache.get(id) !== RelationshipTypes.FRIEND) return false;
|
||||
await this.client.api.users['@me'].relationships[id].delete(); // 204 status and no data
|
||||
return true;
|
||||
}
|
||||
|
||||
async deleteBlocked(user) {
|
||||
const id = this.resolveId(user);
|
||||
// check if already blocked
|
||||
if (this.cache.get(id) !== RelationshipTypes.BLOCKED) return false;
|
||||
await this.client.api.users['@me'].relationships[id].delete(); // 204 status and no data
|
||||
return true;
|
||||
}
|
||||
|
||||
async sendFriendRequest(username, discriminator) {
|
||||
await this.client.api.users('@me').relationships.post({
|
||||
data: {
|
||||
username,
|
||||
discriminator: parseInt(discriminator),
|
||||
},
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
async addFriend(user) {
|
||||
const id = this.resolveId(user);
|
||||
// check if already friends
|
||||
if (this.cache.get(id) === RelationshipTypes.FRIEND) return false;
|
||||
// check if outgoing request
|
||||
if (this.cache.get(id) === RelationshipTypes.OUTGOING_REQUEST) return false;
|
||||
await this.client.api
|
||||
.users['@me'].relationships[id].put({
|
||||
data: {
|
||||
type: RelationshipTypes.FRIEND,
|
||||
},
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
async addBlocked(user) {
|
||||
const id = this.resolveId(user);
|
||||
// check
|
||||
if (this.cache.get(id) === RelationshipTypes.BLOCKED) return false;
|
||||
await this.client.api
|
||||
.users['@me'].relationships[id].put({
|
||||
data: {
|
||||
type: RelationshipTypes.BLOCKED,
|
||||
},
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = RelationshipsManager;
|
@ -7,6 +7,7 @@ const SnowflakeUtil = require('../util/SnowflakeUtil');
|
||||
const UserFlags = require('../util/UserFlags');
|
||||
const { default: Collection } = require('@discordjs/collection');
|
||||
const ApplicationCommandManager = require('../managers/ApplicationCommandManager');
|
||||
const { Relationship } = require('../util/Constants');
|
||||
|
||||
/**
|
||||
* Represents a user on Discord.
|
||||
@ -129,18 +130,12 @@ class User extends Base {
|
||||
}
|
||||
|
||||
/**
|
||||
* Friend ?
|
||||
* Check relationship status
|
||||
* @readonly
|
||||
*/
|
||||
get friend() {
|
||||
return this.client.friends.cache.has(this.id);
|
||||
}
|
||||
/**
|
||||
* Blocked ?
|
||||
* @readonly
|
||||
*/
|
||||
get blocked() {
|
||||
return this.client.blocked.cache.has(this.id);
|
||||
get relationships() {
|
||||
const i = this.client.relationships.cache.get(this.id) ?? 0;
|
||||
return Relationship[parseInt(i)];
|
||||
}
|
||||
|
||||
// Code written by https://github.com/aiko-chan-ai
|
||||
@ -185,10 +180,7 @@ class User extends Base {
|
||||
* @returns {Promise<User>} the user object
|
||||
*/
|
||||
async setFriend() {
|
||||
return await this.client.api
|
||||
.user('@me')
|
||||
.relationships[this.id].put({ data: { type: 1 } })
|
||||
.then((_) => _);
|
||||
return this.client.relationships.addFriend(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -196,25 +188,14 @@ class User extends Base {
|
||||
* @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((_) => _);
|
||||
return this.client.relationships.sendFriendRequest(this.username, this.discriminator);
|
||||
}
|
||||
/**
|
||||
* Blocks the user
|
||||
* @returns {Promise<User>} the user object
|
||||
*/
|
||||
async setBlock() {
|
||||
return this.client.api
|
||||
.users('@me')
|
||||
.relationships[this.id].put({ data: { type: 2 } })
|
||||
.then((_) => _);
|
||||
return this.client.relationships.addBlocked(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -222,19 +203,15 @@ class User extends Base {
|
||||
* @returns {Promise<User>} the user object
|
||||
*/
|
||||
async unBlock() {
|
||||
return this.client.api
|
||||
.users('@me')
|
||||
.relationships[this.id].delete.then((_) => _);
|
||||
return this.client.relationships.deleteBlocked(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the user from your friends list
|
||||
* @returns {Promise<User>} the user object
|
||||
*/
|
||||
async unFriend() {
|
||||
return this.client.api
|
||||
.users('@me')
|
||||
.relationships[this.id].delete.then((_) => _);
|
||||
unFriend() {
|
||||
return this.client.relationships.deleteFriend(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -284,91 +284,93 @@ exports.Opcodes = {
|
||||
};
|
||||
|
||||
exports.Events = {
|
||||
RATE_LIMIT: 'rateLimit',
|
||||
INVALID_REQUEST_WARNING: 'invalidRequestWarning',
|
||||
API_RESPONSE: 'apiResponse',
|
||||
API_REQUEST: 'apiRequest',
|
||||
CLIENT_READY: 'ready',
|
||||
/**
|
||||
* @deprecated See {@link https://github.com/discord/discord-api-docs/issues/3690 this issue} for more information.
|
||||
*/
|
||||
APPLICATION_COMMAND_CREATE: 'applicationCommandCreate',
|
||||
/**
|
||||
* @deprecated See {@link https://github.com/discord/discord-api-docs/issues/3690 this issue} for more information.
|
||||
*/
|
||||
APPLICATION_COMMAND_DELETE: 'applicationCommandDelete',
|
||||
/**
|
||||
* @deprecated See {@link https://github.com/discord/discord-api-docs/issues/3690 this issue} for more information.
|
||||
*/
|
||||
APPLICATION_COMMAND_UPDATE: 'applicationCommandUpdate',
|
||||
GUILD_CREATE: 'guildCreate',
|
||||
GUILD_DELETE: 'guildDelete',
|
||||
GUILD_UPDATE: 'guildUpdate',
|
||||
GUILD_UNAVAILABLE: 'guildUnavailable',
|
||||
GUILD_MEMBER_ADD: 'guildMemberAdd',
|
||||
GUILD_MEMBER_REMOVE: 'guildMemberRemove',
|
||||
GUILD_MEMBER_UPDATE: 'guildMemberUpdate',
|
||||
GUILD_MEMBER_AVAILABLE: 'guildMemberAvailable',
|
||||
GUILD_MEMBERS_CHUNK: 'guildMembersChunk',
|
||||
GUILD_MEMBER_LIST_UPDATE: 'guildMemberListUpdate',
|
||||
GUILD_INTEGRATIONS_UPDATE: 'guildIntegrationsUpdate',
|
||||
GUILD_ROLE_CREATE: 'roleCreate',
|
||||
GUILD_ROLE_DELETE: 'roleDelete',
|
||||
INVITE_CREATE: 'inviteCreate',
|
||||
INVITE_DELETE: 'inviteDelete',
|
||||
GUILD_ROLE_UPDATE: 'roleUpdate',
|
||||
GUILD_EMOJI_CREATE: 'emojiCreate',
|
||||
GUILD_EMOJI_DELETE: 'emojiDelete',
|
||||
GUILD_EMOJI_UPDATE: 'emojiUpdate',
|
||||
GUILD_BAN_ADD: 'guildBanAdd',
|
||||
GUILD_BAN_REMOVE: 'guildBanRemove',
|
||||
CHANNEL_CREATE: 'channelCreate',
|
||||
CHANNEL_DELETE: 'channelDelete',
|
||||
CHANNEL_UPDATE: 'channelUpdate',
|
||||
CHANNEL_PINS_UPDATE: 'channelPinsUpdate',
|
||||
MESSAGE_CREATE: 'messageCreate',
|
||||
MESSAGE_DELETE: 'messageDelete',
|
||||
MESSAGE_UPDATE: 'messageUpdate',
|
||||
MESSAGE_BULK_DELETE: 'messageDeleteBulk',
|
||||
MESSAGE_REACTION_ADD: 'messageReactionAdd',
|
||||
MESSAGE_REACTION_REMOVE: 'messageReactionRemove',
|
||||
MESSAGE_REACTION_REMOVE_ALL: 'messageReactionRemoveAll',
|
||||
MESSAGE_REACTION_REMOVE_EMOJI: 'messageReactionRemoveEmoji',
|
||||
THREAD_CREATE: 'threadCreate',
|
||||
THREAD_DELETE: 'threadDelete',
|
||||
THREAD_UPDATE: 'threadUpdate',
|
||||
THREAD_LIST_SYNC: 'threadListSync',
|
||||
THREAD_MEMBER_UPDATE: 'threadMemberUpdate',
|
||||
THREAD_MEMBERS_UPDATE: 'threadMembersUpdate',
|
||||
USER_UPDATE: 'userUpdate',
|
||||
PRESENCE_UPDATE: 'presenceUpdate',
|
||||
VOICE_SERVER_UPDATE: 'voiceServerUpdate',
|
||||
VOICE_STATE_UPDATE: 'voiceStateUpdate',
|
||||
TYPING_START: 'typingStart',
|
||||
WEBHOOKS_UPDATE: 'webhookUpdate',
|
||||
INTERACTION_CREATE: 'interactionCreate',
|
||||
ERROR: 'error',
|
||||
WARN: 'warn',
|
||||
DEBUG: 'debug',
|
||||
CACHE_SWEEP: 'cacheSweep',
|
||||
SHARD_DISCONNECT: 'shardDisconnect',
|
||||
SHARD_ERROR: 'shardError',
|
||||
SHARD_RECONNECTING: 'shardReconnecting',
|
||||
SHARD_READY: 'shardReady',
|
||||
SHARD_RESUME: 'shardResume',
|
||||
INVALIDATED: 'invalidated',
|
||||
RAW: 'raw',
|
||||
STAGE_INSTANCE_CREATE: 'stageInstanceCreate',
|
||||
STAGE_INSTANCE_UPDATE: 'stageInstanceUpdate',
|
||||
STAGE_INSTANCE_DELETE: 'stageInstanceDelete',
|
||||
GUILD_STICKER_CREATE: 'stickerCreate',
|
||||
GUILD_STICKER_DELETE: 'stickerDelete',
|
||||
GUILD_STICKER_UPDATE: 'stickerUpdate',
|
||||
GUILD_SCHEDULED_EVENT_CREATE: 'guildScheduledEventCreate',
|
||||
GUILD_SCHEDULED_EVENT_UPDATE: 'guildScheduledEventUpdate',
|
||||
GUILD_SCHEDULED_EVENT_DELETE: 'guildScheduledEventDelete',
|
||||
GUILD_SCHEDULED_EVENT_USER_ADD: 'guildScheduledEventUserAdd',
|
||||
GUILD_SCHEDULED_EVENT_USER_REMOVE: 'guildScheduledEventUserRemove',
|
||||
RATE_LIMIT: 'rateLimit',
|
||||
INVALID_REQUEST_WARNING: 'invalidRequestWarning',
|
||||
API_RESPONSE: 'apiResponse',
|
||||
API_REQUEST: 'apiRequest',
|
||||
CLIENT_READY: 'ready',
|
||||
/**
|
||||
* @deprecated See {@link https://github.com/discord/discord-api-docs/issues/3690 this issue} for more information.
|
||||
*/
|
||||
APPLICATION_COMMAND_CREATE: 'applicationCommandCreate',
|
||||
/**
|
||||
* @deprecated See {@link https://github.com/discord/discord-api-docs/issues/3690 this issue} for more information.
|
||||
*/
|
||||
APPLICATION_COMMAND_DELETE: 'applicationCommandDelete',
|
||||
/**
|
||||
* @deprecated See {@link https://github.com/discord/discord-api-docs/issues/3690 this issue} for more information.
|
||||
*/
|
||||
APPLICATION_COMMAND_UPDATE: 'applicationCommandUpdate',
|
||||
GUILD_CREATE: 'guildCreate',
|
||||
GUILD_DELETE: 'guildDelete',
|
||||
GUILD_UPDATE: 'guildUpdate',
|
||||
GUILD_UNAVAILABLE: 'guildUnavailable',
|
||||
GUILD_MEMBER_ADD: 'guildMemberAdd',
|
||||
GUILD_MEMBER_REMOVE: 'guildMemberRemove',
|
||||
GUILD_MEMBER_UPDATE: 'guildMemberUpdate',
|
||||
GUILD_MEMBER_AVAILABLE: 'guildMemberAvailable',
|
||||
GUILD_MEMBERS_CHUNK: 'guildMembersChunk',
|
||||
GUILD_MEMBER_LIST_UPDATE: 'guildMemberListUpdate',
|
||||
GUILD_INTEGRATIONS_UPDATE: 'guildIntegrationsUpdate',
|
||||
GUILD_ROLE_CREATE: 'roleCreate',
|
||||
GUILD_ROLE_DELETE: 'roleDelete',
|
||||
INVITE_CREATE: 'inviteCreate',
|
||||
INVITE_DELETE: 'inviteDelete',
|
||||
GUILD_ROLE_UPDATE: 'roleUpdate',
|
||||
GUILD_EMOJI_CREATE: 'emojiCreate',
|
||||
GUILD_EMOJI_DELETE: 'emojiDelete',
|
||||
GUILD_EMOJI_UPDATE: 'emojiUpdate',
|
||||
GUILD_BAN_ADD: 'guildBanAdd',
|
||||
GUILD_BAN_REMOVE: 'guildBanRemove',
|
||||
CHANNEL_CREATE: 'channelCreate',
|
||||
CHANNEL_DELETE: 'channelDelete',
|
||||
CHANNEL_UPDATE: 'channelUpdate',
|
||||
CHANNEL_PINS_UPDATE: 'channelPinsUpdate',
|
||||
MESSAGE_CREATE: 'messageCreate',
|
||||
MESSAGE_DELETE: 'messageDelete',
|
||||
MESSAGE_UPDATE: 'messageUpdate',
|
||||
MESSAGE_BULK_DELETE: 'messageDeleteBulk',
|
||||
MESSAGE_REACTION_ADD: 'messageReactionAdd',
|
||||
MESSAGE_REACTION_REMOVE: 'messageReactionRemove',
|
||||
MESSAGE_REACTION_REMOVE_ALL: 'messageReactionRemoveAll',
|
||||
MESSAGE_REACTION_REMOVE_EMOJI: 'messageReactionRemoveEmoji',
|
||||
THREAD_CREATE: 'threadCreate',
|
||||
THREAD_DELETE: 'threadDelete',
|
||||
THREAD_UPDATE: 'threadUpdate',
|
||||
THREAD_LIST_SYNC: 'threadListSync',
|
||||
THREAD_MEMBER_UPDATE: 'threadMemberUpdate',
|
||||
THREAD_MEMBERS_UPDATE: 'threadMembersUpdate',
|
||||
USER_UPDATE: 'userUpdate',
|
||||
PRESENCE_UPDATE: 'presenceUpdate',
|
||||
VOICE_SERVER_UPDATE: 'voiceServerUpdate',
|
||||
VOICE_STATE_UPDATE: 'voiceStateUpdate',
|
||||
TYPING_START: 'typingStart',
|
||||
WEBHOOKS_UPDATE: 'webhookUpdate',
|
||||
INTERACTION_CREATE: 'interactionCreate',
|
||||
ERROR: 'error',
|
||||
WARN: 'warn',
|
||||
DEBUG: 'debug',
|
||||
CACHE_SWEEP: 'cacheSweep',
|
||||
SHARD_DISCONNECT: 'shardDisconnect',
|
||||
SHARD_ERROR: 'shardError',
|
||||
SHARD_RECONNECTING: 'shardReconnecting',
|
||||
SHARD_READY: 'shardReady',
|
||||
SHARD_RESUME: 'shardResume',
|
||||
INVALIDATED: 'invalidated',
|
||||
RAW: 'raw',
|
||||
STAGE_INSTANCE_CREATE: 'stageInstanceCreate',
|
||||
STAGE_INSTANCE_UPDATE: 'stageInstanceUpdate',
|
||||
STAGE_INSTANCE_DELETE: 'stageInstanceDelete',
|
||||
GUILD_STICKER_CREATE: 'stickerCreate',
|
||||
GUILD_STICKER_DELETE: 'stickerDelete',
|
||||
GUILD_STICKER_UPDATE: 'stickerUpdate',
|
||||
GUILD_SCHEDULED_EVENT_CREATE: 'guildScheduledEventCreate',
|
||||
GUILD_SCHEDULED_EVENT_UPDATE: 'guildScheduledEventUpdate',
|
||||
GUILD_SCHEDULED_EVENT_DELETE: 'guildScheduledEventDelete',
|
||||
GUILD_SCHEDULED_EVENT_USER_ADD: 'guildScheduledEventUserAdd',
|
||||
GUILD_SCHEDULED_EVENT_USER_REMOVE: 'guildScheduledEventUserRemove',
|
||||
RELATIONSHIP_ADD: 'relationshipAdd',
|
||||
RELATIONSHIP_REMOVE: 'relationshipRemove',
|
||||
};
|
||||
|
||||
exports.ShardEvents = {
|
||||
@ -1310,6 +1312,26 @@ exports.PrivacyLevels = createEnum([null, 'PUBLIC', 'GUILD_ONLY']);
|
||||
*/
|
||||
exports.GuildScheduledEventPrivacyLevels = createEnum([null, null, 'GUILD_ONLY']);
|
||||
|
||||
/**
|
||||
* Relationship Enum
|
||||
* * FRIEND
|
||||
* * BLOCKED
|
||||
* * INCOMING_REQUEST
|
||||
* * OUTGOING_REQUEST
|
||||
* @typedef {string} RelationshipType
|
||||
* @see {@link https://luna.gitlab.io/discord-unofficial-docs/relationships.html}
|
||||
*/
|
||||
|
||||
exports.RelationshipTypes = createEnum([null, 'FRIEND', 'BLOCKED', 'INCOMING_REQUEST', 'OUTGOING_REQUEST']);
|
||||
|
||||
exports.Relationship = {
|
||||
0: 'NONE',
|
||||
1: 'FRIEND',
|
||||
2: 'BLOCKED',
|
||||
3: 'INCOMING_REQUEST',
|
||||
4: 'OUTGOING_REQUEST',
|
||||
};
|
||||
|
||||
/**
|
||||
* The premium tier (Server Boost level) of a guild:
|
||||
* * NONE
|
||||
|
9
typings/enums.d.ts
vendored
9
typings/enums.d.ts
vendored
@ -22,8 +22,15 @@ export const enum stickerAnimationMode {
|
||||
NEVER = 2,
|
||||
}
|
||||
|
||||
export const enum relationshipsType {
|
||||
FRIEND = 1,
|
||||
BLOCKED = 2,
|
||||
INCOMING_REQUEST = 3,
|
||||
OUTGOING_REQUEST = 4,
|
||||
}
|
||||
|
||||
export const enum localeSetting {
|
||||
DANISH = 'da',
|
||||
DANISH = 'da',
|
||||
GERMAN = 'de',
|
||||
ENGLISH_UK = 'en-GB',
|
||||
ENGLISH_US = 'en-US',
|
||||
|
38
typings/index.d.ts
vendored
38
typings/index.d.ts
vendored
@ -62,6 +62,10 @@ import {
|
||||
ApplicationCommandPermissionTypes,
|
||||
ApplicationCommandTypes,
|
||||
ChannelTypes,
|
||||
relationshipsType,
|
||||
localeSetting,
|
||||
stickerAnimationMode,
|
||||
DMScanLevel,
|
||||
DefaultMessageNotificationLevels,
|
||||
ExplicitContentFilterLevels,
|
||||
InteractionResponseTypes,
|
||||
@ -548,8 +552,7 @@ export class Client<Ready extends boolean = boolean> extends BaseClient {
|
||||
public application: If<Ready, ClientApplication>;
|
||||
// Added
|
||||
public setting: ClientUserSettingManager;
|
||||
public friends: FriendsManager;
|
||||
public blocked: BlockedManager;
|
||||
public relationships: RelationshipsManager;
|
||||
public updateCookie(): Promise<void>;
|
||||
// End
|
||||
public channels: ChannelManager;
|
||||
@ -651,7 +654,6 @@ export class ClientUser extends User {
|
||||
public setPassword(oldPassword: string, newPassword: string): Promise<this>;
|
||||
public disableAccount(password: string): Promise<this>;
|
||||
public deleteAccount(password: string): Promise<this>;
|
||||
public findFriend(username: string, discriminator: string | number): Promise<this>;
|
||||
// Selfbot
|
||||
public readonly nitro: boolean;
|
||||
/**
|
||||
@ -2468,8 +2470,7 @@ export class User extends PartialTextBasedChannel(Base) {
|
||||
public banner: string | null | undefined;
|
||||
public bot: boolean;
|
||||
public readonly createdAt: Date;
|
||||
public readonly friend: Boolean;
|
||||
public readonly blocked: Boolean;
|
||||
public readonly relationships: relationshipsType;
|
||||
public readonly createdTimestamp: number;
|
||||
public discriminator: string;
|
||||
public readonly defaultAvatarURL: string;
|
||||
@ -3369,24 +3370,17 @@ export class UserManager extends CachedManager<Snowflake, User, UserResolvable>
|
||||
public send(user: UserResolvable, options: string | MessagePayload | MessageOptions): Promise<Message>;
|
||||
}
|
||||
|
||||
export class FriendsManager extends CachedManager<Snowflake, User, UserResolvable> {
|
||||
private constructor(client: Client, iterable?: Iterable<RawUserData>);
|
||||
private dmChannel(userId: Snowflake): DMChannel | null;
|
||||
public createDM(user: UserResolvable, options?: BaseFetchOptions): Promise<DMChannel>;
|
||||
public deleteDM(user: UserResolvable): Promise<DMChannel>;
|
||||
export class RelationshipsManager {
|
||||
private constructor(client: Client, users?: Array<RawRelationship>);
|
||||
public cache: Collection<Snowflake, relationshipsType>;
|
||||
public client: Client;
|
||||
private _setup(users: Array<RawRelationship>): null;
|
||||
public fetch(user: UserResolvable, options?: BaseFetchOptions): Promise<User>;
|
||||
public fetchFlags(user: UserResolvable, options?: BaseFetchOptions): Promise<UserFlags>;
|
||||
public send(user: UserResolvable, options: string | MessagePayload | MessageOptions): Promise<Message>;
|
||||
}
|
||||
|
||||
export class BlockedManager extends CachedManager<Snowflake, User, UserResolvable> {
|
||||
private constructor(client: Client, iterable?: Iterable<RawUserData>);
|
||||
private dmChannel(userId: Snowflake): DMChannel | null;
|
||||
public createDM(user: UserResolvable, options?: BaseFetchOptions): Promise<DMChannel>;
|
||||
public deleteDM(user: UserResolvable): Promise<DMChannel>;
|
||||
public fetch(user: UserResolvable, options?: BaseFetchOptions): Promise<User>;
|
||||
public fetchFlags(user: UserResolvable, options?: BaseFetchOptions): Promise<UserFlags>;
|
||||
public send(user: UserResolvable, options: string | MessagePayload | MessageOptions): Promise<Message>;
|
||||
public deleteFriend(user: UserResolvable): Promise<User>;
|
||||
public deleteBlocked(user: UserResolvable): Promise<User>;
|
||||
public sendFriendRequest(username: User.username, discriminator: User.discriminator): Promise<User>;
|
||||
public addFriend(user: UserResolvable): Promise<User>;
|
||||
public addBlocked(user: UserResolvable): Promise<User>;
|
||||
}
|
||||
|
||||
export class VoiceStateManager extends CachedManager<Snowflake, VoiceState, typeof VoiceState> {
|
||||
|
Loading…
Reference in New Issue
Block a user