mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 01:10:07 +00:00
types: remove entire types (#684)
This commit is contained in:
@@ -6,15 +6,6 @@ import { editChannel } from "../helpers/channels/edit_channel.ts";
|
||||
import { editChannelOverwrite } from "../helpers/channels/edit_channel_overwrite.ts";
|
||||
import { sendMessage } from "../helpers/messages/send_message.ts";
|
||||
import { disconnectMember } from "../helpers/mod.ts";
|
||||
import {
|
||||
ChannelCreatePayload,
|
||||
ChannelEditOptions,
|
||||
ChannelType,
|
||||
MessageContent,
|
||||
Overwrite,
|
||||
Permission,
|
||||
RawOverwrite,
|
||||
} from "../types/mod.ts";
|
||||
import { Collection } from "../util/collection.ts";
|
||||
import { createNewProp } from "../util/utils.ts";
|
||||
import { CleanVoiceState, Guild } from "./guild.ts";
|
||||
@@ -111,91 +102,3 @@ export async function createChannelStruct(
|
||||
|
||||
return channel as Channel;
|
||||
}
|
||||
|
||||
export interface Channel {
|
||||
/** The id of this channel */
|
||||
id: string;
|
||||
/** Sorting position of the channel */
|
||||
position?: number;
|
||||
/** The name of the channel (2-100 characters) */
|
||||
name?: string;
|
||||
/** The channel topic (0-1024 characters) */
|
||||
topic?: string;
|
||||
/** The bitrate (in bits) of the voice channel */
|
||||
bitrate?: number;
|
||||
/** The type of the channel */
|
||||
type: ChannelType;
|
||||
/** The guild id of the channel if it is a guild channel. */
|
||||
guildID: string;
|
||||
/** The id of the last message sent in this channel */
|
||||
lastMessageID?: string;
|
||||
/** The amount of users allowed in this voice channel. */
|
||||
userLimit?: number;
|
||||
/** The rate limit (slowmode) in this text channel that users can send messages. */
|
||||
rateLimitPerUser?: number;
|
||||
/** The category id for this channel */
|
||||
parentID?: string;
|
||||
/** The last time when a message was pinned in this channel */
|
||||
lastPinTimestamp?: number;
|
||||
/** The permission overwrites for this channel */
|
||||
permissionOverwrites: RawOverwrite[];
|
||||
/** Whether this channel is nsfw or not */
|
||||
nsfw: boolean;
|
||||
|
||||
// GETTERS
|
||||
|
||||
/**
|
||||
* Gets the guild object for this channel.
|
||||
*
|
||||
* ⚠️ ADVANCED: If you use the custom cache, these will not work for you. Getters can not be async and custom cache requires async.
|
||||
*/
|
||||
guild?: Guild;
|
||||
/**
|
||||
* Gets the messages from cache that were sent in this channel
|
||||
*
|
||||
* ⚠️ ADVANCED: If you use the custom cache, these will not work for you. Getters can not be async and custom cache requires async.
|
||||
*/
|
||||
messages: Collection<string, Message>;
|
||||
/** The mention of the channel */
|
||||
mention: string;
|
||||
/**
|
||||
* Gets the voice states for this channel
|
||||
*
|
||||
* ⚠️ ADVANCED: If you use the custom cache, these will not work for you. Getters can not be async and custom cache requires async.
|
||||
*/
|
||||
voiceStates?: Collection<string, CleanVoiceState>;
|
||||
/**
|
||||
* Gets the connected members for this channel undefined if member is not cached
|
||||
*
|
||||
* ⚠️ ADVANCED: If you use the custom cache, these will not work for you. Getters can not be async and custom cache requires async.
|
||||
*/
|
||||
connectedMembers?: Collection<string, Member | undefined>;
|
||||
|
||||
// METHODS
|
||||
|
||||
/** Send a message to the channel. Requires SEND_MESSAGES permission. */
|
||||
send(content: string | MessageContent): ReturnType<typeof sendMessage>;
|
||||
/** Disconnect a member from a voice channel. Requires MOVE_MEMBERS permission. */
|
||||
disconnect(memberID: string): ReturnType<typeof disconnectMember>;
|
||||
/** Delete the channel */
|
||||
delete(): ReturnType<typeof deleteChannel>;
|
||||
/** Edit a channel Overwrite */
|
||||
editOverwrite(
|
||||
overwriteID: string,
|
||||
options: Omit<Overwrite, "id">,
|
||||
): ReturnType<typeof editChannelOverwrite>;
|
||||
/** Delete a channel Overwrite */
|
||||
deleteOverwrite(
|
||||
overwriteID: string,
|
||||
): ReturnType<typeof deleteChannelOverwrite>;
|
||||
/** Checks if a channel overwrite for a user id or a role id has permission in this channel */
|
||||
hasPermission(
|
||||
overwrites: RawOverwrite[],
|
||||
permissions: Permission[],
|
||||
): ReturnType<typeof channelOverwriteHasPermission>;
|
||||
/** Edit the channel */
|
||||
edit(
|
||||
options: ChannelEditOptions,
|
||||
reason?: string,
|
||||
): ReturnType<typeof editChannel>;
|
||||
}
|
||||
|
||||
@@ -11,20 +11,6 @@ import { leaveGuild } from "../helpers/guilds/leave_guild.ts";
|
||||
import { getInvites } from "../helpers/invites/get_invites.ts";
|
||||
import { banMember } from "../helpers/members/ban_member.ts";
|
||||
import { unbanMember } from "../helpers/members/unban_member.ts";
|
||||
import {
|
||||
BanOptions,
|
||||
CreateGuildPayload,
|
||||
Emoji,
|
||||
GetAuditLogsOptions,
|
||||
GuildEditOptions,
|
||||
GuildFeatures,
|
||||
GuildMember,
|
||||
ImageFormats,
|
||||
ImageSize,
|
||||
MemberCreatePayload,
|
||||
Presence,
|
||||
VoiceState,
|
||||
} from "../types/mod.ts";
|
||||
import { Collection } from "../util/collection.ts";
|
||||
import { createNewProp } from "../util/utils.ts";
|
||||
import { Member } from "./member.ts";
|
||||
@@ -217,154 +203,3 @@ export async function createGuildStruct(
|
||||
|
||||
return guild as Guild;
|
||||
}
|
||||
|
||||
export interface Guild {
|
||||
/** The guild id */
|
||||
id: string;
|
||||
/** The guild name 2-100 characters */
|
||||
name: string;
|
||||
/** The guild icon image hash */
|
||||
icon: string | null;
|
||||
/** The guild splash image hash */
|
||||
splash: string | null;
|
||||
/** Discovery splash has; only present for guilds with the "DISCOVERABLE" feature */
|
||||
disoverySplash: string | null;
|
||||
/** The voice region id for the guild */
|
||||
region: string;
|
||||
/** Default message notifications level */
|
||||
defaultMessageNotifications: number;
|
||||
/** Explicit content filter level */
|
||||
explicitContentFilter: number;
|
||||
/** The custom guild emojis */
|
||||
emojis: Collection<string, Emoji>;
|
||||
/** Enabled guild features */
|
||||
features: GuildFeatures[];
|
||||
/** System channel flags */
|
||||
systemChannelFlags: number;
|
||||
/** The id of the channel where guilds with the PUBLIC feature can display rules and or guidelines. */
|
||||
rulesChannelID: string | null;
|
||||
/** The description for the guild */
|
||||
description: string | null;
|
||||
/** The banner hash */
|
||||
banner: string | null;
|
||||
/** The id of the channel where admins and moderators of guilds with the PUBLIC feature receive notices from Discord */
|
||||
publicUpdatesChannelID: string | null;
|
||||
/** The maximum amount of users in a video channel. */
|
||||
maxVideoChannelUsers?: number;
|
||||
/** The approximate number of members in this guild, returned from the GET /guild/id endpoint when with_counts is true */
|
||||
approximateMemberCount?: number;
|
||||
/** The approximate number of non-offline members in this guild, returned from the GET /guild/id endpoint when with_counts is true */
|
||||
approximatePresenceCount?: number;
|
||||
/** Whether this is considered a large guild */
|
||||
large: boolean;
|
||||
/** Whether this guild is unavailable */
|
||||
unavailable: boolean;
|
||||
/** The shard id that this guild is on */
|
||||
shardID: number;
|
||||
/** The owner id of the guild. */
|
||||
ownerID: string;
|
||||
/** The afk channel id for this guild. */
|
||||
afkChannelID: string;
|
||||
/** The amount of time before a user is moved to AFK. */
|
||||
afkTimeout: number;
|
||||
/** Whether or not the embed is enabled in this server. */
|
||||
widgetEnabled: boolean;
|
||||
/** The channel id for the guild embed in this server. */
|
||||
widgetChannelID: string;
|
||||
/** The verification level for this server. */
|
||||
verificationLevel: number;
|
||||
/** The MFA level for this server. */
|
||||
mfaLevel: number;
|
||||
/** The system channel id for this server. */
|
||||
systemChannelID: string;
|
||||
/** The max presences for this server. */
|
||||
maxPresences: number;
|
||||
/** The maximum members in this server. */
|
||||
maxMembers: number;
|
||||
/** The vanity URL code for this server. */
|
||||
vanityURLCode: string;
|
||||
/** The premium tier for this server. */
|
||||
premiumTier: number;
|
||||
/** The subscription count for this server. */
|
||||
premiumSubscriptionCount: number;
|
||||
/** The preferred language in this server. */
|
||||
preferredLocale: string;
|
||||
/** The roles in the guild */
|
||||
roles: Collection<string, Role>;
|
||||
/** When this guild was joined at. */
|
||||
joinedAt: number;
|
||||
/** The presences of all the users in the guild. */
|
||||
presences: Collection<string, Presence>;
|
||||
/** The total number of members in this guild. This value is updated as members leave and join the server. However, if you do not have the intent enabled to be able to listen to these events, then this will not be accurate. */
|
||||
memberCount: number;
|
||||
/** The Voice State data for each user in a voice channel in this server. */
|
||||
voiceStates: Collection<string, CleanVoiceState>;
|
||||
|
||||
// GETTERS
|
||||
/** Members in this guild. */
|
||||
members: Collection<string, Member>;
|
||||
/** Channels in this guild. */
|
||||
channels: Collection<string, Channel>;
|
||||
/** The afk channel if one is set */
|
||||
afkChannel?: Channel;
|
||||
/** The public update channel if one is set */
|
||||
publicUpdatesChannel?: Channel;
|
||||
/** The rules channel in this guild if one is set */
|
||||
rulesChannel?: Channel;
|
||||
/** The system channel in this guild if one is set */
|
||||
systemChannel?: Channel;
|
||||
/** The bot member in this guild if cached */
|
||||
bot?: Member;
|
||||
/** The bot guild member in this guild if cached */
|
||||
botMember?: GuildMember;
|
||||
/** The bots voice state if there is one in this guild */
|
||||
botVoice?: CleanVoiceState;
|
||||
/** The owner member of this guild */
|
||||
owner?: Member;
|
||||
/** Whether or not this guild is partnered */
|
||||
partnered: boolean;
|
||||
/** Whether or not this guild is verified */
|
||||
verified: boolean;
|
||||
|
||||
// METHODS
|
||||
|
||||
/** The banner url for this server */
|
||||
bannerURL(size?: ImageSize, format?: ImageFormats): string | undefined;
|
||||
/** The full URL of the icon from Discords CDN. Undefined when no icon is set. */
|
||||
iconURL(size?: ImageSize, format?: ImageFormats): string | undefined;
|
||||
/** Delete a guild permanently. User must be owner. Returns 204 No Content on success. Fires a Guild Delete Gateway event. */
|
||||
delete(): ReturnType<typeof deleteServer>;
|
||||
/** Leave a guild */
|
||||
leave(): ReturnType<typeof leaveGuild>;
|
||||
/** Edit the server. Requires the MANAGE_GUILD permission. */
|
||||
edit(options: GuildEditOptions): ReturnType<typeof editGuild>;
|
||||
/** Returns the audit logs for the guild. Requires VIEW AUDIT LOGS permission */
|
||||
auditLogs(options: GetAuditLogsOptions): ReturnType<typeof getAuditLogs>;
|
||||
/** Returns a ban object for the given user or a 404 not found if the ban cannot be found. Requires the BAN_MEMBERS permission. */
|
||||
getBan(memberID: string): ReturnType<typeof getBan>;
|
||||
/** Returns a list of ban objects for the users banned from this guild. Requires the BAN_MEMBERS permission. */
|
||||
bans(): ReturnType<typeof getBans>;
|
||||
/** Ban a user from the guild and optionally delete previous messages sent by the user. Requires the BAN_MEMBERS permission. */
|
||||
ban(memberID: string, options: BanOptions): ReturnType<typeof banMember>;
|
||||
/** Remove the ban for a user. Requires BAN_MEMBERS permission */
|
||||
unban(memberID: string): ReturnType<typeof unbanMember>;
|
||||
/** Get all the invites for this guild. Requires MANAGE_GUILD permission */
|
||||
invites(): ReturnType<typeof getInvites>;
|
||||
}
|
||||
|
||||
export interface CleanVoiceState extends VoiceState {
|
||||
/** The guild id where this voice state is from */
|
||||
guildID: string;
|
||||
/** The channel id where this voice state is from */
|
||||
channelID: string;
|
||||
/** The user id */
|
||||
userID: string;
|
||||
/** The unique random session id for this voice session */
|
||||
sessionID: string;
|
||||
/** Whether the user has deafened themself */
|
||||
selfDeaf: boolean;
|
||||
/** Whether the user has muted themself */
|
||||
selfMute: boolean;
|
||||
/** Whether the user is streaming on go live */
|
||||
selfStream: boolean;
|
||||
}
|
||||
|
||||
@@ -6,15 +6,6 @@ import { rawAvatarURL } from "../helpers/members/raw_avatar_url.ts";
|
||||
import { sendDirectMessage } from "../helpers/members/send_direct_message.ts";
|
||||
import { addRole } from "../helpers/roles/add_role.ts";
|
||||
import { removeRole } from "../helpers/roles/remove_role.ts";
|
||||
import {
|
||||
BanOptions,
|
||||
EditMemberOptions,
|
||||
GuildMember,
|
||||
ImageFormats,
|
||||
ImageSize,
|
||||
MemberCreatePayload,
|
||||
MessageContent,
|
||||
} from "../types/mod.ts";
|
||||
import { Collection } from "../util/collection.ts";
|
||||
import { createNewProp } from "../util/utils.ts";
|
||||
import { Guild } from "./guild.ts";
|
||||
@@ -126,76 +117,3 @@ export async function createMemberStruct(
|
||||
|
||||
return member as Member;
|
||||
}
|
||||
|
||||
export interface Member {
|
||||
/** The user's id */
|
||||
id: string;
|
||||
/** the user's username, not unique across the platform */
|
||||
username: string;
|
||||
/** The user's 4 digit discord tag */
|
||||
discriminator: string;
|
||||
/** The user's avatar hash */
|
||||
avatar: string | null;
|
||||
/** Whether the user is a bot */
|
||||
bot?: boolean;
|
||||
/** Whether the user is an official discord system user (part of the urgent message system.) */
|
||||
system?: boolean;
|
||||
/** the user's chosen language option */
|
||||
locale?: string;
|
||||
/** Whether the email on this account has been verified */
|
||||
verified?: boolean;
|
||||
/** The user's email */
|
||||
email?: string;
|
||||
/** The flags on a user's account. */
|
||||
flags?: number;
|
||||
/** Whether or not this user has 2FA enabled. */
|
||||
mfaEnabled?: boolean;
|
||||
/** The premium type for this user */
|
||||
premiumType?: number;
|
||||
/** The guild related data mapped by guild id */
|
||||
guilds: Collection<string, GuildMember>;
|
||||
|
||||
// GETTERS
|
||||
/** The avatar url using the default format and size. */
|
||||
avatarURL: string;
|
||||
/** The mention string for this member */
|
||||
mention: string;
|
||||
/** The username#discriminator tag for this member */
|
||||
tag: string;
|
||||
|
||||
// METHODS
|
||||
|
||||
/** Returns the avatar url for this member and can be dynamically modified with a size or format */
|
||||
makeAvatarURL(options: { size?: ImageSize; format?: ImageFormats }): string;
|
||||
/** Returns the guild for this guildID */
|
||||
guild(guildID: string): Guild | undefined;
|
||||
/** Get the nickname or the username if no nickname */
|
||||
name(guildID: string): string;
|
||||
/** Get the guild member object for the specified guild */
|
||||
guildMember(guildID: string): GuildMember | undefined;
|
||||
/** Send a direct message to the user is possible */
|
||||
sendDM(
|
||||
content: string | MessageContent,
|
||||
): ReturnType<typeof sendDirectMessage>;
|
||||
/** Kick the member from a guild */
|
||||
kick(guildID: string, reason?: string): ReturnType<typeof kickMember>;
|
||||
/** Edit the member in a guild */
|
||||
edit(
|
||||
guildID: string,
|
||||
options: EditMemberOptions,
|
||||
): ReturnType<typeof editMember>;
|
||||
/** Ban a member in a guild */
|
||||
ban(guildID: string, options: BanOptions): ReturnType<typeof banMember>;
|
||||
/** Add a role to the member */
|
||||
addRole(
|
||||
guildID: string,
|
||||
roleID: string,
|
||||
reason?: string,
|
||||
): ReturnType<typeof addRole>;
|
||||
/** Remove a role from the member */
|
||||
removeRole(
|
||||
guildID: string,
|
||||
roleID: string,
|
||||
reason?: string,
|
||||
): ReturnType<typeof removeRole>;
|
||||
}
|
||||
|
||||
@@ -9,19 +9,6 @@ import { removeAllReactions } from "../helpers/messages/remove_all_reactions.ts"
|
||||
import { removeReaction } from "../helpers/messages/remove_reaction.ts";
|
||||
import { removeReactionEmoji } from "../helpers/messages/remove_reaction_emoji.ts";
|
||||
import { sendMessage } from "../helpers/messages/send_message.ts";
|
||||
import {
|
||||
Activity,
|
||||
Application,
|
||||
Attachment,
|
||||
DiscordReferencePayload,
|
||||
Embed,
|
||||
GuildMember,
|
||||
MessageContent,
|
||||
MessageCreateOptions,
|
||||
MessageSticker,
|
||||
Reaction,
|
||||
UserPayload,
|
||||
} from "../types/mod.ts";
|
||||
import { createNewProp } from "../util/utils.ts";
|
||||
import { Channel } from "./channel.ts";
|
||||
import { Guild } from "./guild.ts";
|
||||
@@ -174,116 +161,3 @@ export async function createMessageStruct(data: MessageCreateOptions) {
|
||||
|
||||
return message as Message;
|
||||
}
|
||||
|
||||
export interface Message {
|
||||
/** The id of the message */
|
||||
id: string;
|
||||
/** The id of the channel the message was sent in */
|
||||
channelID: string;
|
||||
/** The id of the guild the message was sent in */
|
||||
guildID: string;
|
||||
/** The author of this message (not guaranteed to be a valid user such as a webhook.) */
|
||||
author: UserPayload;
|
||||
/** The contents of the message */
|
||||
content: string;
|
||||
/** When this message was sent */
|
||||
timestamp: number;
|
||||
/** When this message was edited (if it was not edited, null) */
|
||||
editedTimestamp?: number;
|
||||
/** Whether this was a TextToSpeech message. */
|
||||
tts: boolean;
|
||||
/** Whether this message mentions everyone */
|
||||
mentionsEveryone: boolean;
|
||||
/** Users specifically mentioned in the message. */
|
||||
mentions: string[];
|
||||
/** Roles specifically mentioned in this message */
|
||||
mentionRoleIDs: string[];
|
||||
/** Channels specifically mentioned in this message */
|
||||
mentionChannelIDs: string[];
|
||||
/** Any attached files */
|
||||
attachments: Attachment[];
|
||||
/** Any embedded content */
|
||||
embeds: Embed[];
|
||||
/** Reactions to the message */
|
||||
reactions?: Reaction[];
|
||||
/** Used for validating a message was sent */
|
||||
nonce?: number | string;
|
||||
/** Whether this message is pinned */
|
||||
pinned: boolean;
|
||||
/** If the message is generated by a webhook, this is the webhooks id */
|
||||
"webhook_id"?: string;
|
||||
/** The type of message */
|
||||
type: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
||||
/** The activities sent with Rich Presence-related chat embeds. */
|
||||
activity?: Activity;
|
||||
/** Applications that sent with Rich Presence related chat embeds. */
|
||||
applications?: Application;
|
||||
/** The reference data sent with crossposted messages */
|
||||
messageReference?: DiscordReferencePayload;
|
||||
/** The message flags combined like permission bits describe extra features of the message */
|
||||
flags?: 1 | 2 | 4 | 8 | 16;
|
||||
/** the stickers sent with the message (bots currently can only receive messages with stickers, not send) */
|
||||
stickers?: MessageSticker[];
|
||||
/** The message id of the original message if this message was sent as a reply. If null, the original message was deleted. */
|
||||
referencedMessageID?: MessageCreateOptions | null;
|
||||
|
||||
// GETTERS
|
||||
|
||||
/** The channel where this message was sent. Can be undefined if uncached. */
|
||||
channel?: Channel;
|
||||
/** The guild of this message. Can be undefined if not in cache or in DM */
|
||||
guild?: Guild;
|
||||
/** The member for the user who sent the message. Can be undefined if not in cache or in dm. */
|
||||
member?: Member;
|
||||
/** The guild member details for this guild and member. Can be undefined if not in cache or in dm. */
|
||||
guildMember?: GuildMember;
|
||||
/** The url link to this message */
|
||||
link: string;
|
||||
/** The role objects for all the roles that were mentioned in this message */
|
||||
mentionedRoles: (Role | undefined)[];
|
||||
/** The channel objects for all the channels that were mentioned in this message. */
|
||||
mentionedChannels: (Channel | undefined)[];
|
||||
/** The member objects for all the members that were mentioned in this message. */
|
||||
mentionedMembers: (Member | undefined)[];
|
||||
|
||||
// METHODS
|
||||
|
||||
/** Delete the message */
|
||||
delete(
|
||||
reason?: string,
|
||||
delayMilliseconds?: number,
|
||||
): ReturnType<typeof deleteMessage>;
|
||||
/** Edit the message */
|
||||
edit(content: string | MessageContent): ReturnType<typeof editMessage>;
|
||||
/** Pins the message in the channel */
|
||||
pin(): ReturnType<typeof pinMessage>;
|
||||
/** Add a reaction to the message */
|
||||
addReaction(reaction: string): ReturnType<typeof addReaction>;
|
||||
/** Add multiple reactions to the message without or without order. */
|
||||
addReactions(
|
||||
reactions: string[],
|
||||
ordered?: boolean,
|
||||
): ReturnType<typeof addReactions>;
|
||||
/** Send a inline reply to this message */
|
||||
reply(content: string | MessageContent): ReturnType<typeof sendMessage>;
|
||||
/** Send a message to this channel where this message is */
|
||||
send(content: string | MessageContent): ReturnType<typeof sendMessage>;
|
||||
/** Send a message to this channel and then delete it after a bit. By default it will delete after 10 seconds with no reason provided. */
|
||||
alert(
|
||||
content: string | MessageContent,
|
||||
timeout?: number,
|
||||
reason?: string,
|
||||
): Promise<void>;
|
||||
/** Send a inline reply to this message but then delete it after a bit. By default it will delete after 10 seconds with no reason provided. */
|
||||
alertReply(
|
||||
content: string | MessageContent,
|
||||
timeout?: number,
|
||||
reason?: string,
|
||||
): Promise<unknown>;
|
||||
/** Remove all reactions */
|
||||
removeAllReactions(): ReturnType<typeof removeAllReactions>;
|
||||
/** Remove all reactions */
|
||||
removeReactionEmoji(reaction: string): ReturnType<typeof removeReactionEmoji>;
|
||||
/** Remove all reactions */
|
||||
removeReaction(reaction: string): ReturnType<typeof removeReaction>;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { cache } from "../cache.ts";
|
||||
import { deleteRole } from "../helpers/roles/delete_role.ts";
|
||||
import { editRole } from "../helpers/roles/edit_role.ts";
|
||||
import { CreateRoleOptions, RoleData } from "../types/mod.ts";
|
||||
import { Collection } from "../util/collection.ts";
|
||||
import { createNewProp } from "../util/utils.ts";
|
||||
import { Guild } from "./guild.ts";
|
||||
@@ -84,48 +83,3 @@ export async function createRoleStruct({ tags = {}, ...rest }: RoleData) {
|
||||
|
||||
return role as Role;
|
||||
}
|
||||
|
||||
export interface Role {
|
||||
/** role id */
|
||||
id: string;
|
||||
/** role name */
|
||||
name: string;
|
||||
/** integer representation of hexadecimal color code */
|
||||
color: number;
|
||||
/** if this role is pinned in the user listing */
|
||||
hoist: boolean;
|
||||
/** position of this role */
|
||||
position: number;
|
||||
/** permission bit set */
|
||||
permissions: string;
|
||||
/** whether this role is managed by an integration */
|
||||
managed: boolean;
|
||||
/** whether this role is mentionable */
|
||||
mentionable: boolean;
|
||||
/** The bot id that is associated with this role. */
|
||||
botID?: string;
|
||||
/** If this role is the nitro boost role. */
|
||||
isNitroBoostRole: boolean;
|
||||
/** The integration id that is associated with this role */
|
||||
integrationID: string;
|
||||
|
||||
// GETTERS
|
||||
|
||||
/** The guild where this role is. If undefined, the guild is not cached */
|
||||
guild?: Guild;
|
||||
/** The hex color for this role. */
|
||||
hexColor: string;
|
||||
/** The cached members that have this role */
|
||||
members: Collection<string, Member>;
|
||||
/** The @ mention of the role in a string. */
|
||||
mention: string;
|
||||
|
||||
// METHODS
|
||||
|
||||
/** Delete the role */
|
||||
delete(guildID?: string): ReturnType<typeof deleteRole>;
|
||||
/** Edits the role */
|
||||
edit(options: CreateRoleOptions): ReturnType<typeof editRole>;
|
||||
/** Checks if this role is higher than another role. */
|
||||
higherThanRoleID(roleID: string, position?: number): boolean;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { cache } from "../cache.ts";
|
||||
import { GuildTemplate, UserPayload } from "../types/mod.ts";
|
||||
import { createNewProp } from "../util/utils.ts";
|
||||
import { Guild } from "./guild.ts";
|
||||
|
||||
@@ -42,32 +41,3 @@ export function createTemplateStruct(
|
||||
isDirty: createNewProp(isDirty),
|
||||
}) as Template;
|
||||
}
|
||||
|
||||
export interface Template {
|
||||
/** the template code (unique ID) */
|
||||
code: string;
|
||||
/** template name */
|
||||
name: string;
|
||||
/** the description for the template */
|
||||
description: string | null;
|
||||
/** number of times this template has been used */
|
||||
usageCount: number;
|
||||
/** the ID of the user who created the template */
|
||||
createdID: string;
|
||||
/** the user who created the template */
|
||||
creator: UserPayload;
|
||||
/** when this template was created */
|
||||
createdAt: string;
|
||||
/** when this template was last synced to the source guild */
|
||||
updatedAt: string;
|
||||
/** the ID of the guild this template is based on */
|
||||
sourceGuildID: string;
|
||||
/** the guild snapshot this template contains */
|
||||
serializedSourceGuild: Partial<Guild>;
|
||||
/** whether the template has unsynced changes */
|
||||
isDirty: boolean | null;
|
||||
|
||||
// GETTERS
|
||||
|
||||
sourceGuild: Guild | undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user