chore: release v2.8.11

This commit is contained in:
March 7th 2022-11-04 19:46:05 +07:00
parent 83e764aad5
commit 04296bd6d1
6 changed files with 98 additions and 22 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "discord.js-selfbot-v13",
"version": "2.8.10",
"version": "2.8.11",
"description": "A unofficial discord.js fork for creating selfbots [Based on discord.js v13]",
"main": "./src/index.js",
"types": "./typings/index.d.ts",

View File

@ -893,7 +893,9 @@ class Client extends BaseClient {
*/
_validateOptions(options = this.options) {
const captchaService = ['2captcha'];
options.captchaService = '';
if (options && options.captchaService) {
options.captchaService = undefined;
}
if (typeof options.intents === 'undefined') {
throw new TypeError('CLIENT_MISSING_INTENTS');
} else {

View File

@ -3,6 +3,7 @@
const { Channel } = require('./Channel');
const TextBasedChannel = require('./interfaces/TextBasedChannel');
const { RangeError } = require('../errors');
const InteractionManager = require('../managers/InteractionManager');
const MessageManager = require('../managers/MessageManager');
const ThreadMemberManager = require('../managers/ThreadMemberManager');
const ChannelFlags = require('../util/ChannelFlags');
@ -41,6 +42,12 @@ class ThreadChannel extends Channel {
* @type {ThreadMemberManager}
*/
this.members = new ThreadMemberManager(this);
/**
* A manager of the interactions sent to this channel
* @type {InteractionManager}
*/
this.interactions = new InteractionManager(this);
if (data) this._patch(data, fromInteraction);
}

View File

@ -115,17 +115,21 @@ class Util extends null {
/**
* Options used to escape markdown.
* @typedef {Object} EscapeMarkdownOptions
* @property {boolean} [codeBlock=true] Whether to escape code blocks or not
* @property {boolean} [inlineCode=true] Whether to escape inline code or not
* @property {boolean} [bold=true] Whether to escape bolds or not
* @property {boolean} [italic=true] Whether to escape italics or not
* @property {boolean} [underline=true] Whether to escape underlines or not
* @property {boolean} [strikethrough=true] Whether to escape strikethroughs or not
* @property {boolean} [spoiler=true] Whether to escape spoilers or not
* @property {boolean} [codeBlockContent=true] Whether to escape text inside code blocks or not
* @property {boolean} [inlineCodeContent=true] Whether to escape text inside inline code or not
* @property {boolean} [codeBlock=true] Whether to escape code blocks
* @property {boolean} [inlineCode=true] Whether to escape inline code
* @property {boolean} [bold=true] Whether to escape bolds
* @property {boolean} [italic=true] Whether to escape italics
* @property {boolean} [underline=true] Whether to escape underlines
* @property {boolean} [strikethrough=true] Whether to escape strikethroughs
* @property {boolean} [spoiler=true] Whether to escape spoilers
* @property {boolean} [codeBlockContent=true] Whether to escape text inside code blocks
* @property {boolean} [inlineCodeContent=true] Whether to escape text inside inline code
* @property {boolean} [escape=true] Whether to escape escape characters
* @property {boolean} [heading=false] Whether to escape headings
* @property {boolean} [bulletedList=false] Whether to escape bulleted lists
* @property {boolean} [numberedList=false] Whether to escape numbered lists
* @property {boolean} [maskedLink=false] Whether to escape masked links
*/
/**
* Escapes any Discord-flavour markdown in a string.
* @param {string} text Content to escape
@ -144,6 +148,11 @@ class Util extends null {
spoiler = true,
codeBlockContent = true,
inlineCodeContent = true,
escape = true,
heading = false,
bulletedList = false,
numberedList = false,
maskedLink = false,
} = {},
) {
if (!codeBlockContent) {
@ -159,6 +168,11 @@ class Util extends null {
strikethrough,
spoiler,
inlineCodeContent,
escape,
heading,
bulletedList,
numberedList,
maskedLink,
});
})
.join(codeBlock ? '\\`\\`\\`' : '```');
@ -175,10 +189,16 @@ class Util extends null {
underline,
strikethrough,
spoiler,
escape,
heading,
bulletedList,
numberedList,
maskedLink,
});
})
.join(inlineCode ? '\\`' : '`');
}
if (escape) text = Util.escapeEscape(text);
if (inlineCode) text = Util.escapeInlineCode(text);
if (codeBlock) text = Util.escapeCodeBlock(text);
if (italic) text = Util.escapeItalic(text);
@ -186,9 +206,12 @@ class Util extends null {
if (underline) text = Util.escapeUnderline(text);
if (strikethrough) text = Util.escapeStrikethrough(text);
if (spoiler) text = Util.escapeSpoiler(text);
if (heading) text = Util.escapeHeading(text);
if (bulletedList) text = Util.escapeBulletedList(text);
if (numberedList) text = Util.escapeNumberedList(text);
if (maskedLink) text = Util.escapeMaskedLink(text);
return text;
}
/**
* Escapes code block markdown in a string.
* @param {string} text Content to escape
@ -197,16 +220,14 @@ class Util extends null {
static escapeCodeBlock(text) {
return text.replaceAll('```', '\\`\\`\\`');
}
/**
* Escapes inline code markdown in a string.
* @param {string} text Content to escape
* @returns {string}
*/
static escapeInlineCode(text) {
return text.replace(/(?<=^|[^`])`(?=[^`]|$)/g, '\\`');
return text.replace(/(?<=^|[^`])``?(?=[^`]|$)/g, match => (match.length === 2 ? '\\`\\`' : '\\`'));
}
/**
* Escapes italic markdown in a string.
* @param {string} text Content to escape
@ -224,7 +245,6 @@ class Util extends null {
return `\\_${match}`;
});
}
/**
* Escapes bold markdown in a string.
* @param {string} text Content to escape
@ -237,7 +257,6 @@ class Util extends null {
return '\\*\\*';
});
}
/**
* Escapes underline markdown in a string.
* @param {string} text Content to escape
@ -250,7 +269,6 @@ class Util extends null {
return '\\_\\_';
});
}
/**
* Escapes strikethrough markdown in a string.
* @param {string} text Content to escape
@ -259,7 +277,6 @@ class Util extends null {
static escapeStrikethrough(text) {
return text.replaceAll('~~', '\\~\\~');
}
/**
* Escapes spoiler markdown in a string.
* @param {string} text Content to escape
@ -268,6 +285,46 @@ class Util extends null {
static escapeSpoiler(text) {
return text.replaceAll('||', '\\|\\|');
}
/**
* Escapes escape characters in a string.
* @param {string} text Content to escape
* @returns {string}
*/
static escapeEscape(text) {
return text.replaceAll('\\', '\\\\');
}
/**
* Escapes heading characters in a string.
* @param {string} text Content to escape
* @returns {string}
*/
static escapeHeading(text) {
return text.replaceAll(/^( {0,2}[*-] +)?(#{1,3} )/gm, '$1\\$2');
}
/**
* Escapes bulleted list characters in a string.
* @param {string} text Content to escape
* @returns {string}
*/
static escapeBulletedList(text) {
return text.replaceAll(/^( *)[*-]( +)/gm, '$1\\-$2');
}
/**
* Escapes numbered list characters in a string.
* @param {string} text Content to escape
* @returns {string}
*/
static escapeNumberedList(text) {
return text.replaceAll(/^( *\d+)\./gm, '$1\\.');
}
/**
* Escapes masked link characters in a string.
* @param {string} text Content to escape
* @returns {string}
*/
static escapeMaskedLink(text) {
return text.replaceAll(/\[.+\]\(.+\)/gm, '\\$&');
}
/**
* @typedef {Object} FetchRecommendedShardsOptions

12
typings/index.d.ts vendored
View File

@ -3075,6 +3075,11 @@ export class Util extends null {
public static escapeUnderline(text: string): string;
public static escapeStrikethrough(text: string): string;
public static escapeSpoiler(text: string): string;
public static escapeEscape(text: string): string;
public static escapeHeading(text: string): string;
public static escapeBulletedList(text: string): string;
public static escapeNumberedList(text: string): string;
public static escapeMaskedLink(text: string): string;
public static cleanCodeBlockContent(text: string): string;
public static fetchRecommendedShards(token: string, options?: FetchRecommendedShardsOptions): Promise<number>;
public static flatten(obj: unknown, ...props: Record<string, boolean | string>[]): unknown;
@ -5361,8 +5366,13 @@ export interface EscapeMarkdownOptions {
underline?: boolean;
strikethrough?: boolean;
spoiler?: boolean;
inlineCodeContent?: boolean;
codeBlockContent?: boolean;
inlineCodeContent?: boolean;
escape?: boolean;
heading?: boolean;
bulletedList?: boolean;
numberedList?: boolean;
maskedLink?: boolean;
}
export type ExplicitContentFilterLevel = keyof typeof ExplicitContentFilterLevels;