UNPKG

jalter

Version:

A NodeJS wrapper for Discord Selfbot

229 lines (228 loc) 9.68 kB
declare class Jalter { private base; private auth; static default: typeof Jalter; constructor(token: string); /** * Returns the user object of the requester's account. * @returns the current user object * @example * ```js * jalter.getMe().then((res) => { console.log("getMe", res); }); * ``` * https://discord.com/developers/docs/resources/user#get-current-user */ getMe(): Promise<object>; /** * Returns a user object for a given user ID. * @param {string} userId the user id * @returns the user object * @example * ```js * jalter.getUser("317255788324454400").then((res) => { console.log("getUser", res); }); * ``` * https://discord.com/developers/docs/resources/user#get-user */ getUser(userId: string): Promise<object>; /** * Post a message to a guild text or DM channel. Returns a message object * @param {string} channelId the channel id * @param {string} text the message text * @returns the message object send * @example * ```js * jalter.sendMessage("974918359500075041", "hey").then((res) => { console.log("sendMessage", res); }); * ``` * https://discord.com/developers/docs/resources/channel#create-message */ sendMessage(channelId: string, text: string): Promise<object>; /** * Returns the messages for a channel. * @param {string} channelId * @param {number} limit * @return the messages that were received * @example * ```js * jalter.getMessages("974918359500075041", 10).then((res) => { console.log("getMessages", res); }); * ``` * https://discord.com/developers/docs/resources/channel#get-channel-messages */ getMessage(channelId: string, limit: number): Promise<object>; /** * Returns an audit log object for the guild * @param {string} guildId the guild id * return the audit logs from related guild * @example * ```js * jalter.getAuditLogs("974918359500075041").then((res) => { console.log("getAuditLogs", res); }); * ``` * https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log */ getAuditLogs(guildId: string): Promise<object>; /** * Returns a list of role objects for the guild. * @param {string} guildId the guild id * @returns the list of roles from related guild * @example * ```js * jalter.getRoles("974918359500075041").then((res) => { console.log("getRoles", res); }); * ``` * https://discord.com/developers/docs/resources/guild#get-guild-roles */ getRoles(guildId: string): Promise<object>; /** * Kick a member from a guild * @param {string} guildId the guild id * @param {string} userId the user id * @returns 204 empty response on success * @example * ```js * jalter.kickUser("974918359500075041", "317255788324454400").then((res) => { console.log("kickUser", res); }); * ``` * https://discord.com/developers/docs/resources/guild#remove-guild-member */ kickUser(guildId: string, userId: string): Promise<object>; /** * Ban a member from a guild * @param {string} guildId the guild id * @param {string} userId the user id * @param {string} reason the reason for banning * @returns 204 empty response on success * @example * ```js * jalter.banUser("974918359500075041", "974918359500075041", "I don't like you").then((res) => { console.log("banUser", res); }); * ``` * https://discord.com/developers/docs/resources/guild#remove-guild-member */ banUser(guildId: string, userId: string, reason?: string): Promise<object>; /** * Unban a member from a guild * @param {string} guildId the guild id * @param {string} userId the user id * @returns the user object that was unbanned * @example * ```js * jalter.unBanUser("974918359500075041", "974918359500075041").then((res) => { console.log("unBanUser", res); }); * ``` * https://discord.com/developers/docs/resources/guild#remove-guild-member */ unBanUser(guildId: string, userId: string): Promise<void>; /** * Join a guild * @param {string} inviteUrl the code invites * @returns the guild object that was joined * @example * ```js * jalter.joinGuild("ApHu666E").then((res) => { console.log("joinGuild", res); }); * ``` * https://discord.com/developers/docs/resources/invite#get-invite */ joinGuild(inviteUrl: string): Promise<object>; /** * Leave a guild. Returns a 204 empty response on success. * @param {string} guildId the guild id * @returns 204 empty response on success * @example * ```js * jalter.leaveGuild("974918359500075041").then((res) => { console.log("leaveGuild", res); }); * ``` * https://discord.com/developers/docs/resources/user#leave-guild */ leaveGuild(guildId: string): Promise<object>; /** * Trigger Typing Indicator * @param {string} channelId the channel id * @returns 204 empty response on success * @example * ```js * jalter.startTyping("974918359500075041").then((res) => { console.log("startTyping", res); }); * ``` * https://discord.com/developers/docs/resources/channel#trigger-typing-indicator */ typingMessage(channelId: string, timeout?: number): Promise<void>; /** * Reply to a message * @param {string} channelId the channel id * @param {string} messageId the message id * @param {string} text the desired reply text * @returns the message object that was replied * @example * ```js * jalter.replyMessage("974918359500075041", "974963134144069662", "uh?").then((res) => { console.log("replyMessage", res); }); * ``` * https://discord.com/developers/docs/resources/channel#create-message */ replyMessage(channelId: string, messageId: string, text: string): Promise<object>; /** * Delete a message * @param {string} channelId the channel id * @param {string} messageId the message id * @returns the message object that was deleted or null * @example * ```js * jalter.deleteMessage("974918359500075041", "974963134144069662").then((res) => { console.log("deleteMessage", res); }); * ``` * https://discord.com/developers/docs/resources/channel#get-channel-message */ deleteMessage(channelId: string, messageId: string): Promise<object>; /** * Create a new channel object for the guild * @param {string} guildId the guild id * @param {string} name the desired name * @param {string} type the channel TYPE * @returns the channel object that was created * @example * ```js * jalter.createChannel("974918359500075041", "general", 0).then((res) => { console.log("createChannel", res); }); * ``` * https://discord.com/developers/docs/resources/channel#create-guild-channel */ createChannel(guildId: string, name: string, type: number): Promise<object>; /** * Returns a list of guild channel objects. Does not include threads. * @param {string} guildId the guild id * @returns the list of channels from related guild * @example * ```js * jalter.getChannels("974918359500075041").then((res) => { console.log("getChannels", res); }); * ``` * https://discord.com/developers/docs/resources/guild#get-guild-channels */ getChannels(guildId: string): Promise<object>; /** * For farming stuff, fill the array with your custom message, just dont greedy * @param {number} channelId The destination channel ID * @param {number} interval The interval time per ms * @param {string[]} textList The array of messages * @returns the message object send * @example * send random hey, ho, or let's go * ```js * jalter.sendInterval("974918359500075041", 2000, ["hey", "ho", "let's go"]).then((res) => { console.log("sendInterval", res); }); * ``` * * @example * will send a random hello world in different 72 languages if array is not specified * ```js * jalter.sendInterval("974918359500075041", 2000).then((res) => { console.log("sendInterval", res); }); * ``` * Non standard stuff, there is no external links except [channel#create-message](https://discord.com/developers/docs/resources/channel#create-message) */ sendInterval(channelId: string, interval: number, textList?: string[]): Promise<number>; /** * Send a message on the channel and will stop once the count is reached * @param {string} channelId the channel id * @param {number} interval the interval delay time * @param {string} text the message text * @param {number} count the number of messages to send * @returns the message object send * @example * send a message with a delay of 2 seconds and will stop after reaching 5 messages * ```js * jalter.sendCount("974918359500075041", 2000, "hey", 5).then((res) => { console.log("sendCount", res); }); * ``` * Non standard stuff, there is no external links except [channel#create-message](https://discord.com/developers/docs/resources/channel#create-message) */ sendCount(channelId: string, interval: number, text: string, count: number): Promise<void>; } export = Jalter;