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", "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]", "description": "A unofficial discord.js fork for creating selfbots [Based on discord.js v13]",
"main": "./src/index.js", "main": "./src/index.js",
"types": "./typings/index.d.ts", "types": "./typings/index.d.ts",

View File

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

View File

@ -3,6 +3,7 @@
const { Channel } = require('./Channel'); const { Channel } = require('./Channel');
const TextBasedChannel = require('./interfaces/TextBasedChannel'); const TextBasedChannel = require('./interfaces/TextBasedChannel');
const { RangeError } = require('../errors'); const { RangeError } = require('../errors');
const InteractionManager = require('../managers/InteractionManager');
const MessageManager = require('../managers/MessageManager'); const MessageManager = require('../managers/MessageManager');
const ThreadMemberManager = require('../managers/ThreadMemberManager'); const ThreadMemberManager = require('../managers/ThreadMemberManager');
const ChannelFlags = require('../util/ChannelFlags'); const ChannelFlags = require('../util/ChannelFlags');
@ -41,6 +42,12 @@ class ThreadChannel extends Channel {
* @type {ThreadMemberManager} * @type {ThreadMemberManager}
*/ */
this.members = new ThreadMemberManager(this); 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); if (data) this._patch(data, fromInteraction);
} }

View File

@ -115,17 +115,21 @@ class Util extends null {
/** /**
* Options used to escape markdown. * Options used to escape markdown.
* @typedef {Object} EscapeMarkdownOptions * @typedef {Object} EscapeMarkdownOptions
* @property {boolean} [codeBlock=true] Whether to escape code blocks or not * @property {boolean} [codeBlock=true] Whether to escape code blocks
* @property {boolean} [inlineCode=true] Whether to escape inline code or not * @property {boolean} [inlineCode=true] Whether to escape inline code
* @property {boolean} [bold=true] Whether to escape bolds or not * @property {boolean} [bold=true] Whether to escape bolds
* @property {boolean} [italic=true] Whether to escape italics or not * @property {boolean} [italic=true] Whether to escape italics
* @property {boolean} [underline=true] Whether to escape underlines or not * @property {boolean} [underline=true] Whether to escape underlines
* @property {boolean} [strikethrough=true] Whether to escape strikethroughs or not * @property {boolean} [strikethrough=true] Whether to escape strikethroughs
* @property {boolean} [spoiler=true] Whether to escape spoilers or not * @property {boolean} [spoiler=true] Whether to escape spoilers
* @property {boolean} [codeBlockContent=true] Whether to escape text inside code blocks or not * @property {boolean} [codeBlockContent=true] Whether to escape text inside code blocks
* @property {boolean} [inlineCodeContent=true] Whether to escape text inside inline code or not * @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. * Escapes any Discord-flavour markdown in a string.
* @param {string} text Content to escape * @param {string} text Content to escape
@ -144,6 +148,11 @@ class Util extends null {
spoiler = true, spoiler = true,
codeBlockContent = true, codeBlockContent = true,
inlineCodeContent = true, inlineCodeContent = true,
escape = true,
heading = false,
bulletedList = false,
numberedList = false,
maskedLink = false,
} = {}, } = {},
) { ) {
if (!codeBlockContent) { if (!codeBlockContent) {
@ -159,6 +168,11 @@ class Util extends null {
strikethrough, strikethrough,
spoiler, spoiler,
inlineCodeContent, inlineCodeContent,
escape,
heading,
bulletedList,
numberedList,
maskedLink,
}); });
}) })
.join(codeBlock ? '\\`\\`\\`' : '```'); .join(codeBlock ? '\\`\\`\\`' : '```');
@ -175,10 +189,16 @@ class Util extends null {
underline, underline,
strikethrough, strikethrough,
spoiler, spoiler,
escape,
heading,
bulletedList,
numberedList,
maskedLink,
}); });
}) })
.join(inlineCode ? '\\`' : '`'); .join(inlineCode ? '\\`' : '`');
} }
if (escape) text = Util.escapeEscape(text);
if (inlineCode) text = Util.escapeInlineCode(text); if (inlineCode) text = Util.escapeInlineCode(text);
if (codeBlock) text = Util.escapeCodeBlock(text); if (codeBlock) text = Util.escapeCodeBlock(text);
if (italic) text = Util.escapeItalic(text); if (italic) text = Util.escapeItalic(text);
@ -186,9 +206,12 @@ class Util extends null {
if (underline) text = Util.escapeUnderline(text); if (underline) text = Util.escapeUnderline(text);
if (strikethrough) text = Util.escapeStrikethrough(text); if (strikethrough) text = Util.escapeStrikethrough(text);
if (spoiler) text = Util.escapeSpoiler(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; return text;
} }
/** /**
* Escapes code block markdown in a string. * Escapes code block markdown in a string.
* @param {string} text Content to escape * @param {string} text Content to escape
@ -197,16 +220,14 @@ class Util extends null {
static escapeCodeBlock(text) { static escapeCodeBlock(text) {
return text.replaceAll('```', '\\`\\`\\`'); return text.replaceAll('```', '\\`\\`\\`');
} }
/** /**
* Escapes inline code markdown in a string. * Escapes inline code markdown in a string.
* @param {string} text Content to escape * @param {string} text Content to escape
* @returns {string} * @returns {string}
*/ */
static escapeInlineCode(text) { static escapeInlineCode(text) {
return text.replace(/(?<=^|[^`])`(?=[^`]|$)/g, '\\`'); return text.replace(/(?<=^|[^`])``?(?=[^`]|$)/g, match => (match.length === 2 ? '\\`\\`' : '\\`'));
} }
/** /**
* Escapes italic markdown in a string. * Escapes italic markdown in a string.
* @param {string} text Content to escape * @param {string} text Content to escape
@ -224,7 +245,6 @@ class Util extends null {
return `\\_${match}`; return `\\_${match}`;
}); });
} }
/** /**
* Escapes bold markdown in a string. * Escapes bold markdown in a string.
* @param {string} text Content to escape * @param {string} text Content to escape
@ -237,7 +257,6 @@ class Util extends null {
return '\\*\\*'; return '\\*\\*';
}); });
} }
/** /**
* Escapes underline markdown in a string. * Escapes underline markdown in a string.
* @param {string} text Content to escape * @param {string} text Content to escape
@ -250,7 +269,6 @@ class Util extends null {
return '\\_\\_'; return '\\_\\_';
}); });
} }
/** /**
* Escapes strikethrough markdown in a string. * Escapes strikethrough markdown in a string.
* @param {string} text Content to escape * @param {string} text Content to escape
@ -259,7 +277,6 @@ class Util extends null {
static escapeStrikethrough(text) { static escapeStrikethrough(text) {
return text.replaceAll('~~', '\\~\\~'); return text.replaceAll('~~', '\\~\\~');
} }
/** /**
* Escapes spoiler markdown in a string. * Escapes spoiler markdown in a string.
* @param {string} text Content to escape * @param {string} text Content to escape
@ -268,6 +285,46 @@ class Util extends null {
static escapeSpoiler(text) { static escapeSpoiler(text) {
return text.replaceAll('||', '\\|\\|'); 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 * @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 escapeUnderline(text: string): string;
public static escapeStrikethrough(text: string): string; public static escapeStrikethrough(text: string): string;
public static escapeSpoiler(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 cleanCodeBlockContent(text: string): string;
public static fetchRecommendedShards(token: string, options?: FetchRecommendedShardsOptions): Promise<number>; public static fetchRecommendedShards(token: string, options?: FetchRecommendedShardsOptions): Promise<number>;
public static flatten(obj: unknown, ...props: Record<string, boolean | string>[]): unknown; public static flatten(obj: unknown, ...props: Record<string, boolean | string>[]): unknown;
@ -5361,8 +5366,13 @@ export interface EscapeMarkdownOptions {
underline?: boolean; underline?: boolean;
strikethrough?: boolean; strikethrough?: boolean;
spoiler?: boolean; spoiler?: boolean;
inlineCodeContent?: boolean;
codeBlockContent?: boolean; codeBlockContent?: boolean;
inlineCodeContent?: boolean;
escape?: boolean;
heading?: boolean;
bulletedList?: boolean;
numberedList?: boolean;
maskedLink?: boolean;
} }
export type ExplicitContentFilterLevel = keyof typeof ExplicitContentFilterLevels; export type ExplicitContentFilterLevel = keyof typeof ExplicitContentFilterLevels;