Relationship types

This commit is contained in:
Flam3rboy
2021-05-30 20:24:45 +02:00
parent 5460419cd8
commit 0ff1daeaff
4 changed files with 27 additions and 7 deletions
+17 -2
View File
@@ -1,4 +1,4 @@
import { ConnectedAccount, PublicUser, User, UserSettings } from "./User";
import { ConnectedAccount, PublicUser, Relationship, User, UserSettings } from "./User";
import { DMChannel, Channel } from "./Channel";
import { Guild } from "./Guild";
import { Member, PublicMember, UserGuildSettings } from "./Member";
@@ -49,7 +49,7 @@ export interface ReadyEventData {
user: PublicUser & {
mobile: boolean;
desktop: boolean;
email: string | null ;
email: string | null;
flags: bigint;
mfa_enabled: boolean;
nsfw_allowed: boolean;
@@ -431,6 +431,19 @@ export interface MessageAckEvent extends Event {
};
}
export interface RelationshipAddEvent extends Event {
event: "RELATIONSHIP_ADD";
data: Relationship & {
should_notify?: boolean;
user: PublicUser;
};
}
export interface RelationshipRemoveEvent extends Event {
event: "RELATIONSHIP_REMOVE";
data: Omit<Relationship, "nickname">;
}
// located in collection events
export enum EVENTEnum {
@@ -520,6 +533,8 @@ export type EVENT =
| "APPLICATION_COMMAND_UPDATE"
| "APPLICATION_COMMAND_DELETE"
| "MESSAGE_ACK"
| "RELATIONSHIP_ADD"
| "RELATIONSHIP_REMOVE"
| CUSTOMEVENTS;
export type CUSTOMEVENTS = "INVALIDATED";
+9 -4
View File
@@ -80,8 +80,14 @@ export interface ConnectedAccount {
export interface Relationship {
id: string;
nickname?: string;
type: number;
user_id: string;
type: RelationshipType;
}
export enum RelationshipType {
outgoing = 4,
incoming = 3,
blocked = 2,
friends = 1,
}
export interface UserSettings {
@@ -158,10 +164,9 @@ export const UserSchema = new Schema({
valid_tokens_since: Date, // all tokens with a previous issue date are invalid
relationships: [
{
id: String,
id: { type: String, required: true },
nickname: String,
type: { type: Number },
user_id: String,
},
],
connected_accounts: [