mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
chore: deprecate userbot methods
This commit is contained in:
@@ -266,8 +266,8 @@ class Client extends EventEmitter {
|
||||
* Logs the client in, establishing a websocket connection to Discord.
|
||||
* <info>Both bot and regular user accounts are supported, but it is highly recommended to use a bot account whenever
|
||||
* possible. User accounts are subject to harsher ratelimits and other restrictions that don't apply to bot accounts.
|
||||
* Bot accounts also have access to many features that user accounts cannot utilise. User accounts that are found to
|
||||
* be abusing/overusing the API will be banned, locking you out of Discord entirely.</info>
|
||||
* Bot accounts also have access to many features that user accounts cannot utilise. Automating a user account is
|
||||
* considered a violation of the ToS.</info>
|
||||
* @param {string} token Token of the account to log in with
|
||||
* @returns {Promise<string>} Token of the account used
|
||||
* @example
|
||||
@@ -395,11 +395,12 @@ class Client extends EventEmitter {
|
||||
* <warn>Bots can only fetch their own profile.</warn>
|
||||
* @param {Snowflake} [id='@me'] ID of application to fetch
|
||||
* @returns {Promise<OAuth2Application>}
|
||||
* client.fetchApplication('id')
|
||||
* client.fetchApplication()
|
||||
* .then(application => console.log(`Obtained application with name: ${application.name}`)
|
||||
* .catch(console.error);
|
||||
*/
|
||||
fetchApplication(id = '@me') {
|
||||
if (id !== '@me') process.emitWarning('fetchApplication: use "@me" as an argument', 'DeprecationWarning');
|
||||
return this.rest.methods.getApplication(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -303,6 +303,7 @@ class ClientUser extends User {
|
||||
|
||||
/**
|
||||
* Fetches messages that mentioned the client's user.
|
||||
* <warn>This is only available when using a user account.</warn>
|
||||
* @param {Object} [options] Options for the fetch
|
||||
* @param {number} [options.limit=25] Maximum number of mentions to retrieve
|
||||
* @param {boolean} [options.roles=true] Whether to include role mentions
|
||||
@@ -412,4 +413,19 @@ class ClientUser extends User {
|
||||
ClientUser.prototype.setGame =
|
||||
util.deprecate(ClientUser.prototype.setGame, 'ClientUser#setGame: use ClientUser#setActivity instead');
|
||||
|
||||
ClientUser.prototype.addFriend =
|
||||
util.deprecate(ClientUser.prototype.addFriend, 'ClientUser#addFriend: userbot methods will be removed');
|
||||
|
||||
ClientUser.prototype.removeFriend =
|
||||
util.deprecate(ClientUser.prototype.removeFriend, 'ClientUser#removeFriend: userbot methods will be removed');
|
||||
|
||||
ClientUser.prototype.setPassword =
|
||||
util.deprecate(ClientUser.prototype.setPassword, 'ClientUser#setPassword: userbot methods will be removed');
|
||||
|
||||
ClientUser.prototype.setEmail =
|
||||
util.deprecate(ClientUser.prototype.setEmail, 'ClientUser#setEmail: userbot methods will be removed');
|
||||
|
||||
ClientUser.prototype.fetchMentions =
|
||||
util.deprecate(ClientUser.prototype.fetchMentions, 'ClientUser#fetchMentions: userbot methods will be removed');
|
||||
|
||||
module.exports = ClientUser;
|
||||
|
||||
@@ -1333,4 +1333,16 @@ Object.defineProperty(Guild.prototype, 'defaultChannel', {
|
||||
}, 'Guild#defaultChannel: This property is obsolete, will be removed in v12.0.0, and may not function as expected.'),
|
||||
});
|
||||
|
||||
Guild.prototype.acknowledge =
|
||||
util.deprecate(Guild.prototype.acknowledge, 'Guild#acknowledge: userbot methods will be removed');
|
||||
|
||||
Guild.prototype.setPosition =
|
||||
util.deprecate(Guild.prototype.setPosition, 'Guild#setPosition: userbot methods will be removed');
|
||||
|
||||
Guild.prototype.search =
|
||||
util.deprecate(Guild.prototype.search, 'Guild#search: userbot methods will be removed');
|
||||
|
||||
Guild.prototype.sync =
|
||||
util.deprecate(Guild.prototype.sync, 'Guild#sync:, userbot methods will be removed');
|
||||
|
||||
module.exports = Guild;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const Snowflake = require('../util/Snowflake');
|
||||
const util = require('util');
|
||||
|
||||
/**
|
||||
* Represents an OAuth2 Application.
|
||||
@@ -140,4 +141,7 @@ class OAuth2Application {
|
||||
}
|
||||
}
|
||||
|
||||
OAuth2Application.prototype.reset =
|
||||
util.deprecate(OAuth2Application.prototype.reset, 'OAuth2Application#reset: userbot methods will be removed');
|
||||
|
||||
module.exports = OAuth2Application;
|
||||
|
||||
@@ -2,6 +2,7 @@ const TextBasedChannel = require('./interfaces/TextBasedChannel');
|
||||
const Constants = require('../util/Constants');
|
||||
const Presence = require('./Presence').Presence;
|
||||
const Snowflake = require('../util/Snowflake');
|
||||
const util = require('util');
|
||||
|
||||
/**
|
||||
* Represents a user on Discord.
|
||||
@@ -300,4 +301,22 @@ class User {
|
||||
|
||||
TextBasedChannel.applyToClass(User);
|
||||
|
||||
User.prototype.block =
|
||||
util.deprecate(User.prototype.block, 'User#block: userbot methods will be removed');
|
||||
|
||||
User.prototype.unblock =
|
||||
util.deprecate(User.prototype.unblock, 'User#unblock: userbot methods will be removed');
|
||||
|
||||
User.prototype.addFriend =
|
||||
util.deprecate(User.prototype.addFriend, 'User#addFriend: userbot methods will be removed');
|
||||
|
||||
User.prototype.removeFriend =
|
||||
util.deprecate(User.prototype.removeFriend, 'User#removeFriend: userbot methods will be removed');
|
||||
|
||||
User.prototype.setNote =
|
||||
util.deprecate(User.prototype.setNote, 'User#setNote, userbot methods will be removed');
|
||||
|
||||
User.prototype.fetchProfile =
|
||||
util.deprecate(User.prototype.fetchProfile, 'User#fetchProfile: userbot methods will be removed');
|
||||
|
||||
module.exports = User;
|
||||
|
||||
@@ -593,3 +593,10 @@ exports.applyToClass = (structure, full = false, ignore = []) => {
|
||||
Object.defineProperty(structure.prototype, prop, Object.getOwnPropertyDescriptor(TextBasedChannel.prototype, prop));
|
||||
}
|
||||
};
|
||||
|
||||
TextBasedChannel.prototype.acknowledge = util.deprecate(
|
||||
TextBasedChannel.prototype.acknowledge, 'TextBasedChannel#acknowledge: userbot methods will be removed'
|
||||
);
|
||||
|
||||
TextBasedChannel.prototype.search =
|
||||
util.deprecate(TextBasedChannel.prototype.search, 'TextBasedChannel#search: userbot methods will be removed');
|
||||
|
||||
Reference in New Issue
Block a user