Pull.
J'ai juste update le cutie.js, CONNARD Ah oui, j'ai aussi add le info.js, qui est merdique d'ailleurs
This commit is contained in:
8
node_modules/discord.js/src/managers/GuildChannelManager.js
generated
vendored
8
node_modules/discord.js/src/managers/GuildChannelManager.js
generated
vendored
@@ -230,13 +230,13 @@ class GuildChannelManager extends CachedManager {
|
||||
async createWebhook({ channel, name, avatar, reason }) {
|
||||
const id = this.resolveId(channel);
|
||||
if (!id) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'channel', 'GuildChannelResolvable');
|
||||
if (typeof avatar === 'string' && !avatar.startsWith('data:')) {
|
||||
avatar = await resolveImage(avatar);
|
||||
}
|
||||
|
||||
const resolvedImage = await resolveImage(avatar);
|
||||
|
||||
const data = await this.client.rest.post(Routes.channelWebhooks(id), {
|
||||
body: {
|
||||
name,
|
||||
avatar,
|
||||
avatar: resolvedImage,
|
||||
},
|
||||
reason,
|
||||
});
|
||||
|
||||
2
node_modules/discord.js/src/managers/GuildMemberRoleManager.js
generated
vendored
2
node_modules/discord.js/src/managers/GuildMemberRoleManager.js
generated
vendored
@@ -65,7 +65,7 @@ class GuildMemberRoleManager extends DataManager {
|
||||
* @readonly
|
||||
*/
|
||||
get color() {
|
||||
const coloredRoles = this.cache.filter(role => role.color);
|
||||
const coloredRoles = this.cache.filter(role => role.colors.primaryColor);
|
||||
if (!coloredRoles.size) return null;
|
||||
return coloredRoles.reduce((prev, role) => (role.comparePositionTo(prev) > 0 ? role : prev));
|
||||
}
|
||||
|
||||
81
node_modules/discord.js/src/managers/MessageManager.js
generated
vendored
81
node_modules/discord.js/src/managers/MessageManager.js
generated
vendored
@@ -1,5 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const process = require('node:process');
|
||||
const { Collection } = require('@discordjs/collection');
|
||||
const { makeURLSearchParams } = require('@discordjs/rest');
|
||||
const { Routes } = require('discord-api-types/v10');
|
||||
@@ -10,6 +11,8 @@ const MessagePayload = require('../structures/MessagePayload');
|
||||
const { MakeCacheOverrideSymbol } = require('../util/Symbols');
|
||||
const { resolvePartialEmoji } = require('../util/Util');
|
||||
|
||||
let deprecationEmittedForFetchPinned = false;
|
||||
|
||||
/**
|
||||
* Manages API methods for Messages and holds their cache.
|
||||
* @extends {CachedManager}
|
||||
@@ -116,19 +119,83 @@ class MessageManager extends CachedManager {
|
||||
return data.reduce((_data, message) => _data.set(message.id, this._add(message, options.cache)), new Collection());
|
||||
}
|
||||
|
||||
/**
|
||||
* Options used to fetch pinned messages.
|
||||
*
|
||||
* @typedef {Object} FetchPinnedMessagesOptions
|
||||
* @property {DateResolvable} [before] Consider only pinned messages before this time
|
||||
* @property {number} [limit] The maximum number of pinned messages to return
|
||||
* @property {boolean} [cache] Whether to cache the pinned messages
|
||||
*/
|
||||
|
||||
/**
|
||||
* Data returned from fetching pinned messages.
|
||||
*
|
||||
* @typedef {Object} FetchPinnedMessagesResponse
|
||||
* @property {MessagePin[]} items The pinned messages
|
||||
* @property {boolean} hasMore Whether there are additional pinned messages that require a subsequent call
|
||||
*/
|
||||
|
||||
/**
|
||||
* Pinned message data returned from fetching pinned messages.
|
||||
*
|
||||
* @typedef {Object} MessagePin
|
||||
* @property {Date} pinnedAt The time the message was pinned at
|
||||
* @property {number} pinnedTimestamp The timestamp the message was pinned at
|
||||
* @property {Message} message The pinned message
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fetches the pinned messages of this channel and returns a collection of them.
|
||||
* <info>The returned Collection does not contain any reaction data of the messages.
|
||||
* Those need to be fetched separately.</info>
|
||||
*
|
||||
* @param {FetchPinnedMessagesOptions} [options={}] Options for fetching pinned messages
|
||||
* @returns {Promise<FetchPinnedMessagesResponse>}
|
||||
* @example
|
||||
* // Get pinned messages
|
||||
* channel.messages.fetchPins()
|
||||
* .then(messages => console.log(`Received ${messages.items.length} messages`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
async fetchPins(options = {}) {
|
||||
const data = await this.client.rest.get(Routes.channelMessagesPins(this.channel.id), {
|
||||
query: makeURLSearchParams({
|
||||
...options,
|
||||
before: options.before && new Date(options.before).toISOString(),
|
||||
}),
|
||||
});
|
||||
|
||||
return {
|
||||
items: data.items.map(item => ({
|
||||
pinnedTimestamp: Date.parse(item.pinned_at),
|
||||
get pinnedAt() {
|
||||
return new Date(this.pinnedTimestamp);
|
||||
},
|
||||
message: this._add(item.message, options.cache),
|
||||
})),
|
||||
hasMore: data.has_more,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the pinned messages of this channel and returns a collection of them.
|
||||
* <info>The returned Collection does not contain any reaction data of the messages.
|
||||
* Those need to be fetched separately.</info>
|
||||
* @param {boolean} [cache=true] Whether to cache the message(s)
|
||||
* @deprecated Use {@link MessageManager#fetchPins} instead.
|
||||
* @returns {Promise<Collection<Snowflake, Message>>}
|
||||
* @example
|
||||
* // Get pinned messages
|
||||
* channel.messages.fetchPinned()
|
||||
* .then(messages => console.log(`Received ${messages.size} messages`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
async fetchPinned(cache = true) {
|
||||
if (!deprecationEmittedForFetchPinned) {
|
||||
process.emitWarning(
|
||||
'The MessageManager#fetchPinned() method is deprecated. Use MessageManager#fetchPins() instead.',
|
||||
'DeprecationWarning',
|
||||
);
|
||||
|
||||
deprecationEmittedForFetchPinned = true;
|
||||
}
|
||||
|
||||
const data = await this.client.rest.get(Routes.channelPins(this.channel.id));
|
||||
const messages = new Collection();
|
||||
for (const message of data) messages.set(message.id, this._add(message, cache));
|
||||
@@ -219,7 +286,7 @@ class MessageManager extends CachedManager {
|
||||
message = this.resolveId(message);
|
||||
if (!message) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'message', 'MessageResolvable');
|
||||
|
||||
await this.client.rest.put(Routes.channelPin(this.channel.id, message), { reason });
|
||||
await this.client.rest.put(Routes.channelMessagesPin(this.channel.id, message), { reason });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -232,7 +299,7 @@ class MessageManager extends CachedManager {
|
||||
message = this.resolveId(message);
|
||||
if (!message) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'message', 'MessageResolvable');
|
||||
|
||||
await this.client.rest.delete(Routes.channelPin(this.channel.id, message), { reason });
|
||||
await this.client.rest.delete(Routes.channelMessagesPin(this.channel.id, message), { reason });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
82
node_modules/discord.js/src/managers/RoleManager.js
generated
vendored
82
node_modules/discord.js/src/managers/RoleManager.js
generated
vendored
@@ -12,6 +12,8 @@ const PermissionsBitField = require('../util/PermissionsBitField');
|
||||
const { setPosition, resolveColor } = require('../util/Util');
|
||||
|
||||
let cacheWarningEmitted = false;
|
||||
let deprecationEmittedForCreate = false;
|
||||
let deprecationEmittedForEdit = false;
|
||||
|
||||
/**
|
||||
* Manages API methods for roles and stores their cache.
|
||||
@@ -58,7 +60,7 @@ class RoleManager extends CachedManager {
|
||||
* @example
|
||||
* // Fetch a single role
|
||||
* message.guild.roles.fetch('222078108977594368')
|
||||
* .then(role => console.log(`The role color is: ${role.color}`))
|
||||
* .then(role => console.log(`The role color is: ${role.colors.primaryColor}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
async fetch(id, { cache = true, force = false } = {}) {
|
||||
@@ -112,11 +114,24 @@ class RoleManager extends CachedManager {
|
||||
* @returns {?Snowflake}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} RoleColorsResolvable
|
||||
* @property {ColorResolvable} primaryColor The primary color of the role
|
||||
* @property {ColorResolvable} [secondaryColor] The secondary color of the role.
|
||||
* This will make the role a gradient between the other provided colors
|
||||
* @property {ColorResolvable} [tertiaryColor] The tertiary color of the role.
|
||||
* When sending `tertiaryColor` the API enforces the role color to be a holographic style
|
||||
* with values of `primaryColor = 11127295`, `secondaryColor = 16759788`, and `tertiaryColor = 16761760`.
|
||||
* These values are available as a constant: `Constants.HolographicStyle`
|
||||
*/
|
||||
|
||||
/**
|
||||
* Options used to create a new role.
|
||||
* @typedef {Object} RoleCreateOptions
|
||||
* @property {string} [name] The name of the new role
|
||||
* @property {ColorResolvable} [color] The data to create the role with
|
||||
* <warn>This property is deprecated. Use `colors` instead.</warn>
|
||||
* @property {RoleColorsResolvable} [colors] The colors to create the role with
|
||||
* @property {boolean} [hoist] Whether or not the new role should be hoisted
|
||||
* @property {PermissionResolvable} [permissions] The permissions for the new role
|
||||
* @property {number} [position] The position of the new role
|
||||
@@ -142,15 +157,30 @@ class RoleManager extends CachedManager {
|
||||
* // Create a new role with data and a reason
|
||||
* guild.roles.create({
|
||||
* name: 'Super Cool Blue People',
|
||||
* color: Colors.Blue,
|
||||
* reason: 'we needed a role for Super Cool People',
|
||||
* colors: {
|
||||
* primaryColor: Colors.Blue,
|
||||
* },
|
||||
* })
|
||||
* .then(console.log)
|
||||
* .catch(console.error);
|
||||
* @example
|
||||
* // Create a role with holographic colors
|
||||
* guild.roles.create({
|
||||
* name: 'Holographic Role',
|
||||
* reason: 'Creating a role with holographic effect',
|
||||
* colors: {
|
||||
* primaryColor: Constants.HolographicStyle.Primary,
|
||||
* secondaryColor: Constants.HolographicStyle.Secondary,
|
||||
* tertiaryColor: Constants.HolographicStyle.Tertiary,
|
||||
* },
|
||||
* })
|
||||
* .then(console.log)
|
||||
* .catch(console.error);
|
||||
*/
|
||||
async create(options = {}) {
|
||||
let { name, color, hoist, permissions, position, mentionable, reason, icon, unicodeEmoji } = options;
|
||||
color &&= resolveColor(color);
|
||||
let { permissions, icon } = options;
|
||||
const { name, color, hoist, position, mentionable, reason, unicodeEmoji } = options;
|
||||
if (permissions !== undefined) permissions = new PermissionsBitField(permissions);
|
||||
if (icon) {
|
||||
const guildEmojiURL = this.guild.emojis.resolve(icon)?.imageURL();
|
||||
@@ -158,10 +188,30 @@ class RoleManager extends CachedManager {
|
||||
if (typeof icon !== 'string') icon = undefined;
|
||||
}
|
||||
|
||||
let colors = options.colors && {
|
||||
primary_color: resolveColor(options.colors.primaryColor),
|
||||
secondary_color: options.colors.secondaryColor && resolveColor(options.colors.secondaryColor),
|
||||
tertiary_color: options.colors.tertiaryColor && resolveColor(options.colors.tertiaryColor),
|
||||
};
|
||||
|
||||
if (color !== undefined) {
|
||||
if (!deprecationEmittedForCreate) {
|
||||
process.emitWarning(`Passing "color" to RoleManager#create() is deprecated. Use "colors" instead.`);
|
||||
}
|
||||
|
||||
deprecationEmittedForCreate = true;
|
||||
|
||||
colors = {
|
||||
primary_color: resolveColor(color),
|
||||
secondary_color: null,
|
||||
tertiary_color: null,
|
||||
};
|
||||
}
|
||||
|
||||
const data = await this.client.rest.post(Routes.guildRoles(this.guild.id), {
|
||||
body: {
|
||||
name,
|
||||
color,
|
||||
colors,
|
||||
hoist,
|
||||
permissions,
|
||||
mentionable,
|
||||
@@ -210,9 +260,29 @@ class RoleManager extends CachedManager {
|
||||
if (typeof icon !== 'string') icon = undefined;
|
||||
}
|
||||
|
||||
let colors = options.colors && {
|
||||
primary_color: resolveColor(options.colors.primaryColor),
|
||||
secondary_color: options.colors.secondaryColor && resolveColor(options.colors.secondaryColor),
|
||||
tertiary_color: options.colors.tertiaryColor && resolveColor(options.colors.tertiaryColor),
|
||||
};
|
||||
|
||||
if (options.color !== undefined) {
|
||||
if (!deprecationEmittedForEdit) {
|
||||
process.emitWarning(`Passing "color" to RoleManager#edit() is deprecated. Use "colors" instead.`);
|
||||
}
|
||||
|
||||
deprecationEmittedForEdit = true;
|
||||
|
||||
colors = {
|
||||
primary_color: resolveColor(options.color),
|
||||
secondary_color: null,
|
||||
tertiary_color: null,
|
||||
};
|
||||
}
|
||||
|
||||
const body = {
|
||||
name: options.name,
|
||||
color: options.color === undefined ? undefined : resolveColor(options.color),
|
||||
colors,
|
||||
hoist: options.hoist,
|
||||
permissions: options.permissions === undefined ? undefined : new PermissionsBitField(options.permissions),
|
||||
mentionable: options.mentionable,
|
||||
|
||||
Reference in New Issue
Block a user