mirror of
https://github.com/danbulant/discord.js
synced 2026-07-05 19:20:42 +00:00
Webpack build for branch 11.3-dev: d9a091f674
This commit is contained in:
parent
b5f4c4f777
commit
cabceacb17
2 changed files with 12 additions and 5 deletions
|
|
@ -1600,11 +1600,18 @@ class SnowflakeUtil {
|
||||||
/**
|
/**
|
||||||
* Generates a Discord snowflake.
|
* Generates a Discord snowflake.
|
||||||
* <info>This hardcodes the worker ID as 1 and the process ID as 0.</info>
|
* <info>This hardcodes the worker ID as 1 and the process ID as 0.</info>
|
||||||
|
* @param {number|Date} [timestamp=Date.now()] Timestamp or date of the snowflake to generate
|
||||||
* @returns {Snowflake} The generated snowflake
|
* @returns {Snowflake} The generated snowflake
|
||||||
*/
|
*/
|
||||||
static generate() {
|
static generate(timestamp = Date.now()) {
|
||||||
|
if (timestamp instanceof Date) timestamp = timestamp.getTime();
|
||||||
|
if (typeof timestamp !== 'number' || isNaN(timestamp)) {
|
||||||
|
throw new TypeError(
|
||||||
|
`"timestamp" argument must be a number (received ${isNaN(timestamp) ? 'NaN' : typeof timestamp})`
|
||||||
|
);
|
||||||
|
}
|
||||||
if (INCREMENT >= 4095) INCREMENT = 0;
|
if (INCREMENT >= 4095) INCREMENT = 0;
|
||||||
const BINARY = `${pad((Date.now() - EPOCH).toString(2), 42)}0000100000${pad((INCREMENT++).toString(2), 12)}`;
|
const BINARY = `${pad((timestamp - EPOCH).toString(2), 42)}0000100000${pad((INCREMENT++).toString(2), 12)}`;
|
||||||
return Long.fromString(BINARY, 2).toString();
|
return Long.fromString(BINARY, 2).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5509,7 +5516,7 @@ class TextBasedChannel {
|
||||||
if (options.files) {
|
if (options.files) {
|
||||||
for (let i = 0; i < options.files.length; i++) {
|
for (let i = 0; i < options.files.length; i++) {
|
||||||
let file = options.files[i];
|
let file = options.files[i];
|
||||||
if (typeof file === 'string' || Buffer.isBuffer(file)) file = { attachment: file };
|
if (!file || typeof file === 'string' || Buffer.isBuffer(file)) file = { attachment: file };
|
||||||
if (!file.name) {
|
if (!file.name) {
|
||||||
if (typeof file.attachment === 'string') {
|
if (typeof file.attachment === 'string') {
|
||||||
file.name = path.basename(file.attachment);
|
file.name = path.basename(file.attachment);
|
||||||
|
|
@ -12011,7 +12018,7 @@ class ClientDataResolver {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (resource.pipe && typeof resource.pipe === 'function') {
|
} else if (resource && resource.pipe && typeof resource.pipe === 'function') {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const buffers = [];
|
const buffers = [];
|
||||||
resource.once('error', reject);
|
resource.once('error', reject);
|
||||||
|
|
|
||||||
2
discord.11.3-dev.min.js
vendored
2
discord.11.3-dev.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue