fix: see description

- Spell Check
- Rewrite Docs
- Rewrite Enums
This commit is contained in:
March 7th 2022-07-17 17:52:28 +07:00
parent 25e22b7daa
commit 600df364f4
8 changed files with 151 additions and 38 deletions

File diff suppressed because one or more lines are too long

View File

@ -22,13 +22,13 @@ async function checkUpdate(client) {
if (!res_) {
return client.emit('update', `${chalk.redBright('[Fail]')} Check Update error`);
}
const lastest_tag = res_.data['dist-tags'].latest;
const latest_tag = res_.data['dist-tags'].latest;
if (client.options.checkUpdate) {
if (lastest_tag !== Discord.version && Discord.version.includes('-') == false) {
if (latest_tag !== Discord.version && Discord.version.includes('-') == false) {
if (!running) {
console.log(`
${chalk.yellowBright('[WARNING]')} New Discord.js-selfbot-v13 version.
Current: ${chalk.redBright(Discord.version)} => Latest: ${chalk.greenBright(lastest_tag)}
Current: ${chalk.redBright(Discord.version)} => Latest: ${chalk.greenBright(latest_tag)}
If you don't want to show this message, set \`checkUpdate\` to false
@ -56,7 +56,7 @@ async function checkUpdate(client) {
}
}
running = true;
return client.emit('update', Discord.version, lastest_tag);
return client.emit('update', Discord.version, latest_tag);
}
module.exports = (client, { d: data }, shard) => {

View File

@ -8,57 +8,135 @@ const { localeObject, DMScanLevel, stickerAnimationMode } = require('../util/Con
/**
* Manages API methods for users and stores their cache.
* @extends {BaseManager}
* @see {@link https://luna.gitlab.io/discord-unofficial-docs/user_settings.html}
*/
class ClientUserSettingManager extends BaseManager {
constructor(client) {
super(client);
// Raw data
/**
* Raw data
* @type {Object}
*/
this.rawSetting = {};
// Language
/**
* Language
* @type {?string}
*/
this.locale = null;
// Setting => ACTIVITY SETTINGS => Activity Status => Display current activity as a status message
/**
* From: Setting => ACTIVITY SETTINGS => Activity Status => Display current activity as a status message
* @type {?boolean}
*/
this.activityDisplay = null;
//
/**
* Disable Direct Message from servers
* @type {Collection<Snowflake, boolean>}
*/
this.disableDMfromServer = new Collection();
// Allow direct messages from server members
/**
* Allow direct messages from server members
* @type {?boolean}
*/
this.DMfromServerMode = null;
//
/**
* Display images
* @type {?boolean}
*/
this.displayImage = null;
//
/**
* Display linked images
* @type {?boolean}
*/
this.linkedImageDisplay = null;
// Setting => APP SETTINGS => Accessibility => Automatically play GIFs when Discord is focused.
/**
* From: Setting => APP SETTINGS => Accessibility => Automatically play GIFs when Discord is focused.
* @type {?boolean}
*/
this.autoplayGIF = null;
// Show embeds and preview website links pasted into chat
/**
* Show embeds and preview website links pasted into chat
* @type {?boolean}
*/
this.previewLink = null;
// Setting => APP SETTINGS => Accessibility => Play Animated Emojis
/**
* From: Setting => APP SETTINGS => Accessibility => Play Animated Emojis
* @type {?boolean}
*/
this.animatedEmojis = null;
// Setting => APP SETTINGS => Accessibility => Text-to-speech => Allow playback
/**
* From: Setting => APP SETTINGS => Accessibility => Text-to-speech => Allow playback
* @type {?boolean}
*/
this.allowTTS = null;
// Setting => APP SETTINGS => Appearance => Message Display => Compact Mode [OK]
/**
* From: Setting => APP SETTINGS => Appearance => Message Display => Compact Mode
* @type {?boolean}
*/
this.compactMode = null;
// Setting => APP SETTINGS => Text & Images => Emoji => Convert Emoticons
/**
* From: Setting => APP SETTINGS => Text & Images => Emoji => Convert Emoticons
* @type {?boolean}
*/
this.convertEmoticons = null;
// SAFE DIRECT MESSAGING
/**
* SAFE DIRECT MESSAGING
* @type {?DMScanLevel}
*/
this.DMScanLevel = null;
// Setting => APP SETTINGS => Appearance => Theme [OK]
/**
* From: Setting => APP SETTINGS => Appearance => Theme
* @type {'dark' | 'light' | null}
*/
this.theme = '';
//
/**
* Developer Mode (Copy ID, etc.)
* @type {?boolean}
*/
this.developerMode = null;
//
/**
* AFK timeout (receives notifications)
* @type {?number}
*/
this.afkTimeout = null;
//
/**
* Sticker animation mode
* @type {?stickerAnimationMode}
*/
this.stickerAnimationMode = null;
// WHO CAN ADD YOU AS A FRIEND ?
/**
* WHO CAN ADD YOU AS A FRIEND ?
* @type {?object}
* @see {@link https://luna.gitlab.io/discord-unofficial-docs/user_settings.html#friend-source-flags-structure}
*/
this.addFriendFrom = {
all: null,
mutual_friends: null,
mutual_guilds: null,
};
// Setting => APP SETTINGS => Text & Images => Emoji => Show emoji reactions
/**
* From: Setting => APP SETTINGS => Text & Images => Emoji => Show emoji reactions
* @type {?boolean}
*/
this.showEmojiReactions = null;
// Custom Stauts [It's not working now]
/**
* Custom Stauts
* @type {?object}
* @see {@link https://luna.gitlab.io/discord-unofficial-docs/custom_status.html#customstatus-structure}
*/
this.customStatus = null;
// Guild folder and position
/**
* @typedef {object} guildFolderData
* @property {Snowflake} guildId Guild ID
* @property {number | string} folderId ID of the folder
* @property {number} folderIndex Index of the folder
* @property {string} folderName Name of the folder
* @property {any} folderColor Color of the folder
* @property {Snowflake[]} folderGuilds Array of guild IDs in the folder
*/
/**
* Guild folder and position
* @type {Collection<Snowflake, guildFolderData>}
*/
this.guildMetadata = new Collection();
// Todo: add new method from Discum
}

View File

@ -5,7 +5,7 @@ const Invite = require('./Invite');
const { Message } = require('./Message');
const User = require('./User');
const { Util } = require('..');
const { HypeSquadOptions, Opcodes } = require('../util/Constants');
const { HypeSquadOptions, Opcodes, NitroType } = require('../util/Constants');
const DataResolver = require('../util/DataResolver');
const PurchasedFlags = require('../util/PurchasedFlags');
/**
@ -36,13 +36,14 @@ class ClientUser extends User {
if ('token' in data) this.client.token = data.token;
// Add (Selfbot)
// Todo: Add (Selfbot)
if ('premium_type' in data) {
const nitro = NitroType[data.premium_type];
/**
* Nitro type of the client user.
* @type {?number}
* @type {NitroType}
*/
this.nitroType = data.premium_type;
this.nitroType = nitro ?? `UNKNOWN`;
}
if ('purchased_flags' in data) {
/**

View File

@ -417,7 +417,6 @@ class TextBasedChannel {
include_applications: false,
query: commandName,
limit: 25, // Max
// Shet
// application_id: botId,
},
});

View File

@ -30,13 +30,34 @@ const listUserAgent = [
'Mozilla/5.0 (Macintosh; Intel Mac OS X 12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36 Edg/103.0.1264.37',
];
/**
* Automatically scan and delete direct messages you receive that contain explicit media content.
* * `NOT_SCAN` - Direct messages will not be scanned for explicit content.
* * `NOT_FRIEND` - Scan direct messages from everyone unless they are a friend.
* * `EVERYONE` - Scan direct messages from everyone.
* @typedef {string} DMScanLevel
*/
exports.DMScanLevel = createEnum(['NOT_SCAN', 'NOT_FRIEND', 'EVERYONE']);
exports.stickerAnimationMode = {
0: 'ALWAYS',
1: 'INTERACTION',
2: 'NEVER',
};
/**
* This controls when stickers animate:
* * `ALWAYS` - Always animate.
* * `INTERACTION` - On the desktop client, stickers will animate on hover or focus. On mobile clients, stickers will animate on long-press.
* * `NEVER` - Never animate.
* @typedef {string} stickerAnimationMode
*/
exports.stickerAnimationMode = createEnum(['ALWAYS', 'INTERACTION', 'NEVER']);
/**
* All available nitro types:
* * `NONE` - None
* * `CLASSIC` - Nitro Classic
* * `NITRO_BOOST` - Nitro
* * `UNKNOWN` - New nitro (maybe Nitro Lite / Basic ???)
* @typedef {string} NitroType
* @see {@link https://discord.com/developers/docs/resources/user#user-object-premium-types}
*/
exports.NitroType = createEnum(['NONE', 'NITRO_CLASSIC', 'NITRO_BOOST']);
exports.localeObject = {
da: 'DANISH',

6
typings/enums.d.ts vendored
View File

@ -22,6 +22,12 @@ export const enum stickerAnimationMode {
NEVER = 2,
}
export const enum NitroType {
NONE = 0,
NITRO_CLASSIC = 1,
NITRO_BOOST = 2,
}
export const enum RelationshipTypes {
FRIEND = 1,
BLOCKED = 2,

10
typings/index.d.ts vendored
View File

@ -3523,6 +3523,14 @@ export class ChannelManager extends CachedManager<Snowflake, AnyChannel, Channel
export type FetchGuildApplicationCommandFetchOptions = Omit<FetchApplicationCommandOptions, 'guildId'>;
export interface guildFolderData {
guildId: Snowflake;
folderId: number | string;
folderIndex: number;
folderName: string;
folderColor: any;
folderGuilds: Snowflake[];
}
export class ClientUserSettingManager extends BaseManager {
private constructor(client: Client);
public rawSetting: RawUserSettingsData | object;
@ -3553,7 +3561,7 @@ export class ClientUserSettingManager extends BaseManager {
}
| object;
public addFriendFrom: { all?: boolean; mutual_friends?: boolean; mututal_guilds?: boolean } | object;
public guildMetadata: Collection<Snowflake, object>;
public guildMetadata: Collection<Snowflake, guildFolderData>;
public disableDMfromServer: Collection<Snowflake, boolean>;
public fetch(): Promise<RawUserSettingsData>;
public setDisplayCompactMode(value?: boolean): Promise<this>;