zyno-bot-addons
Version:
Create easily addons for Zyno Bot
1,718 lines (1,469 loc) • 82.3 kB
TypeScript
import ValueSaver from 'valuesaver';
import EventEmitter from 'events';
import { PermissionsBitField, PermissionFlags, EmbedBuilder, ActionRowBuilder as DiscordActionRowBuilder, Attachment } from 'discord.js';
import { Readable } from 'stream';
type addonOptions = {
name: string;
description: string;
author: string;
version: string;
bitfield: [number] | number;
};
type CategoryOption = "General" | "Polls" | "Games" | "Fun" | "Giveaway" | "Music" | "Moderation" | "Economy" | "Level" | "Tickets" | "Bot" | "Admin";
type SaveDataType = Map<any, any> | object | Array<any> | ValueSaver;
type AddonEvents = {
ready: [];
}
type CommandEvents = {
execute: [Command]
}
type MessageContentType = {content: string; embeds: [EmbedBuilder], files: [string], components: [DiscordActionRowBuilder]} | string | EmbedBuilder | ButtonBuilder | SelectMenuBuilder | ActionRowBuilder;
type ChannelType = TextChannel | VoiceChannel | StageChannel | CategoryChannel | DirectoryChannel | ForumChannel | DMChannel | ThreadChannel;
type ChannelStringTypes = 'GuildText' | 'DM' | 'GuildVoice' | 'GroupDM' | 'GuildCategory' | 'GuildAnnouncement' | 'AnnouncementThread' | 'PublicThread' | 'PrivateThread' | 'GuildStageVoice' | 'GuildDirectory' | 'GuildForum';
type ButtonStyleType = 'primary' | 'secondary' | 'success' | 'danger' | 'blurple' | 'gray' | 'grey' | 'red' | 'green' | number;
type ResolvableDate = string | number | Date;
type CreateMessageBasedThreadOptions = {
name: string;
autoArchiveThread: ResolvableDate;
slowMode: ResolvableDate;
reason: string;
};
type CreateInviteOptions = {
maxAge: number;
maxUses: number;
temporary: boolean;
targetUser: string | User;
targetType: 'application' | 'user' | 'EmbeddedApplication' | number;
targetApplication: string; unique?: boolean;
reason: string;
}
type AvatarOptions = {
dynamic: boolean;
size: string;
extension: string;
};
type BannerOptions = AvatarOptions;
type BanOptions = {
deleteMessagesTime: ResolvableDate;
reason: string;
};
type ResolvableMember = Member | string;
type CreateEmojiOptions = {
imageUrl: string;
name: string;
reason: string;
};
type ResolvableEmoji = Emoji | string;
type CreateRoleOptions = {
name: string;
color: string | number;
reason: string;
position: number;
hoist: boolean;
permissions: [permissionFlagsBitsObject];
};
type ResolvableRole = Role | string;
type ResolvableParent = CategoryChannel | string;
type VideoQualityModeType = 'full' | 'auto' | 1 | 2;
type OverwriteType = 'member' | 'user' | 'role';
type PermissionsOverwrite = [{
type: OverwriteType,
id: string;
deny: [permissionFlagsBitsObject],
allow: [permissionFlagsBitsObject]
}];
type CreateChannelOptions = {
name: string;
slowMode: ResolvableDate;
autoArchiveThreads: ResolvableDate;
parent: ResolvableParent;
type: ChannelStringTypes;
topic: string;
nsfw: boolean;
bitrate: number;
userLimit: number;
position: number;
videoQualityMode: VideoQualityModeType;
rtcRegion: string;
reason: string;
permissions: PermissionsOverwrite;
};
type ActivityType = 'competing' | 'listening' | 'watching' | 'playing' | 'streaming';
type StatusType = 'online' | 'dnd' | 'idle' | 'offline';
type AvatarResolvable = string | Buffer;
type permissionsEditOptions = {
AddReactions: boolean;
Administrator: boolean;
AttachFiles: boolean;
BanMembers: boolean;
ChangeNickname: boolean;
Connect: boolean;
CreateInstantInvite: boolean;
CreatePrivateThreads: boolean;
CreatePublicThreads: boolean;
DeafenMembers: boolean;
EmbedLinks: boolean;
KickMembers: boolean;
ManageChannels: boolean;
ManageEmojisAndStickers: boolean;
ManageEvents: boolean;
ManageGuild: boolean;
ManageGuildExpressions: boolean;
ManageMessages: boolean;
ManageNicknames: boolean;
ManageRoles: boolean;
ManageThreads: boolean;
ManageWebhooks: boolean;
MentionEveryone: boolean;
ModerateMembers: boolean;
MoveMembers: boolean;
MuteMembers: boolean;
PrioritySpeaker: boolean;
ReadMessageHistory: boolean;
RequestToSpeak: boolean;
SendMessages: boolean;
SendMessagesInThreads: boolean;
SendTTSMessages: boolean;
SendVoiceMessages: boolean;
Speak: boolean;
Stream: boolean;
UseApplicationCommands: boolean;
UseEmbeddedActivities: boolean;
UseExternalEmojis: boolean;
UseExternalSounds: boolean;
UseExternalStickers: boolean;
UseSoundboard: boolean;
UseVAD: boolean;
ViewAuditLog: boolean;
ViewChannel: boolean;
ViewCreatorMonetizationAnalytics: boolean;
ViewGuildInsights: boolean;
};
type UserResolvable = User | string;
type CommandOptionType = string | number | ChannelType | Role;
type ParentResolvable = CategoryChannel | string;
type ResolvableMemberOrRole = User | Member | Role | string;
type ForumChannelEditOptions = {
name: string;
position: number;
topic: string;
nsfw: boolean;
parent: ParentResolvable;
reason: string;
slowMode: ResolvableDate;
autoArchiveThreads: ResolvableDate;
permissions: PermissionsOverwrite;
};
type TextChannelEditOptions = {
name: string;
position: number;
topic: string;
nsfw: boolean;
parent: ParentResolvable;
reason: string;
slowMode: ResolvableDate;
autoArchiveThreads: ResolvableDate;
permissions: PermissionsOverwrite;
};
type CreateThreadOptions = {
name: string;
slowMode: ResolvableDate;
autoArchiveThreads: ResolvableDate;
reason: string;
};
type ThreadEditOptions = {
name: string;
reason: string;
slowMode: ResolvableDate;
autoArchiveThreads: ResolvableDate;
archived: boolean;
locked: boolean;
};
type VoiceChannelEditOptions = {
name: string;
position: number;
nsfw: boolean;
parent: ParentResolvable;
reason: string;
bitrate: number;
userLimit: number;
slowMode: ResolvableDate;
videoQualityMode: VideoQualityModeType | number;
rtcRegion: string;
permissions: PermissionsOverwrite;
};
type rawTicketInfo = {
channel: string;
claimed: boolean | string;
closed: boolean;
guild: string;
category: boolean | string;
}
type ReactionCollectorEvents = {
end: [];
collect: [Reaction, User];
}
type InteractionCollectorEvents = {
end: [];
collect: [MenuInteraction | ButtonInteraction];
}
type CreateReactionCollectorOptions = {
filter: (reaction: Reaction, user: User) => boolean;
max: number;
time: number;
};
type CreateInteractionCollectorOptions = {
filter: (interaction: MenuInteraction | ButtonInteraction) => boolean;
max: number;
time: number;
};
type BotEvents = {
menuSelect: [MenuInteraction];
buttonClick: [ButtonInteraction];
formSubmit: [FormInteraction];
roleDelete: [Role, BaseEntry];
roleUpdate: [Role, Role, BaseEntry];
roleAdd: [Role, BaseEntry];
channelDelete: [ChannelType, BaseEntry];
channelUpdate: [ChannelType, BaseEntry];
channelAdd: [ChannelType, BaseEntry];
emojiDelete: [Emoji, BaseEntry];
emojiUpdate: [Emoji, Emoji, BaseEntry];
emojiAdd: [Emoji, BaseEntry];
guildDelete: [Guild];
guildNameChange: [Guild, Guild, BaseEntry];
guildDescriptionChange: [Guild, Guild, BaseEntry];
guildOwnerChange: [Guild, Guild, BaseEntry];
guildBoost: [Guild, Guild, BaseEntry];
guildAdd: [Guild];
inviteCreate: [Invite];
inviteDelete: [Invite];
reactionDelete: [Reaction];
reactionAdd: [Reaction];
messageUpdate: [Message, Message];
messageDelete: [Message, User];
message: [Message];
membersPrune: [Save<string, Member>, Guild];
ticketClose: [ChannelType, Buffer, rawTicketInfo];
levelUp: [Member];
memberBan: [BanEntry];
bannerChange: [User, User];
avatarChange: [User, User];
discriminatorChange: [User, User];
usernameChange: [User, User];
roleChange: [Member, Member, BaseEntry];
nicknameChange: [Member, Member, BaseEntry];
memberMuteRemove: [Member, Member, MuteEntry];
memberMuteAdd: [Member, Member, MuteEntry];
memberKick: [KickEntry];
memberLeave: [Member];
memberAdd: [Member];
voiceUpdate: [VoiceState, VoiceState];
};
type WebSocketHandlerEvent = {
connection: [WebSocket, RequestInfo];
};
type WebSocketEvents = {
message: [string];
close: [];
};
declare class HTTPEventListener extends EventEmitter{
on<T>(eventName: T, listener: (request: RequestInfo, response: ResponseInfo) => void);
once<T>(eventName: T, listener: (request: RequestInfo, response: ResponseInfo) => void);
emit<T>(eventName: T, listener: (request: RequestInfo, response: ResponseInfo) => void);
}
declare class RequestInfo{
url: string;
method: string;
headers: object;
query: URLSearchParams;
body: string | null;
ip: string;
}
declare class ResponseInfo{
/**
* Set the status code of the web page
* @param statusCode The status code you want to send to the client
*/
setStatusCode(statusCode: number);
/**
* Send the response headers to the client
* @param headers The response headers
*/
setHeaders(headers: object);
/**
* Send a response to the client
* @param response The response you want to send
*/
send(response: string | Buffer);
/**
* Send a response to the client
* @param response The response you want to send
*/
end(response: string | Buffer);
/**
* Write a response to the client, but doesn't send it yet, it sends the response after calling the `end` or `send` function
* @param chunk The response you want to send
*/
write(chunk: string | Buffer);
/**
* Sends a status to the client
* @param statusCode The status code to send to the client
* @param headers The response headers to send to the client
*/
setStatus(statusCode?: number, headers?: object);
}
declare class HTTPServer{
post: HTTPEventListener;
get: HTTPEventListener;
errorMessages: [];
}
declare class WebSocket extends EventEmitter{
id: string;
/**
* Sends a message to the client
* @param data The message to send to the client
*/
send(data: Buffer | string);
/**
* Closes the connection with the client
*/
close();
on<T extends keyof WebSocketEvents>(eventName: T, listener: (...args: WebSocketEvents[T]) => void);
once<T extends keyof WebSocketEvents>(eventName: T, listener: (...args: WebSocketEvents[T]) => void);
emit<T extends keyof WebSocketEvents>(eventName: T, listener: (...args: WebSocketEvents[T]) => void);
}
declare class WebSocketHandler extends EventEmitter{
sockets: [];
errorMessages: [];
on<T extends keyof WebSocketHandlerEvent>(eventName: T, listener: (...args: WebSocketHandlerEvent[T]) => void);
once<T extends keyof WebSocketHandlerEvent>(eventName: T, listener: (...args: WebSocketHandlerEvent[T]) => void);
emit<T extends keyof WebSocketHandlerEvent>(eventName: T, listener: (...args: WebSocketHandlerEvent[T]) => void);
}
declare class ReactionCollector extends EventEmitter{
on<T extends keyof ReactionCollectorEvents>(eventName: T, listener: (...args: ReactionCollectorEvents[T]) => void);
once<T extends keyof ReactionCollectorEvents>(eventName: T, listener: (...args: ReactionCollectorEvents[T]) => void);
emit<T extends keyof ReactionCollectorEvents>(eventName: T, listener: (...args: ReactionCollectorEvents[T]) => void);
/**
* Stops collecting new reactions
*/
stop() : void;
count: number;
max: number;
filter: Function;
id: string;
time: number;
}
declare class InteractionCollector extends EventEmitter{
on<T extends keyof InteractionCollectorEvents>(eventName: T, listener: (...args: InteractionCollectorEvents[T]) => void);
once<T extends keyof InteractionCollectorEvents>(eventName: T, listener: (...args: InteractionCollectorEvents[T]) => void);
emit<T extends keyof InteractionCollectorEvents>(eventName: T, listener: (...args: InteractionCollectorEvents[T]) => void);
/**
* Stops collecting new reactions
*/
stop() : void;
count: number;
max: number;
filter: Function;
id: string;
time: number;
}
declare class BotEventListener extends EventEmitter{
on<T extends keyof BotEvents>(eventName: T, listener: (...args: BotEvents[T]) => void);
once<T extends keyof BotEvents>(eventName: T, listener: (...args: BotEvents[T]) => void);
emit<T extends keyof BotEvents>(eventName: T, listener: (...args: BotEvents[T]) => void);
}
declare class BotCommandListener extends EventEmitter{
on<T>(eventName: T, listener: (command: Command, next: Function, abort: Function) => void);
once<T>(eventName: T, listener: (command: Command, next: Function, abort: Function) => void);
emit<T>(eventName: T, listener: (command: Command, next: Function, abort: Function) => void);
}
declare class BaseChannel{
id: string;
type: ChannelStringTypes;
created: Date;
createdTimestamp: number;
string: string;
url: string;
/**
* Returns a boolean which defines whether the channel is a text channel or not
*/
isTextChannel() : boolean;
/**
* Returns a boolean which defines whether the channel is a voice channel or not
*/
isVoiceChannel() : boolean;
/**
* Returns a boolean which defines whether the channel is a voice stage channel or not
*/
isVoiceStage() : boolean;
/**
* Returns a boolean which defines whether the channel is a DM channel or not
*/
isDM() : boolean;
/**
* Returns a boolean which defines whether the channel is a thread channel or not
*/
isThread() : boolean;
/**
* Returns a boolean which defines whether the channel is a ticket or not
*/
isTicket() : boolean;
/**
* Returns the owner of the ticket if the channel is a ticket as a Member class
*/
getTicketOwner() : Member | undefined;
/**
* Returns information about the ticket if the channel is a ticket
*/
getTicketInfo() : undefined | {
channelId: string;
claimed?: Member | undefined;
category?: string | undefined;
owner?: Member;
closed: boolean;
};
}
declare class CategoryChannel extends BaseChannel{
viewable: boolean;
name: string;
position: number;
deletable: boolean;
guild: Guild;
guildId: string;
manageable: boolean;
permissions: Save<string, Permissions>;
channels: Save<string, ChannelType>;
/**
* Deletes the category channel
*/
delete() : Promise<void>;
/**
* Changes the name of the category channel
* @param name The new name for the category channel
* @param reason The reason to change the name
*/
setName(name: string, reason?: string) : Promise<CategoryChannel>;
/**
* Changes the order of the categories by changing the position of the category channel
* @param position The new position of the category channel
* @param reason The reason to change the position of the category channel
*/
setPosition(position: number, reason?: string) : Promise<CategoryChannel>;
/**
* Updates the category channel in case there were made changes to it
*/
update() : Promise<CategoryChannel>;
}
declare class GuildChannel extends BaseChannel{
viewable: boolean;
name: string;
guild: Guild;
guildId: string;
manageable: boolean;
position: number;
deletable: boolean;
parent?: CategoryChannel | null | undefined;
parentId?: string | null;
permissionsLocked: boolean;
slowMode: number;
nsfw: boolean;
permissions: Save<string, Permissions>;
/**
* Creates an invite for the specified channel
* @param options Options to customize the invite
*/
createInvite(options: CreateInviteOptions) : Promise<Invite>;
/**
* Marks or unmarks the channel as NSFW
* @param nsfw A boolean which defines whether the channel should be NSFW or not
* @param reason The reason to change the NSFW status
*/
setNSFW(nsfw?: boolean, reason?: string) : Promise<GuildChannel>;
/**
* Deletes the category channel
*/
delete() : Promise<void>;
/**
* Changes the name of the channel
* @param name The new name for the channel
* @param reason The reason to change the name
*/
setName(name: string, reason?: string) : Promise<GuildChannel>;
/**
* Changes the order of the channels by changing the position of the channel
* @param position The new position of the channel
* @param reason The reason to change the position of the channel
*/
setPosition(position: number, reason?: string) : Promise<GuildChannel>;
/**
* Change the parent of the channel
* @param parent The new parent of the channel
* @param reason The reason to change the parent of the channel
*/
setParent(parent: ParentResolvable, reason?: string) : Promise<GuildChannel>;
/**
* Synchronize the permissions of the category channel with the current channel
*/
lockPermissions() : Promise<GuildChannel>;
/**
* Get the permissions for a member or a role in this channel
* @param resolvableMemberOrRole The member or role to get the permissions of
*/
permissionsFor(resolvableMemberOrRole: ResolvableMemberOrRole) : PermissionsBitField;
/**
* Sets a slow mode for this channel
* @param dateResolvable The slow mode for the channel in miliseconds
* @param reason The reason to change the slow mode for this channel
*/
setSlowMode(dateResolvable: ResolvableDate, reason?: string) : Promise<GuildChannel>;
}
declare class ForumChannel extends GuildChannel{
topic: string;
autoArchiveThreads: number;
threads: Save<string, ThreadChannel>;
/**
* Changes the topic of the forum channel
* @param topic The new topic for the forum channel
* @param reason The reason to change the topic
*/
setTopic(topic: string, reason?: string) : Promise<ForumChannel>;
/**
* Updates the forum channel in case changes have been made to it
*/
update() : Promise<ForumChannel>;
/**
* Change the settings of the forum channel
* @param options The settings which should be changed for the channel
*/
edit(options: ForumChannelEditOptions) : Promise<ForumChannel>;
/**
* Creates a new thread channel
* @param options The settings for the thread channel
*/
createThread(options: CreateThreadOptions) : Promise<ThreadChannel>;
}
declare class TextChannel extends GuildChannel{
topic: string;
autoArchiveThreads: number;
threads: Save<string, ThreadChannel>;
messages: Save<string, Message>;
/**
* Changes the topic of the text channel
* @param topic The new topic for the text channel
* @param reason The reason to change the topic
*/
setTopic(topic: string, reason?: string) : Promise<TextChannel>;
/**
* Sends a message in this channel
* @param content The content of the message to send
*/
send(...content: [MessageContentType]) : Promise<Message>;
/**
* Updates the text channel in case changes have been made to it
*/
update() : Promise<TextChannel>;
/**
* Get a message which was sent in this channel
* @param messageId The id of the message to get
*/
getMessage(messageId: string) : Promise<Message>;
/**
* Delete an amount of messages in this channel
* @param amount The amount of messages to delete, max 100 messages per time
* @param filter A function to filter the messages you'd like to delete from the cache
*/
deleteMessages(amount: number, filter: ({key, value} : {key: string; value: Message;}) => boolean) : Promise<void>;
/**
* Change the settings of the text channel
* @param options The settings which should be changed for the channel
*/
edit(options: TextChannelEditOptions) : Promise<TextChannel>;
/**
* Creates a new thread channe;
* @param options The settings for the thread channel
*/
createThread(options: CreateThreadOptions) : Promise<ThreadChannel>;
}
declare class ThreadChannel extends BaseChannel{
guild: Guild;
guildId: string;
name: string;
threadArchived: boolean;
archived?: Date | null;
archivedTimestamp?: number | null;
autoArchive?: number | null;
memberCount: number;
threadJoined: boolean;
threadJoinable: boolean;
editable: boolean;
locked: boolean;
sendable: boolean;
viewable: boolean;
manageable: boolean;
slowMode: number;
parentId?: string | null;
parent?: CategoryChannel | null | undefined;
messages: Save<string, Message>;
members: Save<string, Member>;
owner: Member;
/**
* Returns a boolean which defines whether the channel is archived or not
*/
isArchived() : boolean;
/**
* Deletes the thread channel
*/
delete() : Promise<void>;
/**
* Changes the name of the thread channel
* @param name The new name for the thread channel
* @param reason The reason to change the name
*/
setName(name: string, reason?: string) : Promise<ThreadChannel>;
/**
* Sends a message in this channel
* @param content The content of the message to send
*/
send(...content: [MessageContentType]) : Promise<Message>;
/**
* Updates the thread channel in case changes have been made to it
*/
update() : Promise<ThreadChannel>;
/**
* Get a message which was sent in this channel
* @param messageId The id of the message to get
*/
getMessage(messageId: string) : Promise<Message>;
/**
* Delete an amount of messages in this channel
* @param amount The amount of messages to delete, max 100 messages per time
* @param filter A function to filter the messages you'd like to delete from the cache
*/
deleteMessages(amount: number, filter: ({key, value} : {key: string; value: Message;}) => boolean) : Promise<void>;
/**
* Joins the thread channel if the bot isn't a participant already
*/
join() : Promise<ThreadChannel>;
/**
* Leaves the thread channel if the bot is a participant
*/
leave() : Promise<ThreadChannel>;
/**
* Pins the thread channel at the top of a forum channel (not possible for text channels)
* @param reason The reason to pin the thread channel
*/
pin(reason?: string) : Promise<ThreadChannel>;
/**
* Unpins the thread channel from the forum channel (not possible for text channels)
* @param reason The reason to unpin the thread channel
*/
unpin(reason?: string) : Promise<ThreadChannel>;
/**
* Sends a message to the thread channel
* @param content The content of the message
*/
send(...content: [MessageContentType]) : Promise<Message>;
/**
* Archives or unarchives the thread channel
* @param archived A boolean which defines whether the thread channel should be archived or not
* @param reason The reason to archive or unarchive the thread channel
*/
setArchived(archived?: boolean, reason?: string) : Promise<ThreadChannel>;
/**
* Changes the auto archive duration of the thread channel after no activity
* @param dateResolvable How long it should take before the channel should be archived automatically
* @param reason The reason to change the duration of the auto archivement
*/
setAutoArchive(dateResolvable: ResolvableDate, reason?: string) : Promise<ThreadChannel>;
/**
* Change the lock status of the thread channel
* @param locked A boolean which defines whether the thread channel should be locked or not
* @param reason The reason to lock or unlock the thread channel
*/
setLocked(locked?: boolean, reason?: string) : Promise<ThreadChannel>;
/**
* Sets a slow mode for this channel
* @param dateResolvable The slow mode for the channel in miliseconds
* @param reason The reason to change the slow mode for this channel
*/
setSlowMode(dateResolvable: ResolvableDate, reason?: string) : Promise<GuildChannel>;
/**
* Changes the settings of the thread channel
* @param options The settings you'd like to change in the thread channel
*/
edit(options: ThreadEditOptions) : Promise<ThreadChannel>;
}
declare class StageChannel extends GuildChannel{
joinable: boolean;
full: boolean;
rtcRegion: string;
bitrate: number;
userLimit: number;
videoQualityMode: VideoQualityModeType;
messages: Save<string, Message>;
members: Save<string, Member>;
/**
* Sends a message to the stage channel
* @param content The content of the message
*/
send(...content: [MessageContentType]) : Promise<Message>;
/**
* Updates the stage channel in case there were made changes to it
*/
update() : Promise<StageChannel>;
/**
* Delete an amount of messages in this channel
* @param amount The amount of messages to delete, max 100 messages per time
* @param filter A function to filter the messages you'd like to delete from the cache
*/
deleteMessages(amount: number, filter: ({key, value} : {key: string; value: Message;}) => boolean) : Promise<void>;
/**
* Changes the settings of the stage channel
* @param options The settings you'd like to change
*/
edit(options: VoiceChannelEditOptions) : Promise<StageChannel>;
/**
* Changes the stage channel region
* @param region The region you'd like to set the stage channel to
* @param reason The reason to change the stage channel region
*/
setRtcRegion(region: string, reason?: string) : Promise<StageChannel>;
/**
* Sets a limit on the amount of members which are allowed to join the stage channel
* @param limit The amount of members which are allowed to join (min 0, max 99)
* @param reason The reason to change the user limit
*/
setUserLimit(limit: number, reason?: string) : Promise<StageChannel>;
/**
* Changes the default video quality mode
* @param qualityMode The video quality mode you'd like to set
* @param reason The reason to change the video quality mode
*/
setVideoQuality(qualityMode: VideoQualityModeType, reason?: string) : Promise<StageChannel>;
/**
* Changes the bitrate of the stage channel and can improve or worsen the audio quality
* @param bitrate The bitrate you'd like to set
* @param reason The reason to change the bitrate
*/
setBitrate(bitrate: number, reason?: string) : Promise<StageChannel>;
}
declare class VoiceChannel extends GuildChannel{
joinable: boolean;
speakable: boolean;
full: boolean;
rtcRegion: string;
bitrate: number;
userLimit: number;
videoQuality: string;
members: Save<string, Member>;
messages: Save<string, Message>;
/**
* Sends a message to the voice channel
* @param content The content of the message
*/
send(...content: [MessageContentType]) : Promise<Message>;
/**
* Updates the voice channel in case there were made changes to it
*/
update() : Promise<VoiceChannel>;
/**
* Delete an amount of messages in this channel
* @param amount The amount of messages to delete, max 100 messages per time
* @param filter A function to filter the messages you'd like to delete from the cache
*/
deleteMessages(amount: number, filter: ({key, value} : {key: string; value: Message;}) => boolean) : Promise<void>;
/**
* Changes the settings of the voice channel
* @param options The settings you'd like to change
*/
edit(options: VoiceChannelEditOptions) : Promise<VoiceChannel>;
/**
* Changes the voice channel region
* @param region The region you'd like to set the voice channel to
* @param reason The reason to change the voice channel region
*/
setRtcRegion(region: string, reason?: string) : Promise<VoiceChannel>;
/**
* Sets a limit on the amount of members which are allowed to join the voice channel
* @param limit The amount of members which are allowed to join (min 0, max 99)
* @param reason The reason to change the user limit
*/
setUserLimit(limit: number, reason?: string) : Promise<VoiceChannel>;
/**
* Changes the default video quality mode
* @param qualityMode The video quality mode you'd like to set
* @param reason The reason to change the video quality mode
*/
setVideoQuality(qualityMode: VideoQualityModeType, reason?: string) : Promise<VoiceChannel>;
/**
* Changes the bitrate of the voice channel and can improve or worsen the audio quality
* @param bitrate The bitrate you'd like to set
* @param reason The reason to change the bitrate
*/
setBitrate(bitrate: number, reason?: string) : Promise<VoiceChannel>;
/**
* Plays a song in the voice channel
* @param stream The stream to play (YouTube url, stream url or instance of Readable stream)
*/
playSong(stream: string | Readable) : Promise<void>;
/**
* Disconnects from the voice channel if the bot is connected to it
*/
disconnect() : Promise<void>;
/**
* Gets the queue in the voice channel
*/
getQueue() : Promise<[{
title: string | null,
url: string | Readable
}]>;
/**
* Skips the song which is currently playing in the voice channel
*/
skipSong() : Promise<void>;
/**
* Pauses the song which is currently playing
*/
pauseSong() : Promise<void>;
/**
* Resumes the song which was paused
*/
resumeSong() : Promise<void>;
/**
* Shuffles the queue of the voice channel
*/
shuffle() : Promise<void>;
/**
* Loops the song which is currently being played
*/
setLoop() : Promise<void>;
/**
* Disables the loop if it was enabled;
*/
setUnloop() : Promise<void>;
/**
* Loops the whole queue
*/
setQueueloop() : Promise<void>;
/**
* Changes the volume of the song which is being played
* @param volume A number which defines the volume between 1 and 10
*/
setVolume(volume: number) : Promise<void>;
}
declare class DirectoryChannel extends BaseChannel{
guild: Guild;
guildId: string;
name: string;
/**
* Deletes the directory channel
*/
delete() : Promise<void>;
/**
* Updates the directory channel in case there were made changes to it
*/
update() : Promise<DirectoryChannel>;
}
declare class DMChannel extends BaseChannel{
id: string;
user: string;
/**
* Sends a DM to the user of the DM channel
* @param content The content of the message to send
*/
send(...content: [MessageContentType]) : Promise<Message>;
/**
* Updates the directory channel in case there were made changes to it
*/
update() : Promise<DirectoryChannel>;
}
declare class BanEntry{
executor: User;
user: User;
banned: Date;
bannedTimestamp: number;
reason: string;
guild: Guild;
}
declare class BaseEntry{
executor: String;
user?: User;
reason: string;
changed: Date;
changedTimestamp: number;
guild: Guild;
}
declare class KickEntry{
executor: User;
user: User;
kicked: Date;
kickedTimestamp: number;
reason: string;
guild: Guild;
}
declare class MuteEntry{
executor: User;
user: User;
reason: string;
muted: Date;
mutedTimestamp: number;
guild: Guild;
}
declare class MenuInteraction{
type: "Menu";
guild: Guild;
guildId: string;
channel: ChannelType;
channelId: string;
member: Member;
memberId: string;
user: User;
message: Message;
messageId: string;
customId: string;
id: string;
values: [string];
/**
* Returns a boolean which defines whether the interaction is a button interaction or not
*/
isButton() : false;
/**
* Returns a boolean which defines whether the interaction is a menu interaction or not
*/
isMenu() : true;
/**
* Returns a boolean which defines whether the interaction is a form interaction or not
*/
isForm() : false;
/**
* Tells the API that an update has been made as a result of the menu interaction
*/
deferUpdate() : Promise<void>;
/**
* Change the status of the interaction to 'Bot is thinking' and send a reply later
*/
deferReply() : Promise<void>;
/**
* Deletes a reply if a reply was sent
*/
deleteReply() : Promise<void>;
/**
* Replies or edits the reply to the menu interaction with a message
* @param content The content of the message to send
*/
reply(...content: [MessageContentType]) : Promise<Message>;
/**
* Replies later to the menu interaction with a normal message
* @param content The content of the message to send
*/
followUp(...content: [MessageContentType]) : Promise<Message>;
/**
* Updates the original reply of the menu interaction
* @param content The content of the new message
*/
update(...content: [MessageContentType]) : Promise<Message>;
/**
* Shows a form to the member
* @param form The form the member who selected a value from the menu should see
*/
sendForm(form: FormBuilder) : Promise<void>;
/**
* Executes a command based on the current interaction
* @param commandName The name of the command you'd like to execute
* @param args The arguments you'd like to pass to the command
*/
executeCommand(commandName: string, args?: [any]) : void;
}
declare class ButtonInteraction{
type: "Button";
guild: Guild;
guildId: string;
channel: ChannelType;
channelId: string;
member: Member;
memberId: string;
user: User;
message: Message;
messageId: string;
customId: string;
id: string;
/**
* Returns a boolean which defines whether the interaction is a button interaction or not
*/
isButton() : true;
/**
* Returns a boolean which defines whether the interaction is a menu interaction or not
*/
isMenu() : false;
/**
* Returns a boolean which defines whether the interaction is a form interaction or not
*/
isForm() : false;
/**
* Tells the API that an update has been made as a result of the button interaction
*/
deferUpdate() : Promise<void>;
/**
* Change the status of the interaction to 'Bot is thinking' and send a reply later
*/
deferReply() : Promise<void>;
/**
* Deletes a reply if a reply was sent
*/
deleteReply() : Promise<void>;
/**
* Replies to the button interaction with a message
* @param content The content of the message to send
*/
reply(...content: [MessageContentType]) : Promise<Message>;
/**
* Replies later to the button interaction with a normal message
* @param content The content of the message to send
*/
followUp(...content: [MessageContentType]) : Promise<Message>;
/**
* Updates the original reply of the button interaction
* @param content The content of the new message
*/
update(...content: [MessageContentType]) : Promise<Message>;
/**
* Shows a form to the member
* @param form The form the member who pressed the button should see
*/
sendForm(form: FormBuilder) : Promise<void>;
/**
* Executes a command based on the current interaction
* @param commandName The name of the command you'd like to execute
* @param args The arguments you'd like to pass to the command
*/
executeCommand(commandName: string, args?: [any]) : void;
}
declare class FormInteraction{
type: "Form";
guild: Guild;
guildId: string;
channel: ChannelType;
channelId: string;
member: Member;
memberId: string;
user: User;
message: Message;
messageId: string;
customId: string;
id: string;
inputs: [string];
/**
* Returns a boolean which defines whether the interaction is a button interaction or not
*/
isButton() : false;
/**
* Returns a boolean which defines whether the interaction is a menu interaction or not
*/
isMenu() : false;
/**
* Returns a boolean which defines whether the interaction is a form interaction or not
*/
isForm() : true;
/**
* Get an input value provided by the member
* @param customId The custom id of the input
*/
getInput(customId: string) : string;
/**
* Tells the API that an update has been made as a result of the button interaction
*/
deferUpdate() : Promise<void>;
/**
* Change the status of the interaction to 'Bot is thinking' and send a reply later
*/
deferReply() : Promise<void>;
/**
* Deletes a reply if a reply was sent
*/
deleteReply() : Promise<void>;
/**
* Replies to the button interaction with a message
* @param content The content of the message to send
*/
reply(...content: [MessageContentType]) : Promise<Message>;
/**
* Replies later to the button interaction with a normal message
* @param content The content of the message to send
*/
followUp(...content: [MessageContentType]) : Promise<Message>;
/**
* Updates the original reply of the button interaction
* @param content The content of the new message
*/
update(...content: [MessageContentType]) : Promise<Message>;
/**
* Executes a command based on the current interaction
* @param commandName The name of the command you'd like to execute
* @param args The arguments you'd like to pass to the command
*/
executeCommand(commandName: string, args?: [any]) : void;
}
declare class Level{
xp: number;
level: number;
messages: number;
/**
* Change the member's XP amount
* @param amount The new XP amount for the member
*/
setXP(amount: number) : Promise<Level>;
/**
* Change the member's level in the level system
* @param level The new level for the member
*/
setLevel(level: number) : Promise<Level>;
}
declare class EconomyBalance{
bank: number;
cash: number;
/**
* Change the bank value of the member's economy balance
* @param amount The new bank value
*/
setBank(amount: number) : Promise<EconomyBalance>;
/**
* Change the cash value of the member's economy balance
* @param amount The new cash value
*/
setCash(amount: number) : Promise<EconomyBalance>;
}
declare class VoiceState{
member: Member | null | undefined;
id: string | null;
connected: boolean;
selfMute: boolean;
selfDeaf: boolean;
selfVideo: boolean;
streaming: boolean;
serverMute: boolean;
serverDeaf: boolean;
mute: boolean;
deaf: boolean;
channelId: string | null;
guild: Guild;
guildId: string | undefined;
channel: ChannelType;
/**
* Disconnect the member from the voice channel if the member is in a voice channel
* @param reason The reason to disconnect the member
*/
disconnect(reason?: string) : Promise<void>;
/**
* Server-deaf a member
* @param deaf A boolean which defines whether the member should be deafed or not
* @param reason The reason to deaf or undeaf the member
*/
setDeaf(deaf?: boolean, reason?: string) : Promise<void>;
/**
* Server-mute a member
* @param mute A boolean which defines whether the member should be muted or not
* @param reason The reason to mute or unmute the user
*/
setMute(mute?: boolean, reason?: string) : Promise<void>;
/**
* Change the voice channel of the member
* @param channel The channel where you'd like to put the member in
* @param reason The reason why you want to change the voice channel
*/
setChannel(channel: string | VoiceChannel | StageChannel, reason?: string) : Promise<void>;
}
declare class Reaction{
message: Message;
guild: Guild;
id: string;
members: Save<string, Member>;
emoji: {
name: string;
id: string | null;
animated: boolean | null;
string: string;
};
user: User;
/**
* A boolean which defines whether the emoji is a custom emoji or a normal emoji
*/
isCustomEmoji() : boolean;
/**
* Removes the reaction of a user who has reacted with the same emoji
* @param user The user whose reaction should be removed
*/
removeReaction(user?: UserResolvable) : Promise<Reaction>;
}
declare class Permissions{
channel: ChannelType;
id: string;
type: 'Member' | 'Role';
allow: PermissionsBitField;
deny: PermissionsBitField;
/**
* Deletes the permissions for the member or role in the channel
*/
delete() : Promise<void>;
/**
* Updates the permissions for the member or role in the channel
* @param options The permissions which should be changed for the member or role
* @param reason The reason to change the permissions
*/
edit(options: permissionsEditOptions, reason?: string) : Promise<Permissions>;
}
declare class Mentions{
everyone: boolean;
members: Save<string, Member>;
roles: Save<string, Role>;
channels: Save<string, ChannelType>;
}
declare class Emoji{
animated: boolean;
guild: Guild;
creator: User | null | undefined;
created: Date;
createdTimestamp: number;
id: string;
name: string;
string: string;
/**
* Provides the url of the image of the emoji
*/
getURL() : string;
/**
* Changes the name of the current emoji
* @param name The new name for the emoji
* @param reason The reason to change the name of the emoji
*/
setName(name: string, reason?: string) : Promise<Emoji>;
/**
* Deletes the emoji from the guild
* @param reason The reason to delete the emoji
*/
delete(reason?: string) : Promise<void>;
/**
* Updates the creator of the emoji in case the creator is not defined or has updated in the mean time
*/
updateCreator() : Promise<Emoji>;
}
declare class Role{
id: string;
string: string;
color: {
hex: string;
base: number;
};
hoist: boolean;
position: number;
name: string;
created: Date;
createdTimestamp: number;
editable: boolean;
guild: Guild;
guildId: string;
permissions: PermissionsBitField;
mentionable: boolean;
/**
* Changes the name of the role
* @param name The new name for the role
* @param reason The reason to change the name of the role
*/
setName(name: string, reason?: string) : Promise<Role>;
/**
* Add or remove the hoist from the role
* @param hoist A boolean which defines whether to enable or disable the hoist
* @param reason The reason to change the hoist
*/
setHoist(hoist?: boolean, reason?: string) : Promise<Role>;
/**
* Changes the color of the role
* @param color The new color for the role
* @param reason The reason to change the color
*/
setColor(color: string | number, reason?: string) : Promise<Role>;
/**
* Changes the order of the roles by changing the position of the current role
* @param position The position to put the current role in
* @param reason The reason to change the role's position
*/
setPosition(position: number, reason?: string) : Promise<Role>;
/**
* Change whether the role can be mentioned or not
* @param mentionable A boolean which defines whether the role can be mentioned or not
* @param reason The reason to change the role's mentionability
*/
setMentionable(mentionable?: boolean, reason?: string) : Promise<Role>;
/**
* Change the permissions a user has with this role
* @param permissions An array with permissions users with this role should have
* @param reason The reason to change the permissions
*/
setPermissions(permissions: [permissionFlagsBitsObject], reason?: string) : Promise<Role>;
/**
* Deletes the role from the guild
* @param reason The reason to delete the role
*/
delete(reason?: string) : Promise<void>;
}
declare class Bot{
username: string;
avatarURL: string;
tag: string;
id: string;
created: Date;
createdTimestamp: number;
/**
* Set the activity for the bot
* @param activity The activity you'd like to give the bot
*/
setActivity(activity: string) : Promise<void>;
/**
* Set the activity type of the activity
* @param activityType The activity type you'd like to set
*/
setActivityType(activityType: ActivityType) : Promise<void>;
/**
* Sets the streaming url for the activity, only if the activity type is set to 'streaming'
* @param streamURL The url of a stream, only Twitch and YouTube url's are allowed
*/
setStreamingURL(streamURL: string) : Promise<void>;
/**
* Set the type of the bot's status
* @param statusType The stauts of the bot
*/
setStatusType(statusType: StatusType) : Promise<void>;
/**
* Changes the username of the bot
* @param username The new username to set for the bot
*/
setUsername(username: string) : Promise<void>;
/**
* Changes the avatar of the bot
* @param avatar The new avatar for the bot
*/
setAvatar(avatar: AvatarResolvable) : Promise<void>;
}
declare class Invite{
url: string;
code: string;
inviter: Member;
inviterId: string;
expires: Date | null;
expireTimestamp: number | null;
created: Date;
createdTimestamp: number;
deletable: boolean;
channel: ChannelType;
channelId: string;
guild: Guild;
uses: number;
/**
* Defines whether the invite can be deleted or not
*/
isDeletable() : boolean;
/**
* Deletes the invite
* @param reason The reason to delete the invite
*/
delete(reason?: string) : Promise<void>;
}
declare class Guild{
addon: Addon;
id: string;
name: string;
channels: Save<string, ChannelType>;
iconURL: string;
description: string;
owner: Member;
ownerId: string;
verified: boolean;
verificationLevel: number;
boosts: number;
emojis: Save<string, Emoji>;
roles: Save<string, Role>;
everyoneRole: Role;
memberCount: number;
botAdded: Date;
botAddedTimestamp: number;
created: Date;
createdTimestamp: number;
voiceStates: Save<string, VoiceState>;
members: Save<string, Member>;
moderationRoles: Save<string, Role>;
ticketRoles: Save<string, Role>;
joinRoles: Save<string, Role>;
invites: Save<string, Invite>;
/**
* Change the name of the guild
* @param name The new name of the guild
*/
setName(name: string) : Promise<Guild>;
/**
* Change the icon of the guild
* @param iconUrl The url of the new icon
* @param reason The reason to change the icon
*/
setIcon(iconUrl: string, reason?: string) : Promise<Guild>;
/**
* Change the banner of the guild
* @param bannerUrl The url of the new banner
* @param reason The reason to change the banner
*/
setBanner(bannerUrl: string, reason?: string) : Promise<Guild>;
/**
* Unban a user from the guild
* @param userId The id of the user you want to unban
* @param reason The reason to unban the user
*/
unban(userId: string, reason?: string) : Promise<Guild>;
/**
* Ban a user from the guild
* @param resolvableMember The member you want to ban
*/
ban(resolvableMember: ResolvableMember) : Promise<Guild>;
/**
* Creates a new emoji in the guild
* @param options Options for the emoji to create
*/
createEmoji(options: CreateEmojiOptions) : Promise<Emoji>;
/**
* Deletes an emoji from the guild
* @param resolvableEmoji The emoji you want to delete
* @param reason The reason to delete the emoji
*/
deleteEmoji(resolvableEmoji: ResolvableEmoji, reason?: string) : Promise<Emoji>;
/**
* Creates a new role in the guild
* @param options Options for the role to create
*/
createRole(options: CreateRoleOptions) : Promise<Role>;
/**
* Deletes a role from the guild
* @param resolvableRole The role you want to delete
* @param reason The reason to delete the role
*/
deleteRole(resolvableRole: ResolvableRole, reason?: string) : Promise<void>;
/**
* Creates a new channel in the guild
* @param options Options for the channel to create
*/
createChannel(options: CreateChannelOptions) : Promise<ChannelType>;
}
declare class User{
id: string;
string: string;
username: string;
tag: string;
discriminator: string;
created: Date;
createdTimestamp: number;
bot: boolean;
system: boolean;
addon: Addon;
bitfield: number;
/**
* Get the user's avatar url
* @param options Options for the avatar url
*/
avatarUR