mirror of
https://github.com/stoatchat/javascript-client-sdk.git
synced 2026-07-20 20:16:06 -04:00
fix: don't expect channel to exist
This commit is contained in:
@@ -148,8 +148,8 @@ export class Channel {
|
||||
*/
|
||||
get recipient() {
|
||||
return this.type === "DirectMessage"
|
||||
? this.recipients.find(
|
||||
(user) => user.id !== this.#collection.client.user!.id
|
||||
? this.recipients?.find(
|
||||
(user) => user?.id !== this.#collection.client.user!.id
|
||||
)
|
||||
: undefined;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ export class Message {
|
||||
* Absolute pathname to this message in the client
|
||||
*/
|
||||
get path() {
|
||||
return `${this.channel!.path}/${this.id}`;
|
||||
return `${this.channel?.path}/${this.id}`;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,7 +68,7 @@ export class Message {
|
||||
* Server this message was sent in
|
||||
*/
|
||||
get server() {
|
||||
return this.channel!.server;
|
||||
return this.channel?.server;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,7 +76,7 @@ export class Message {
|
||||
*/
|
||||
get member() {
|
||||
return this.#collection.client.serverMembers.getByKey({
|
||||
server: this.channel!.serverId,
|
||||
server: this.channel?.serverId as string,
|
||||
user: this.authorId!,
|
||||
});
|
||||
}
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ export * from "./classes";
|
||||
export * from "./lib/regex";
|
||||
export * from "./collections";
|
||||
export * as API from "revolt-api";
|
||||
export type { Session } from "./Client";
|
||||
export { Client, ClientOptions } from "./Client";
|
||||
export { Client } from "./Client";
|
||||
export type { Session, ClientOptions } from "./Client";
|
||||
export { EventClient, ConnectionState } from "./events";
|
||||
export { ServerFlags, UserBadges, UserFlags, BotFlags } from "./hydration";
|
||||
|
||||
Reference in New Issue
Block a user