djs-selfbot-v13 3.1.7 → 3.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +18 -45
- package/package.json +8 -37
- package/src/client/BaseClient.js +2 -3
- package/src/client/Client.js +187 -539
- package/src/client/actions/Action.js +18 -13
- package/src/client/actions/ActionsManager.js +7 -1
- package/src/client/actions/AutoModerationActionExecution.js +1 -0
- package/src/client/actions/AutoModerationRuleCreate.js +1 -0
- package/src/client/actions/AutoModerationRuleDelete.js +1 -0
- package/src/client/actions/AutoModerationRuleUpdate.js +1 -0
- package/src/client/actions/MessageCreate.js +0 -4
- package/src/client/actions/PresenceUpdate.js +17 -16
- package/src/client/websocket/WebSocketManager.js +11 -31
- package/src/client/websocket/WebSocketShard.js +39 -38
- package/src/client/websocket/handlers/CALL_CREATE.js +3 -3
- package/src/client/websocket/handlers/CALL_DELETE.js +2 -2
- package/src/client/websocket/handlers/CALL_UPDATE.js +2 -2
- package/src/client/websocket/handlers/CHANNEL_RECIPIENT_ADD.js +16 -13
- package/src/client/websocket/handlers/CHANNEL_RECIPIENT_REMOVE.js +11 -11
- package/src/client/websocket/handlers/GUILD_CREATE.js +7 -0
- package/src/client/websocket/handlers/INTERACTION_MODAL_CREATE.js +1 -0
- package/src/client/websocket/handlers/READY.js +47 -137
- package/src/client/websocket/handlers/RELATIONSHIP_ADD.js +7 -5
- package/src/client/websocket/handlers/RELATIONSHIP_REMOVE.js +6 -4
- package/src/client/websocket/handlers/RELATIONSHIP_UPDATE.js +32 -9
- package/src/client/websocket/handlers/USER_GUILD_SETTINGS_UPDATE.js +2 -8
- package/src/client/websocket/handlers/USER_NOTE_UPDATE.js +1 -1
- package/src/client/websocket/handlers/USER_REQUIRED_ACTION_UPDATE.js +78 -0
- package/src/client/websocket/handlers/USER_SETTINGS_UPDATE.js +1 -5
- package/src/client/websocket/handlers/VOICE_CHANNEL_STATUS_UPDATE.js +12 -0
- package/src/client/websocket/handlers/index.js +15 -20
- package/src/errors/Messages.js +24 -69
- package/src/index.js +12 -43
- package/src/managers/ApplicationCommandManager.js +9 -12
- package/src/managers/ApplicationCommandPermissionsManager.js +3 -11
- package/src/managers/ChannelManager.js +3 -4
- package/src/managers/ClientUserSettingManager.js +161 -279
- package/src/managers/GuildBanManager.js +1 -1
- package/src/managers/GuildChannelManager.js +2 -0
- package/src/managers/GuildForumThreadManager.js +22 -28
- package/src/managers/GuildMemberManager.js +40 -216
- package/src/managers/GuildSettingManager.js +22 -15
- package/src/managers/MessageManager.js +42 -44
- package/src/managers/PermissionOverwriteManager.js +1 -1
- package/src/managers/ReactionUserManager.js +5 -5
- package/src/managers/RelationshipManager.js +81 -74
- package/src/managers/ThreadManager.js +12 -45
- package/src/managers/ThreadMemberManager.js +1 -1
- package/src/managers/UserManager.js +6 -10
- package/src/managers/UserNoteManager.js +53 -0
- package/src/rest/APIRequest.js +42 -20
- package/src/rest/DiscordAPIError.js +17 -16
- package/src/rest/RESTManager.js +1 -21
- package/src/rest/RequestHandler.js +35 -21
- package/src/structures/ApplicationCommand.js +19 -456
- package/src/structures/ApplicationRoleConnectionMetadata.js +3 -0
- package/src/structures/AutoModerationRule.js +5 -5
- package/src/structures/AutocompleteInteraction.js +1 -0
- package/src/structures/BaseGuildTextChannel.js +10 -12
- package/src/structures/BaseGuildVoiceChannel.js +16 -18
- package/src/structures/{Call.js → CallState.js} +17 -12
- package/src/structures/CategoryChannel.js +2 -0
- package/src/structures/Channel.js +2 -3
- package/src/structures/ClientPresence.js +12 -8
- package/src/structures/ClientUser.js +117 -336
- package/src/structures/ContextMenuInteraction.js +1 -1
- package/src/structures/DMChannel.js +29 -92
- package/src/structures/ForumChannel.js +0 -10
- package/src/structures/GroupDMChannel.js +387 -0
- package/src/structures/Guild.js +135 -271
- package/src/structures/GuildAuditLogs.js +0 -5
- package/src/structures/GuildChannel.js +16 -2
- package/src/structures/GuildMember.js +27 -145
- package/src/structures/Interaction.js +1 -62
- package/src/structures/Invite.js +35 -52
- package/src/structures/Message.js +228 -202
- package/src/structures/MessageAttachment.js +11 -0
- package/src/structures/MessageButton.js +1 -67
- package/src/structures/MessageEmbed.js +1 -1
- package/src/structures/MessageMentions.js +3 -2
- package/src/structures/MessagePayload.js +4 -46
- package/src/structures/MessageReaction.js +1 -1
- package/src/structures/MessageSelectMenu.js +1 -252
- package/src/structures/Modal.js +75 -180
- package/src/structures/Presence.js +2 -2
- package/src/structures/RichPresence.js +14 -34
- package/src/structures/Role.js +18 -2
- package/src/structures/SelectMenuInteraction.js +2 -151
- package/src/structures/Team.js +0 -49
- package/src/structures/TextInputComponent.js +0 -70
- package/src/structures/ThreadChannel.js +0 -19
- package/src/structures/User.js +117 -345
- package/src/structures/UserContextMenuInteraction.js +2 -2
- package/src/structures/VoiceState.js +74 -39
- package/src/structures/WebEmbed.js +38 -52
- package/src/structures/Webhook.js +17 -11
- package/src/structures/interfaces/Application.js +146 -23
- package/src/structures/interfaces/TextBasedChannel.js +411 -256
- package/src/util/ApplicationFlags.js +1 -1
- package/src/util/AttachmentFlags.js +38 -0
- package/src/util/Constants.js +106 -284
- package/src/util/Formatters.js +16 -2
- package/src/util/InviteFlags.js +29 -0
- package/src/util/LimitedCollection.js +1 -1
- package/src/util/Options.js +48 -68
- package/src/util/Permissions.js +5 -0
- package/src/util/PurchasedFlags.js +2 -0
- package/src/util/RemoteAuth.js +221 -356
- package/src/util/RoleFlags.js +37 -0
- package/src/util/Sweepers.js +1 -1
- package/src/util/Util.js +76 -36
- package/typings/enums.d.ts +18 -73
- package/typings/index.d.ts +873 -1225
- package/typings/rawDataTypes.d.ts +68 -9
- package/src/client/actions/InteractionCreate.js +0 -115
- package/src/client/websocket/handlers/APPLICATION_COMMAND_AUTOCOMPLETE_RESPONSE.js +0 -23
- package/src/client/websocket/handlers/GUILD_APPLICATION_COMMANDS_UPDATE.js +0 -11
- package/src/client/websocket/handlers/GUILD_MEMBER_LIST_UPDATE.js +0 -55
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUNDS_UPDATE.js +0 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_CREATE.js +0 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_DELETE.js +0 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_UPDATE.js +0 -0
- package/src/client/websocket/handlers/INTERACTION_CREATE.js +0 -16
- package/src/client/websocket/handlers/INTERACTION_FAILURE.js +0 -18
- package/src/client/websocket/handlers/INTERACTION_SUCCESS.js +0 -30
- package/src/client/websocket/handlers/MESSAGE_ACK.js +0 -16
- package/src/client/websocket/handlers/SOUNDBOARD_SOUNDS.js +0 -0
- package/src/client/websocket/handlers/VOICE_CHANNEL_EFFECT_SEND.js +0 -0
- package/src/managers/DeveloperPortalManager.js +0 -104
- package/src/managers/GuildApplicationCommandManager.js +0 -28
- package/src/managers/GuildFolderManager.js +0 -24
- package/src/managers/SessionManager.js +0 -57
- package/src/rest/CaptchaSolver.js +0 -132
- package/src/structures/ClientApplication.js +0 -204
- package/src/structures/DeveloperPortalApplication.js +0 -520
- package/src/structures/GuildFolder.js +0 -75
- package/src/structures/InteractionResponse.js +0 -114
- package/src/structures/PartialGroupDMChannel.js +0 -433
- package/src/structures/Session.js +0 -81
- package/src/util/Voice.js +0 -1456
- package/src/util/arRPC/index.js +0 -229
- package/src/util/arRPC/process/detectable.json +0 -1
- package/src/util/arRPC/process/index.js +0 -102
- package/src/util/arRPC/process/native/index.js +0 -5
- package/src/util/arRPC/process/native/linux.js +0 -37
- package/src/util/arRPC/process/native/win32.js +0 -25
- package/src/util/arRPC/transports/ipc.js +0 -281
- package/src/util/arRPC/transports/websocket.js +0 -128
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const proxyParser = proxy => {
|
|
4
|
-
const protocolSplit = proxy.split('://');
|
|
5
|
-
const protocol = protocolSplit.length === 1 ? null : protocolSplit[0];
|
|
6
|
-
const rest = protocolSplit.length === 1 ? protocolSplit[0] : protocolSplit[1];
|
|
7
|
-
const authSplit = rest.split('@');
|
|
8
|
-
if (authSplit.length === 1) {
|
|
9
|
-
const host = authSplit[0].split(':')[0];
|
|
10
|
-
const port = Number(authSplit[0].split(':')[1]);
|
|
11
|
-
const proxyConfig = {
|
|
12
|
-
host,
|
|
13
|
-
port,
|
|
14
|
-
};
|
|
15
|
-
if (protocol != null) {
|
|
16
|
-
proxyConfig.protocol = protocol;
|
|
17
|
-
}
|
|
18
|
-
return proxyConfig;
|
|
19
|
-
}
|
|
20
|
-
const host = authSplit[1].split(':')[0];
|
|
21
|
-
const port = Number(authSplit[1].split(':')[1]);
|
|
22
|
-
const [username, password] = authSplit[0].split(':');
|
|
23
|
-
const proxyConfig = {
|
|
24
|
-
host,
|
|
25
|
-
port,
|
|
26
|
-
auth: {
|
|
27
|
-
username,
|
|
28
|
-
password,
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
if (protocol != null) {
|
|
32
|
-
proxyConfig.protocol = protocol;
|
|
33
|
-
}
|
|
34
|
-
return proxyConfig;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
module.exports = class CaptchaSolver {
|
|
38
|
-
constructor(service, key, defaultCaptchaSolver, proxyString = '') {
|
|
39
|
-
this.service = 'custom';
|
|
40
|
-
this.solver = undefined;
|
|
41
|
-
this.defaultCaptchaSolver = defaultCaptchaSolver;
|
|
42
|
-
this.key = null;
|
|
43
|
-
this.proxy = proxyString.length ? proxyParser(proxyString) : null;
|
|
44
|
-
this._setup(service, key);
|
|
45
|
-
}
|
|
46
|
-
_missingModule(name) {
|
|
47
|
-
return new Error(`${name} module not found, please install it with \`npm i ${name}\``);
|
|
48
|
-
}
|
|
49
|
-
_setup(service, key) {
|
|
50
|
-
switch (service) {
|
|
51
|
-
case '2captcha': {
|
|
52
|
-
if (!key || typeof key !== 'string') throw new Error('2captcha key is not provided');
|
|
53
|
-
try {
|
|
54
|
-
const lib = require('2captcha');
|
|
55
|
-
this.service = '2captcha';
|
|
56
|
-
this.key = key;
|
|
57
|
-
this.solver = new lib.Solver(key);
|
|
58
|
-
this.solve = (data, userAgent) =>
|
|
59
|
-
new Promise((resolve, reject) => {
|
|
60
|
-
const siteKey = data.captcha_sitekey;
|
|
61
|
-
let postD = {};
|
|
62
|
-
if (this.proxy !== null) {
|
|
63
|
-
postD = {
|
|
64
|
-
proxytype: this.proxy.protocol?.toUpperCase(),
|
|
65
|
-
proxy: `${'auth' in this.proxy ? `${this.proxy.auth.username}:${this.proxy.auth.password}@` : ''}${
|
|
66
|
-
this.proxy.host
|
|
67
|
-
}:${this.proxy.port}`,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
if (data.captcha_rqdata) {
|
|
71
|
-
postD = {
|
|
72
|
-
...postD,
|
|
73
|
-
data: data.captcha_rqdata,
|
|
74
|
-
userAgent,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
this.solver
|
|
78
|
-
.hcaptcha(siteKey, 'https://discord.com/channels/@me', postD)
|
|
79
|
-
.then(res => {
|
|
80
|
-
resolve(res.data);
|
|
81
|
-
})
|
|
82
|
-
.catch(reject);
|
|
83
|
-
});
|
|
84
|
-
break;
|
|
85
|
-
} catch (e) {
|
|
86
|
-
throw this._missingModule('2captcha');
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
case 'capmonster': {
|
|
90
|
-
if (!key || typeof key !== 'string') throw new Error('Capmonster key is not provided');
|
|
91
|
-
try {
|
|
92
|
-
const { HCaptchaTask } = require('node-capmonster');
|
|
93
|
-
this.service = 'capmonster';
|
|
94
|
-
this.key = key;
|
|
95
|
-
const client = new HCaptchaTask(this.key);
|
|
96
|
-
this.solve = (captchaData, userAgent) =>
|
|
97
|
-
new Promise((resolve, reject) => {
|
|
98
|
-
if (userAgent) client.setUserAgent(userAgent);
|
|
99
|
-
if (this.proxy !== null) {
|
|
100
|
-
client.setProxy(
|
|
101
|
-
this.proxy.protocol,
|
|
102
|
-
this.proxy.host,
|
|
103
|
-
this.proxy.port,
|
|
104
|
-
'auth' in this.proxy ? this.proxy.auth.username : undefined,
|
|
105
|
-
'auth' in this.proxy ? this.proxy.auth.password : undefined,
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
client
|
|
109
|
-
.createWithTask(
|
|
110
|
-
client.task({
|
|
111
|
-
websiteURL: 'https://discord.com/channels/@me',
|
|
112
|
-
websiteKey: captchaData.captcha_sitekey,
|
|
113
|
-
isInvisible: !!captchaData.captcha_rqdata,
|
|
114
|
-
data: captchaData.captcha_rqdata,
|
|
115
|
-
}),
|
|
116
|
-
)
|
|
117
|
-
.then(id => client.joinTaskResult(id))
|
|
118
|
-
.then(result => resolve(result.gRecaptchaResponse))
|
|
119
|
-
.catch(reject);
|
|
120
|
-
});
|
|
121
|
-
} catch (e) {
|
|
122
|
-
throw this._missingModule('node-capmonster');
|
|
123
|
-
}
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
default: {
|
|
127
|
-
this.solve = this.defaultCaptchaSolver;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
solve() {}
|
|
132
|
-
};
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const { Collection } = require('@discordjs/collection');
|
|
4
|
-
const { ApplicationRoleConnectionMetadata } = require('./ApplicationRoleConnectionMetadata');
|
|
5
|
-
const Team = require('./Team');
|
|
6
|
-
const Application = require('./interfaces/Application');
|
|
7
|
-
const ApplicationCommandManager = require('../managers/ApplicationCommandManager');
|
|
8
|
-
const ApplicationFlags = require('../util/ApplicationFlags');
|
|
9
|
-
const { ApplicationRoleConnectionMetadataTypes } = require('../util/Constants');
|
|
10
|
-
const Permissions = require('../util/Permissions');
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @typedef {Object} ClientApplicationInstallParams
|
|
14
|
-
* @property {InviteScope[]} scopes The scopes to add the application to the server with
|
|
15
|
-
* @property {Readonly<Permissions>} permissions The permissions this bot will request upon joining
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Represents a Client OAuth2 Application.
|
|
20
|
-
* @extends {Application}
|
|
21
|
-
*/
|
|
22
|
-
class ClientApplication extends Application {
|
|
23
|
-
constructor(client, data, user) {
|
|
24
|
-
super(client, data);
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* The application command manager for this application
|
|
28
|
-
* @type {ApplicationCommandManager}
|
|
29
|
-
*/
|
|
30
|
-
this.commands = new ApplicationCommandManager(this.client, undefined, user);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
_patch(data) {
|
|
34
|
-
super._patch(data);
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* The tags this application has (max of 5)
|
|
38
|
-
* @type {string[]}
|
|
39
|
-
*/
|
|
40
|
-
this.tags = data.tags ?? [];
|
|
41
|
-
|
|
42
|
-
if ('install_params' in data) {
|
|
43
|
-
/**
|
|
44
|
-
* Settings for this application's default in-app authorization
|
|
45
|
-
* @type {?ClientApplicationInstallParams}
|
|
46
|
-
*/
|
|
47
|
-
this.installParams = {
|
|
48
|
-
scopes: data.install_params.scopes,
|
|
49
|
-
permissions: new Permissions(data.install_params.permissions).freeze(),
|
|
50
|
-
};
|
|
51
|
-
} else {
|
|
52
|
-
this.installParams ??= null;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if ('custom_install_url' in data) {
|
|
56
|
-
/**
|
|
57
|
-
* This application's custom installation URL
|
|
58
|
-
* @type {?string}
|
|
59
|
-
*/
|
|
60
|
-
this.customInstallURL = data.custom_install_url;
|
|
61
|
-
} else {
|
|
62
|
-
this.customInstallURL = null;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if ('flags' in data) {
|
|
66
|
-
/**
|
|
67
|
-
* The flags this application has
|
|
68
|
-
* @type {ApplicationFlags}
|
|
69
|
-
*/
|
|
70
|
-
this.flags = new ApplicationFlags(data.flags).freeze();
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if ('cover_image' in data) {
|
|
74
|
-
/**
|
|
75
|
-
* The hash of the application's cover image
|
|
76
|
-
* @type {?string}
|
|
77
|
-
*/
|
|
78
|
-
this.cover = data.cover_image;
|
|
79
|
-
} else {
|
|
80
|
-
this.cover ??= null;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if ('rpc_origins' in data) {
|
|
84
|
-
/**
|
|
85
|
-
* The application's RPC origins, if enabled
|
|
86
|
-
* @type {string[]}
|
|
87
|
-
*/
|
|
88
|
-
this.rpcOrigins = data.rpc_origins;
|
|
89
|
-
} else {
|
|
90
|
-
this.rpcOrigins ??= [];
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if ('bot_require_code_grant' in data) {
|
|
94
|
-
/**
|
|
95
|
-
* If this application's bot requires a code grant when using the OAuth2 flow
|
|
96
|
-
* @type {?boolean}
|
|
97
|
-
*/
|
|
98
|
-
this.botRequireCodeGrant = data.bot_require_code_grant;
|
|
99
|
-
} else {
|
|
100
|
-
this.botRequireCodeGrant ??= null;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if ('bot_public' in data) {
|
|
104
|
-
/**
|
|
105
|
-
* If this application's bot is public
|
|
106
|
-
* @type {?boolean}
|
|
107
|
-
*/
|
|
108
|
-
this.botPublic = data.bot_public;
|
|
109
|
-
} else {
|
|
110
|
-
this.botPublic ??= null;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if ('popular_application_command_ids' in data) {
|
|
114
|
-
/**
|
|
115
|
-
* List of popular command
|
|
116
|
-
* @type {?Collection<Snowflake, ApplicationCommand>}
|
|
117
|
-
*/
|
|
118
|
-
this.popularCommands = new Collection();
|
|
119
|
-
data.popular_application_command_ids.forEach(id => {
|
|
120
|
-
this.popularCommands.set(id, this.commands?.cache?.get(id));
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* The owner of this OAuth application
|
|
126
|
-
* @type {?(User|Team)}
|
|
127
|
-
*/
|
|
128
|
-
this.owner = data.team
|
|
129
|
-
? new Team(this.client, data.team)
|
|
130
|
-
: data.owner
|
|
131
|
-
? this.client.users._add(data.owner)
|
|
132
|
-
: this.owner ?? null;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Whether this application is partial
|
|
137
|
-
* @type {boolean}
|
|
138
|
-
* @readonly
|
|
139
|
-
*/
|
|
140
|
-
get partial() {
|
|
141
|
-
return !this.name;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Obtains this application from Discord.
|
|
146
|
-
* @returns {Promise<ClientApplication>}
|
|
147
|
-
*/
|
|
148
|
-
async fetch() {
|
|
149
|
-
const app = await this.client.api.oauth2.authorize.get({
|
|
150
|
-
query: {
|
|
151
|
-
client_id: this.id,
|
|
152
|
-
scope: 'bot applications.commands',
|
|
153
|
-
},
|
|
154
|
-
});
|
|
155
|
-
const user = this.client.users._add(app.bot);
|
|
156
|
-
user._partial = false;
|
|
157
|
-
this._patch(app.application);
|
|
158
|
-
return this;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Gets this application's role connection metadata records
|
|
163
|
-
* @returns {Promise<ApplicationRoleConnectionMetadata[]>}
|
|
164
|
-
*/
|
|
165
|
-
async fetchRoleConnectionMetadataRecords() {
|
|
166
|
-
const metadata = await this.client.api.applications(this.id)('role-connections').metadata.get();
|
|
167
|
-
return metadata.map(data => new ApplicationRoleConnectionMetadata(data));
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Data for creating or editing an application role connection metadata.
|
|
172
|
-
* @typedef {Object} ApplicationRoleConnectionMetadataEditOptions
|
|
173
|
-
* @property {string} name The name of the metadata field
|
|
174
|
-
* @property {?Object<Locale, string>} [nameLocalizations] The name localizations for the metadata field
|
|
175
|
-
* @property {string} description The description of the metadata field
|
|
176
|
-
* @property {?Object<Locale, string>} [descriptionLocalizations] The description localizations for the metadata field
|
|
177
|
-
* @property {string} key The dictionary key of the metadata field
|
|
178
|
-
* @property {ApplicationRoleConnectionMetadataType} type The type of the metadata field
|
|
179
|
-
*/
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Updates this application's role connection metadata records
|
|
183
|
-
* @param {ApplicationRoleConnectionMetadataEditOptions[]} records The new role connection metadata records
|
|
184
|
-
* @returns {Promise<ApplicationRoleConnectionMetadata[]>}
|
|
185
|
-
*/
|
|
186
|
-
async editRoleConnectionMetadataRecords(records) {
|
|
187
|
-
const newRecords = await this.client.api
|
|
188
|
-
.applications(this.client.user.id)('role-connections')
|
|
189
|
-
.metadata.put({
|
|
190
|
-
data: records.map(record => ({
|
|
191
|
-
type: typeof record.type === 'string' ? ApplicationRoleConnectionMetadataTypes[record.type] : record.type,
|
|
192
|
-
key: record.key,
|
|
193
|
-
name: record.name,
|
|
194
|
-
name_localizations: record.nameLocalizations,
|
|
195
|
-
description: record.description,
|
|
196
|
-
description_localizations: record.descriptionLocalizations,
|
|
197
|
-
})),
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
return newRecords.map(data => new ApplicationRoleConnectionMetadata(data));
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
module.exports = ClientApplication;
|