Docs: Update

This commit is contained in:
March 7th
2022-11-18 19:23:12 +07:00
parent 21261de111
commit 3e23407ed0
5 changed files with 26 additions and 60 deletions

View File

@@ -375,6 +375,7 @@ class ClientUser extends User {
* @example
* // Set the client user's presence
* client.user.setPresence({ activities: [{ name: 'with discord.js' }], status: 'idle' });
* @see {@link https://github.com/aiko-chan-ai/discord.js-selfbot-v13/blob/main/Document/RichPresence.md}
*/
setPresence(data) {
return this.client.presence.set(data);
@@ -419,6 +420,7 @@ class ClientUser extends User {
* @example
* // Set the client user's activity
* client.user.setActivity('discord.js', { type: 'WATCHING' });
* @see {@link https://github.com/aiko-chan-ai/discord.js-selfbot-v13/blob/main/Document/RichPresence.md}
*/
setActivity(name, options = {}) {
if (!name) {
@@ -444,21 +446,21 @@ class ClientUser extends User {
/**
* Create an invite [Friend Invites]
* @param {CreateInviteOptions} [options={}] The options for creating the invite [maxAge and maxUses are available]
* maxAge: 86400 | maxUses: 0
* @returns {Promise<Invite>}
* @see https://github.com/13-05/hidden-disc-docs#js-snippet-for-creating-friend-invites
* @see {@link https://github.com/13-05/hidden-disc-docs#js-snippet-for-creating-friend-invites}
* @example
* // Options not working
* client.user.getInvite();
* .then(console.log)
* .catch(console.error);
*/
async getInvite({ maxAge = 86400, maxUses = 0 } = {}) {
async getInvite() {
const data = await this.client.api.users['@me'].invites.post({
data: {
validate: null,
max_age: maxAge,
max_uses: maxUses,
max_age: 86400,
max_uses: 0,
target_type: 2,
temporary: false,
},

View File

@@ -437,21 +437,21 @@ class TextBasedChannel {
/**
* Send Slash to this channel
* @param {UserResolvable} bot Bot user
* @param {UserResolvable} bot Bot user (BotID, not applicationID)
* @param {string} commandString Command name (and sub / group formats)
* @param {...?any|any[]} args Command arguments
* @returns {Promise<InteractionResponse>}
* @example
* // Send Slash to this channel
* // Demo:
* // + BotID: "123456789012345678"
* // + CommandName: "embed"
* // + Args: "title", "description", "author", 'color' (Optional)
* channel.sendSlash('123456789012345678', 'embed', 'title', 'description', 'author', '#00ff00')
* // Send embed with Title and Color:
* channel.sendSlash('123456789012345678', 'embed', 'title', undefined, undefined, '#00ff00')
* // CommandName is Group Command / Sub Command
* channel.sendSlash('123456789012345678', 'embed title', 'description', 'author', '#00ff00')
* // Send a basic slash
* channel.sendSlash('botid', 'ping)
* .then(console.log)
* .catch(console.error);
* @example
* // Send a remote file
* channel.send('botid', 'emoji upload', 'https://cdn.discordapp.com/icons/222078108977594368/6e1019b3179d71046e463a75915e7244.png?size=2048', 'test')
* .then(console.log)
* .catch(console.error);
* @see {@link https://github.com/aiko-chan-ai/discord.js-selfbot-v13/blob/main/Document/SlashCommand.md}
*/
async sendSlash(bot, commandString, ...args) {
const perms =
@@ -462,7 +462,7 @@ class TextBasedChannel {
throw new Error(
'INTERACTION_SEND_FAILURE',
`Cannot send Slash to ${this.toString()} ${
this.recipient ? 'because user has been blocked' : 'due to missing SEND_MESSAGES permission'
this.recipient ? 'because bot has been blocked' : 'due to missing SEND_MESSAGES permission'
}`,
);
}
@@ -485,7 +485,6 @@ class TextBasedChannel {
}
if (!bot) throw new Error('MUST_SPECIFY_BOT');
const botId = this.client.users.resolveId(bot);
// ? maybe ...
const user = await this.client.users.fetch(botId).catch(() => {});
if (!user || !user.bot || !user.application) {
throw new Error('botId is not a bot or does not have an application slash command');