mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
add member.mention and member.avatarURL
This commit is contained in:
@@ -14,14 +14,30 @@ import {
|
|||||||
addRole,
|
addRole,
|
||||||
editMember,
|
editMember,
|
||||||
kick,
|
kick,
|
||||||
|
rawAvatarURL,
|
||||||
removeRole,
|
removeRole,
|
||||||
sendDirectMessage,
|
sendDirectMessage,
|
||||||
} from "../handlers/member.ts";
|
} from "../handlers/member.ts";
|
||||||
import { Guild } from "./guild.ts";
|
import { Guild } from "./guild.ts";
|
||||||
|
|
||||||
const baseMember: Partial<Member> = {
|
const baseMember: Partial<Member> = {
|
||||||
// METHODS
|
get avatarURL() {
|
||||||
|
return rawAvatarURL(this.id!, this.discriminator!, this.avatar!);
|
||||||
|
},
|
||||||
|
get mention() {
|
||||||
|
return `<@!${this.id!}>`;
|
||||||
|
},
|
||||||
|
|
||||||
|
// METHODS
|
||||||
|
makeAvatarURL(size, format) {
|
||||||
|
return rawAvatarURL(
|
||||||
|
this.id,
|
||||||
|
this.discriminator!,
|
||||||
|
this.avatar!,
|
||||||
|
size,
|
||||||
|
format,
|
||||||
|
);
|
||||||
|
},
|
||||||
guild(guildID) {
|
guild(guildID) {
|
||||||
return cache.guilds.get(guildID);
|
return cache.guilds.get(guildID);
|
||||||
},
|
},
|
||||||
@@ -137,8 +153,16 @@ export interface Member {
|
|||||||
/** The guild related data mapped by guild id */
|
/** The guild related data mapped by guild id */
|
||||||
guilds: Collection<string, GuildMember>;
|
guilds: Collection<string, GuildMember>;
|
||||||
|
|
||||||
|
// GETTERS
|
||||||
|
/** The avatar url using the default format and size. */
|
||||||
|
avatarURL: string;
|
||||||
|
/** The mention string for this member */
|
||||||
|
mention: string;
|
||||||
|
|
||||||
// METHODS
|
// METHODS
|
||||||
|
|
||||||
|
/** Returns the avatar url for this member and can be dynamically modified with a size or format */
|
||||||
|
makeAvatarURL(size: ImageSize, format: ImageFormat): string;
|
||||||
/** Returns the guild for this guildID */
|
/** Returns the guild for this guildID */
|
||||||
guild(guildID: string): Guild | undefined;
|
guild(guildID: string): Guild | undefined;
|
||||||
/** Get the nickname or the username if no nickname */
|
/** Get the nickname or the username if no nickname */
|
||||||
|
|||||||
+2
-2
@@ -66,8 +66,8 @@ export async function startBot(config: BotConfig) {
|
|||||||
export function updateEventHandlers(newEventHandlers: EventHandlers) {
|
export function updateEventHandlers(newEventHandlers: EventHandlers) {
|
||||||
eventHandlers = {
|
eventHandlers = {
|
||||||
...eventHandlers,
|
...eventHandlers,
|
||||||
...newEventHandlers
|
...newEventHandlers,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/** INTERNAL LIB function used to set the bot ID once the READY event is sent by Discord. */
|
/** INTERNAL LIB function used to set the bot ID once the READY event is sent by Discord. */
|
||||||
|
|||||||
Reference in New Issue
Block a user