mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-11 13:14:06 +01:00
🐛 fix Database
This commit is contained in:
parent
35be87b867
commit
e5f408be08
66
dist/models/Activity.d.ts
vendored
66
dist/models/Activity.d.ts
vendored
@ -12,10 +12,10 @@ export interface Activity {
|
|||||||
name: string;
|
name: string;
|
||||||
type: ActivityType;
|
type: ActivityType;
|
||||||
url?: string;
|
url?: string;
|
||||||
created_at: Date;
|
created_at?: Date;
|
||||||
timestamps?: {
|
timestamps?: {
|
||||||
start: number;
|
start?: number;
|
||||||
end: number;
|
end?: number;
|
||||||
}[];
|
}[];
|
||||||
application_id?: bigint;
|
application_id?: bigint;
|
||||||
details?: string;
|
details?: string;
|
||||||
@ -30,10 +30,10 @@ export interface Activity {
|
|||||||
size?: [number, number];
|
size?: [number, number];
|
||||||
};
|
};
|
||||||
assets?: {
|
assets?: {
|
||||||
large_image: string;
|
large_image?: string;
|
||||||
large_text: string;
|
large_text?: string;
|
||||||
small_image: string;
|
small_image?: string;
|
||||||
small_text: string;
|
small_text?: string;
|
||||||
};
|
};
|
||||||
secrets?: {
|
secrets?: {
|
||||||
join?: string;
|
join?: string;
|
||||||
@ -46,37 +46,37 @@ export interface Activity {
|
|||||||
export declare const Activity: {
|
export declare const Activity: {
|
||||||
name: StringConstructor;
|
name: StringConstructor;
|
||||||
type: NumberConstructor;
|
type: NumberConstructor;
|
||||||
url: StringConstructor;
|
$url: StringConstructor;
|
||||||
created_at: DateConstructor;
|
$created_at: DateConstructor;
|
||||||
timestamps: {
|
$timestamps: {
|
||||||
start: NumberConstructor;
|
$start: NumberConstructor;
|
||||||
end: NumberConstructor;
|
$end: NumberConstructor;
|
||||||
}[];
|
}[];
|
||||||
application_id: typeof Types.Long;
|
$application_id: typeof Types.Long;
|
||||||
details: StringConstructor;
|
$details: StringConstructor;
|
||||||
state: StringConstructor;
|
$state: StringConstructor;
|
||||||
emoji: {
|
$emoji: {
|
||||||
name: StringConstructor;
|
$name: StringConstructor;
|
||||||
id: typeof Types.Long;
|
$id: typeof Types.Long;
|
||||||
amimated: BooleanConstructor;
|
$amimated: BooleanConstructor;
|
||||||
};
|
};
|
||||||
party: {
|
$party: {
|
||||||
id: StringConstructor;
|
$id: StringConstructor;
|
||||||
size: NumberConstructor[];
|
$size: NumberConstructor[];
|
||||||
};
|
};
|
||||||
assets: {
|
$assets: {
|
||||||
large_image: StringConstructor;
|
$large_image: StringConstructor;
|
||||||
large_text: StringConstructor;
|
$large_text: StringConstructor;
|
||||||
small_image: StringConstructor;
|
$small_image: StringConstructor;
|
||||||
small_text: StringConstructor;
|
$small_text: StringConstructor;
|
||||||
};
|
};
|
||||||
secrets: {
|
$secrets: {
|
||||||
join: StringConstructor;
|
$join: StringConstructor;
|
||||||
spectate: StringConstructor;
|
$spectate: StringConstructor;
|
||||||
match: StringConstructor;
|
$match: StringConstructor;
|
||||||
};
|
};
|
||||||
instance: BooleanConstructor;
|
$instance: BooleanConstructor;
|
||||||
flags: typeof Types.Long;
|
$flags: typeof Types.Long;
|
||||||
};
|
};
|
||||||
export declare enum ActivityType {
|
export declare enum ActivityType {
|
||||||
GAME = 0,
|
GAME = 0,
|
||||||
|
52
dist/models/Activity.js
vendored
52
dist/models/Activity.js
vendored
@ -5,39 +5,39 @@ const mongoose_1 = require("mongoose");
|
|||||||
exports.Activity = {
|
exports.Activity = {
|
||||||
name: String,
|
name: String,
|
||||||
type: Number,
|
type: Number,
|
||||||
url: String,
|
$url: String,
|
||||||
created_at: Date,
|
$created_at: Date,
|
||||||
timestamps: [
|
$timestamps: [
|
||||||
{
|
{
|
||||||
start: Number,
|
$start: Number,
|
||||||
end: Number,
|
$end: Number,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
application_id: mongoose_1.Types.Long,
|
$application_id: mongoose_1.Types.Long,
|
||||||
details: String,
|
$details: String,
|
||||||
state: String,
|
$state: String,
|
||||||
emoji: {
|
$emoji: {
|
||||||
name: String,
|
$name: String,
|
||||||
id: mongoose_1.Types.Long,
|
$id: mongoose_1.Types.Long,
|
||||||
amimated: Boolean,
|
$amimated: Boolean,
|
||||||
},
|
},
|
||||||
party: {
|
$party: {
|
||||||
id: String,
|
$id: String,
|
||||||
size: [Number, Number],
|
$size: [Number, Number],
|
||||||
},
|
},
|
||||||
assets: {
|
$assets: {
|
||||||
large_image: String,
|
$large_image: String,
|
||||||
large_text: String,
|
$large_text: String,
|
||||||
small_image: String,
|
$small_image: String,
|
||||||
small_text: String,
|
$small_text: String,
|
||||||
},
|
},
|
||||||
secrets: {
|
$secrets: {
|
||||||
join: String,
|
$join: String,
|
||||||
spectate: String,
|
$spectate: String,
|
||||||
match: String,
|
$match: String,
|
||||||
},
|
},
|
||||||
instance: Boolean,
|
$instance: Boolean,
|
||||||
flags: mongoose_1.Types.Long,
|
$flags: mongoose_1.Types.Long,
|
||||||
};
|
};
|
||||||
var ActivityType;
|
var ActivityType;
|
||||||
(function (ActivityType) {
|
(function (ActivityType) {
|
||||||
|
2
dist/models/Activity.js.map
vendored
2
dist/models/Activity.js.map
vendored
@ -1 +1 @@
|
|||||||
{"version":3,"file":"Activity.js","sourceRoot":"","sources":["../../src/models/Activity.ts"],"names":[],"mappings":";;;AAEA,uCAA0D;AA8C7C,QAAA,QAAQ,GAAG;IACvB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,MAAM;IACX,UAAU,EAAE,IAAI;IAChB,UAAU,EAAE;QACX;YACC,KAAK,EAAE,MAAM;YACb,GAAG,EAAE,MAAM;SACX;KACD;IACD,cAAc,EAAE,gBAAK,CAAC,IAAI;IAC1B,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,MAAM;IACb,KAAK,EAAE;QACN,IAAI,EAAE,MAAM;QACZ,EAAE,EAAE,gBAAK,CAAC,IAAI;QACd,QAAQ,EAAE,OAAO;KACjB;IACD,KAAK,EAAE;QACN,EAAE,EAAE,MAAM;QACV,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;KACtB;IACD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AM,EAAE,MAAM;KACd;IACD,SAAS,EAAE,OAAO;IAClB,MAAM,EAAE,gBAAK,CAAC,IAAI;CAClB,CAAC;AAEF,IAAY,YAMX;AAND,WAAY,YAAY;IACvB,+CAAQ,CAAA;IACR,yDAAa,CAAA;IACb,yDAAa,CAAA;IACb,mDAAU,CAAA;IACV,yDAAa,CAAA;AACd,CAAC,EANW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAMvB"}
|
25
dist/models/Event.d.ts
vendored
25
dist/models/Event.d.ts
vendored
@ -1,8 +1,8 @@
|
|||||||
/// <reference path="../util/MongoBigInt.d.ts" />
|
/// <reference path="../util/MongoBigInt.d.ts" />
|
||||||
import { ConnectedAccount, User, UserSettings } from "./User";
|
import { ConnectedAccount, PublicUser, User, UserSettings } from "./User";
|
||||||
import { DMChannel, Channel } from "./Channel";
|
import { DMChannel, Channel } from "./Channel";
|
||||||
import { Guild } from "./Guild";
|
import { Guild } from "./Guild";
|
||||||
import { PublicMember, UserGuildSettings } from "./Member";
|
import { Member, PublicMember, UserGuildSettings } from "./Member";
|
||||||
import { Emoji } from "./Emoji";
|
import { Emoji } from "./Emoji";
|
||||||
import { Presence } from "./Activity";
|
import { Presence } from "./Activity";
|
||||||
import { Role } from "./Role";
|
import { Role } from "./Role";
|
||||||
@ -29,7 +29,19 @@ export interface InvalidatedEvent extends Event {
|
|||||||
}
|
}
|
||||||
export interface ReadyEventData {
|
export interface ReadyEventData {
|
||||||
v: number;
|
v: number;
|
||||||
user: Omit<User, "guilds" | "user_settings" | "valid_tokens_since" | "connected_accounts" | "relationships">;
|
user: PublicUser & {
|
||||||
|
mobile: boolean;
|
||||||
|
desktop: boolean;
|
||||||
|
email: string;
|
||||||
|
flags: bigint;
|
||||||
|
mfa_enabled: boolean;
|
||||||
|
nsfw_allowed: boolean;
|
||||||
|
phone: string;
|
||||||
|
premium: boolean;
|
||||||
|
premium_type: number;
|
||||||
|
verified: boolean;
|
||||||
|
bot: boolean;
|
||||||
|
};
|
||||||
private_channels: DMChannel[];
|
private_channels: DMChannel[];
|
||||||
session_id: string;
|
session_id: string;
|
||||||
guilds: Guild[];
|
guilds: Guild[];
|
||||||
@ -67,6 +79,11 @@ export interface ReadyEventData {
|
|||||||
shard?: [number, number];
|
shard?: [number, number];
|
||||||
user_settings?: UserSettings;
|
user_settings?: UserSettings;
|
||||||
relationships?: [];
|
relationships?: [];
|
||||||
|
read_state: {
|
||||||
|
entries: [];
|
||||||
|
partial: boolean;
|
||||||
|
version: number;
|
||||||
|
};
|
||||||
user_guild_settings?: {
|
user_guild_settings?: {
|
||||||
entries: UserGuildSettings[];
|
entries: UserGuildSettings[];
|
||||||
version: number;
|
version: number;
|
||||||
@ -76,7 +93,7 @@ export interface ReadyEventData {
|
|||||||
id: bigint;
|
id: bigint;
|
||||||
flags: bigint;
|
flags: bigint;
|
||||||
};
|
};
|
||||||
merged_members?: PublicMember[][];
|
merged_members?: Omit<Member, "settings" | "user">[][];
|
||||||
users?: {
|
users?: {
|
||||||
avatar?: string;
|
avatar?: string;
|
||||||
discriminator: string;
|
discriminator: string;
|
||||||
|
2
dist/models/Event.js.map
vendored
2
dist/models/Event.js.map
vendored
@ -1 +1 @@
|
|||||||
{"version":3,"file":"Event.js","sourceRoot":"","sources":["../../src/models/Event.ts"],"names":[],"mappings":";;;;;;AAYA,uCAA0D;AAC1D,gEAAkC;AAarB,QAAA,WAAW,GAAG,IAAI,iBAAM,CAAC;IACrC,QAAQ,EAAE,gBAAK,CAAC,IAAI;IACpB,OAAO,EAAE,gBAAK,CAAC,IAAI;IACnB,UAAU,EAAE,gBAAK,CAAC,IAAI;IACtB,UAAU,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC1C,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACvC,IAAI,EAAE,MAAM;CACZ,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,UAAU,GAAG,kB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AC,EAzCW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAyCpB"}
|
39
dist/models/Guild.js
vendored
39
dist/models/Guild.js
vendored
@ -6,6 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||||||
exports.GuildModel = exports.GuildSchema = void 0;
|
exports.GuildModel = exports.GuildSchema = void 0;
|
||||||
const mongoose_1 = require("mongoose");
|
const mongoose_1 = require("mongoose");
|
||||||
const Database_1 = __importDefault(require("../util/Database"));
|
const Database_1 = __importDefault(require("../util/Database"));
|
||||||
|
const Channel_1 = require("./Channel");
|
||||||
|
const Emoji_1 = require("./Emoji");
|
||||||
|
const Member_1 = require("./Member");
|
||||||
|
const Role_1 = require("./Role");
|
||||||
exports.GuildSchema = new mongoose_1.Schema({
|
exports.GuildSchema = new mongoose_1.Schema({
|
||||||
id: { type: mongoose_1.Types.Long, required: true },
|
id: { type: mongoose_1.Types.Long, required: true },
|
||||||
afk_channel_id: mongoose_1.Types.Long,
|
afk_channel_id: mongoose_1.Types.Long,
|
||||||
@ -44,7 +48,40 @@ exports.GuildSchema = new mongoose_1.Schema({
|
|||||||
widget_channel_id: mongoose_1.Types.Long,
|
widget_channel_id: mongoose_1.Types.Long,
|
||||||
widget_enabled: Boolean,
|
widget_enabled: Boolean,
|
||||||
});
|
});
|
||||||
// GuildSchema.virtual
|
exports.GuildSchema.virtual("channels", {
|
||||||
|
ref: Channel_1.ChannelModel,
|
||||||
|
localField: "id",
|
||||||
|
foreignField: "guild_id",
|
||||||
|
justOne: false,
|
||||||
|
});
|
||||||
|
exports.GuildSchema.virtual("roles", {
|
||||||
|
ref: Role_1.RoleModel,
|
||||||
|
localField: "id",
|
||||||
|
foreignField: "guild_id",
|
||||||
|
justOne: false,
|
||||||
|
});
|
||||||
|
// nested populate is needed for member users: https://gist.github.com/yangsu/5312204
|
||||||
|
exports.GuildSchema.virtual("members", {
|
||||||
|
ref: Member_1.MemberModel,
|
||||||
|
localField: "id",
|
||||||
|
foreignField: "member_id",
|
||||||
|
justOne: false,
|
||||||
|
});
|
||||||
|
exports.GuildSchema.virtual("emojis", {
|
||||||
|
ref: Emoji_1.EmojiModel,
|
||||||
|
localField: "id",
|
||||||
|
foreignField: "guild_id",
|
||||||
|
justOne: false,
|
||||||
|
});
|
||||||
|
exports.GuildSchema.virtual("joined_at", {
|
||||||
|
ref: Member_1.MemberModel,
|
||||||
|
localField: "id",
|
||||||
|
foreignField: "guild_id",
|
||||||
|
justOne: true,
|
||||||
|
}).get((member, virtual, doc) => {
|
||||||
|
console.log("get", member, this);
|
||||||
|
return member.joined_at;
|
||||||
|
});
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
exports.GuildModel = Database_1.default.model("Guild", exports.GuildSchema, "guilds");
|
exports.GuildModel = Database_1.default.model("Guild", exports.GuildSchema, "guilds");
|
||||||
//# sourceMappingURL=Guild.js.map
|
//# sourceMappingURL=Guild.js.map
|
2
dist/models/Guild.js.map
vendored
2
dist/models/Guild.js.map
vendored
@ -1 +1 @@
|
|||||||
{"version":3,"file":"Guild.js","sourceRoot":"","sources":["../../src/models/Guild.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA0D;AAC1D,gEAAkC;AAiDrB,QAAA,WAAW,GAAG,IAAI,iBAAM,CAAC;IACrC,EAAE,EAAE,EAAE,IAAI,EAAE,gBAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IACxC,cAAc,EAAE,gBAAK,CAAC,IAAI;IAC1B,WAAW,EAAE,MAAM;IACnB,cAAc,EAAE,gBAAK,CAAC,IAAI;IAC1B,MAAM,EAAE,MAAM;IACd,6BAA6B,EAAE,MAAM;IACrC,WAAW,EAAE,MAAM;IACnB,gBAAgB,EAAE,MAAM;IACxB,uBAAuB,EAAE,MAAM;IAC/B,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;IACzC,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd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AE,MAAM,EAAE,IAAI,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC,SAAS,CAAC;AACzB,CAAC,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,UAAU,GAAG,kBAAE,CAAC,KAAK,CAAgB,OAAO,EAAE,mBAAW,EAAE,QAAQ,CAAC,CAAC"}
|
16
dist/models/User.d.ts
vendored
16
dist/models/User.d.ts
vendored
@ -7,7 +7,6 @@ export interface User {
|
|||||||
username: string;
|
username: string;
|
||||||
discriminator: string;
|
discriminator: string;
|
||||||
avatar: string | null;
|
avatar: string | null;
|
||||||
fingerprints: string[];
|
|
||||||
phone?: string;
|
phone?: string;
|
||||||
desktop: boolean;
|
desktop: boolean;
|
||||||
mobile: boolean;
|
mobile: boolean;
|
||||||
@ -15,7 +14,6 @@ export interface User {
|
|||||||
premium_type: number;
|
premium_type: number;
|
||||||
bot: boolean;
|
bot: boolean;
|
||||||
system: boolean;
|
system: boolean;
|
||||||
level: string;
|
|
||||||
nsfw_allowed: boolean;
|
nsfw_allowed: boolean;
|
||||||
mfa_enabled: boolean;
|
mfa_enabled: boolean;
|
||||||
created_at: Date;
|
created_at: Date;
|
||||||
@ -23,18 +21,22 @@ export interface User {
|
|||||||
email?: string;
|
email?: string;
|
||||||
flags: bigint;
|
flags: bigint;
|
||||||
public_flags: bigint;
|
public_flags: bigint;
|
||||||
hash: string;
|
|
||||||
guilds: bigint[];
|
|
||||||
valid_tokens_since: Date;
|
|
||||||
user_settings: UserSettings;
|
user_settings: UserSettings;
|
||||||
relationships: Relationship[];
|
user_data: UserData;
|
||||||
connected_accounts: ConnectedAccount[];
|
|
||||||
presence: {
|
presence: {
|
||||||
status: Status;
|
status: Status;
|
||||||
activities: Activity[];
|
activities: Activity[];
|
||||||
client_status: ClientStatus;
|
client_status: ClientStatus;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
export interface UserData {
|
||||||
|
valid_tokens_since: Date;
|
||||||
|
relationships: Relationship[];
|
||||||
|
connected_accounts: ConnectedAccount[];
|
||||||
|
guilds: bigint[];
|
||||||
|
hash: string;
|
||||||
|
fingerprints: string[];
|
||||||
|
}
|
||||||
export interface UserDocument extends User, Document {
|
export interface UserDocument extends User, Document {
|
||||||
id: bigint;
|
id: bigint;
|
||||||
}
|
}
|
||||||
|
52
dist/models/User.js
vendored
52
dist/models/User.js
vendored
@ -13,7 +13,6 @@ exports.UserSchema = new mongoose_1.Schema({
|
|||||||
username: String,
|
username: String,
|
||||||
discriminator: String,
|
discriminator: String,
|
||||||
avatar: String,
|
avatar: String,
|
||||||
fingerprints: [String],
|
|
||||||
phone: String,
|
phone: String,
|
||||||
desktop: Boolean,
|
desktop: Boolean,
|
||||||
mobile: Boolean,
|
mobile: Boolean,
|
||||||
@ -28,9 +27,33 @@ exports.UserSchema = new mongoose_1.Schema({
|
|||||||
email: String,
|
email: String,
|
||||||
flags: mongoose_1.Types.Long,
|
flags: mongoose_1.Types.Long,
|
||||||
public_flags: mongoose_1.Types.Long,
|
public_flags: mongoose_1.Types.Long,
|
||||||
hash: String,
|
user_data: {
|
||||||
guilds: [mongoose_1.Types.Long],
|
fingerprints: [String],
|
||||||
valid_tokens_since: Date,
|
hash: String,
|
||||||
|
guilds: [mongoose_1.Types.Long],
|
||||||
|
valid_tokens_since: Date,
|
||||||
|
relationships: [
|
||||||
|
{
|
||||||
|
id: mongoose_1.Types.Long,
|
||||||
|
nickname: String,
|
||||||
|
type: Number,
|
||||||
|
user_id: mongoose_1.Types.Long,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
connected_accounts: [
|
||||||
|
{
|
||||||
|
access_token: String,
|
||||||
|
friend_sync: Boolean,
|
||||||
|
id: String,
|
||||||
|
name: String,
|
||||||
|
revoked: Boolean,
|
||||||
|
show_activity: Boolean,
|
||||||
|
type: String,
|
||||||
|
verifie: Boolean,
|
||||||
|
visibility: Number,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
user_settings: {
|
user_settings: {
|
||||||
afk_timeout: Number,
|
afk_timeout: Number,
|
||||||
allow_accessibility_detection: Boolean,
|
allow_accessibility_detection: Boolean,
|
||||||
@ -77,27 +100,6 @@ exports.UserSchema = new mongoose_1.Schema({
|
|||||||
theme: String,
|
theme: String,
|
||||||
timezone_offset: Number,
|
timezone_offset: Number,
|
||||||
},
|
},
|
||||||
relationships: [
|
|
||||||
{
|
|
||||||
id: mongoose_1.Types.Long,
|
|
||||||
nickname: String,
|
|
||||||
type: Number,
|
|
||||||
user_id: mongoose_1.Types.Long,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
connected_accounts: [
|
|
||||||
{
|
|
||||||
access_token: String,
|
|
||||||
friend_sync: Boolean,
|
|
||||||
id: String,
|
|
||||||
name: String,
|
|
||||||
revoked: Boolean,
|
|
||||||
show_activity: Boolean,
|
|
||||||
type: String,
|
|
||||||
verifie: Boolean,
|
|
||||||
visibility: Number,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
presence: {
|
presence: {
|
||||||
status: String,
|
status: String,
|
||||||
activities: [Activity_1.Activity],
|
activities: [Activity_1.Activity],
|
||||||
|
2
dist/models/User.js.map
vendored
2
dist/models/User.js.map
vendored
@ -1 +1 @@
|
|||||||
{"version":3,"file":"User.js","sourceRoot":"","sources":["../../src/models/User.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAsC;AACtC,qCAAgD;AAChD,uCAAmD;AACnD,gEAAkC;AAgHrB,QAAA,UAAU,GAAG,IAAI,iBAAM,CAAC;IACpC,EAAE,EAAE,gBAAK,CAAC,IAAI;IACd,QAAQ,EAAE,MAAM;IAChB,aAAa,EAAE,MAAM;IACrB,MAAM,EAAE,MAAM;IACd,YAAY,EAAE,CAAC,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,OAAO;IACf,OAAO,EAAE,OAAO;IAChB,YAAY,EAAE,MAAM;IACpB,GAAG,EAAE,OAAO;IACZ,MAAM,EAAE,OAAO;IACf,YAAY,EAAE,O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1B,kBAAkB,EAAE,OAAO;QAC3B,uBAAuB,EAAE,MAAM;QAC/B,mBAAmB,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE;QACrC,iBAAiB,EAAE,OAAO;QAC1B,aAAa,EAAE,OAAO;QACtB,6CAA6C;QAC7C,aAAa,EAAE;YACd;gBACC,KAAK,EAAE,MAAM;gBACb,SAAS,EAAE,CAAC,gBAAK,CAAC,IAAI,CAAC;gBACvB,EAAE,EAAE,MAAM;gBACV,IAAI,EAAE,MAAM;aACZ;SACD;QACD,eAAe,EAAE,CAAC,gBAAK,CAAC,IAAI,CAAC;QAC7B,uBAAuB,EAAE,OAAO;QAChC,kBAAkB,EAAE,OAAO;QAC3B,MAAM,EAAE,MAAM;QACd,uBAAuB,EAAE,OAAO;QAChC,gCAAgC,EAAE,OAAO;QACzC,aAAa,EAAE,OAAO;QACtB,gBAAgB,EAAE,OAAO;QACzB,iBAAiB,EAAE,CAAC,gBAAK,CAAC,IAAI,CAAC;QAC/B,iBAAiB,EAAE,OAAO;QAC1B,MAAM,EAAE,MAAM;QACd,4BAA4B,EAAE,OAAO;QACrC,KAAK,EAAE,MAAM;QACb,eAAe,EAAE,MAAM;KACvB;IAED,QAAQ,EAAE;QACT,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,CAAC,mBAAQ,CAAC;QACtB,aAAa,EAAE,qBAAY;KAC3B;CACD,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,SAAS,GAAG,kBAAE,CAAC,KAAK,CAAe,MAAM,EAAE,kBAAU,EAAE,OAAO,CAAC,CAAC"}
|
6
dist/util/Database.d.ts
vendored
6
dist/util/Database.d.ts
vendored
@ -22,8 +22,8 @@ export declare class MongooseCache extends EventEmitter {
|
|||||||
constructor(collection: Collection, pipeline: Array<Record<string, unknown>>, opts: {
|
constructor(collection: Collection, pipeline: Array<Record<string, unknown>>, opts: {
|
||||||
onlyEvents: boolean;
|
onlyEvents: boolean;
|
||||||
});
|
});
|
||||||
init(): Promise<void>;
|
init: () => Promise<void>;
|
||||||
convertResult(obj: any): any;
|
convertResult: (obj: any) => any;
|
||||||
change: (doc: ChangeEvent) => boolean | Promise<any> | undefined;
|
change: (doc: ChangeEvent) => boolean | Promise<any> | undefined;
|
||||||
destroy(): Promise<any> | undefined;
|
destroy: () => Promise<any> | undefined;
|
||||||
}
|
}
|
||||||
|
105
dist/util/Database.js
vendored
105
dist/util/Database.js
vendored
@ -17,58 +17,63 @@ class MongooseCache extends events_1.default {
|
|||||||
this.collection = collection;
|
this.collection = collection;
|
||||||
this.pipeline = pipeline;
|
this.pipeline = pipeline;
|
||||||
this.opts = opts;
|
this.opts = opts;
|
||||||
this.change = (doc) => {
|
this.init = async () => {
|
||||||
// @ts-ignore
|
this.stream = this.collection.watch(this.pipeline, { fullDocument: "updateLookup" });
|
||||||
if (doc.fullDocument) {
|
this.stream.on("change", this.change);
|
||||||
// @ts-ignore
|
this.stream.on("close", this.destroy);
|
||||||
if (!this.opts.onlyEvents)
|
this.stream.on("error", console.error);
|
||||||
this.data = doc.fullDocument;
|
if (!this.opts.onlyEvents) {
|
||||||
}
|
const arr = await this.collection.aggregate(this.pipeline).toArray();
|
||||||
switch (doc.operationType) {
|
this.data = arr.length ? arr[0] : arr;
|
||||||
case "dropDatabase":
|
|
||||||
return this.destroy();
|
|
||||||
case "drop":
|
|
||||||
return this.destroy();
|
|
||||||
case "delete":
|
|
||||||
return this.emit("delete", doc.documentKey._id.toHexString());
|
|
||||||
case "insert":
|
|
||||||
return this.emit("insert", doc.fullDocument);
|
|
||||||
case "update":
|
|
||||||
case "replace":
|
|
||||||
return this.emit("change", doc.fullDocument);
|
|
||||||
case "invalidate":
|
|
||||||
return this.destroy();
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
this.convertResult = (obj) => {
|
||||||
async init() {
|
if (obj instanceof mongodb_1.Long)
|
||||||
this.stream = this.collection.watch(this.pipeline, { fullDocument: "updateLookup" });
|
return BigInt(obj.toString());
|
||||||
this.stream.on("change", this.change);
|
if (typeof obj === "object") {
|
||||||
this.stream.on("close", this.destroy);
|
Object.keys(obj).forEach((key) => {
|
||||||
this.stream.on("error", console.error);
|
obj[key] = this.convertResult(obj[key]);
|
||||||
if (!this.opts.onlyEvents) {
|
});
|
||||||
const arr = await this.collection.aggregate(this.pipeline).toArray();
|
}
|
||||||
this.data = arr.length ? arr[0] : arr;
|
return obj;
|
||||||
}
|
};
|
||||||
}
|
this.change = (doc) => {
|
||||||
convertResult(obj) {
|
try {
|
||||||
if (obj instanceof mongodb_1.Long)
|
// @ts-ignore
|
||||||
return BigInt(obj.toString());
|
if (doc.fullDocument) {
|
||||||
if (typeof obj === "object") {
|
// @ts-ignore
|
||||||
Object.keys(obj).forEach((key) => {
|
if (!this.opts.onlyEvents)
|
||||||
obj[key] = this.convertResult(obj[key]);
|
this.data = doc.fullDocument;
|
||||||
});
|
}
|
||||||
}
|
switch (doc.operationType) {
|
||||||
return obj;
|
case "dropDatabase":
|
||||||
}
|
return this.destroy();
|
||||||
destroy() {
|
case "drop":
|
||||||
this.stream.off("change", this.change);
|
return this.destroy();
|
||||||
this.emit("close");
|
case "delete":
|
||||||
if (this.stream.isClosed())
|
return this.emit("delete", doc.documentKey._id.toHexString());
|
||||||
return;
|
case "insert":
|
||||||
return this.stream.close();
|
return this.emit("insert", doc.fullDocument);
|
||||||
|
case "update":
|
||||||
|
case "replace":
|
||||||
|
return this.emit("change", doc.fullDocument);
|
||||||
|
case "invalidate":
|
||||||
|
return this.destroy();
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
this.emit("error", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.destroy = () => {
|
||||||
|
this.stream?.off("change", this.change);
|
||||||
|
this.emit("close");
|
||||||
|
if (this.stream.isClosed())
|
||||||
|
return;
|
||||||
|
return this.stream.close();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.MongooseCache = MongooseCache;
|
exports.MongooseCache = MongooseCache;
|
||||||
|
2
dist/util/Database.js.map
vendored
2
dist/util/Database.js.map
vendored
@ -1 +1 @@
|
|||||||
{"version":3,"file":"Database.js","sourceRoot":"","sources":["../../src/util/Database.ts"],"names":[],"mappings":";;;;;;AAAA,yBAAuB;AACvB,wDAA4D;AAC5D,qCAA0D;AAC1D,oDAAkC;AAClC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,sEAAsE,CAAC;AAE5G,MAAM,UAAU,GAAG,kBAAQ,CAAC,gBAAgB,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAEvE,kBAA2B,UAAU,CAAC;AAStC,MAAa,aAAc,SAAQ,gBAAY;IAI9C,YACQ,UAAsB,EACtB,QAAwC,EACxC,IAEN;QAED,KAAK,EAAE,CAAC;QAND,eAAU,GAAV,UAAU,CAAY;QACtB,aAAQ,GAAR,QAAQ,CAAgC;QACxC,SAAI,GAAJ,IAAI,CAEV;QA6BF,WAAM,GAAG,CAAC,GAAgB,EAAE,EAAE;YAC7B,aAAa;YACb,IAAI,GAAG,CAAC,YAAY,EAAE;gBACrB,aAAa;gBACb,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU;oBAAE,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,YAAY,CAAC;aACxD;YAED,QAAQ,GAAG,CAAC,aAAa,EAAE;gBAC1B,KAAK,cAAc;oBAClB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;gBACvB,KAAK,MAAM;oBACV,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;gBACvB,KAAK,QAAQ;oBACZ,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;gBAC/D,KAAK,QAAQ;oBACZ,OAAO,IAAI,CAAC,IAAI,CAAC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B,KAAK,cAAc;wBAClB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;oBACvB,KAAK,MAAM;wBACV,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;oBACvB,KAAK,QAAQ;wBACZ,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;oBAC/D,KAAK,QAAQ;wBACZ,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;oBAC9C,KAAK,QAAQ,CAAC;oBACd,KAAK,SAAS;wBACb,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;oBAC9C,KAAK,YAAY;wBAChB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;oBACvB;wBACC,OAAO;iBACR;aACD;YAAC,OAAO,KAAK,EAAE;gBACf,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;aAC1B;QACF,CAAC,CAAC;QAEF,YAAO,GAAG,GAAG,EAAE;YACd,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACxC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAEnB,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;gBAAE,OAAO;YAEnC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAC5B,CAAC,CAAC;IA/DF,CAAC;CAgED;AA5ED,sCA4EC"}
|
4
dist/util/Permissions.js
vendored
4
dist/util/Permissions.js
vendored
@ -96,7 +96,9 @@ async function getPermission(user_id, guild_id, channel_id, cache) {
|
|||||||
member = await Member_1.MemberModel.findOne({ guild_id, id: user_id }, "roles").exec();
|
member = await Member_1.MemberModel.findOne({ guild_id, id: user_id }, "roles").exec();
|
||||||
if (!member)
|
if (!member)
|
||||||
throw new Error("Member not found");
|
throw new Error("Member not found");
|
||||||
var roles = await Role_1.RoleModel.find({ guild_id, id: { $in: member.roles } }).exec();
|
var roles = await Role_1.RoleModel.find({ guild_id, id: { $in: member.roles } })
|
||||||
|
.lean()
|
||||||
|
.exec();
|
||||||
if (channel_id) {
|
if (channel_id) {
|
||||||
channel = await Channel_1.ChannelModel.findOne({ id: channel_id }, "permission_overwrites").exec();
|
channel = await Channel_1.ChannelModel.findOne({ id: channel_id }, "permission_overwrites").exec();
|
||||||
}
|
}
|
||||||
|
2
dist/util/Permissions.js.map
vendored
2
dist/util/Permissions.js.map
vendored
@ -1 +1 @@
|
|||||||
{"version":3,"file":"Permissions.js","sourceRoot":"","sources":["../../src/util/Permissions.ts"],"names":[],"mappings":";;;AAAA,8EAA8E;AAC9E,8DAA8D;AAC9D,6CAA+D;AAC/D,+CAAkE;AAElE,yCAAiD;AACjD,yCAAsC;AACtC,2CAA4D;AAqC5D,MAAM,wBAAwB,GAAG,EAAE,IAAI,GAAG,CAAC,CAAC,qEAAqE;AAEjH,MAAa,WAAY,SAAQ,mBAAQ;IA0CxC,GAAG,CAAC,UAAgC,EAAE,UAAU,GAAG,IAAI;QACtD,OAAO,CAAC,UAAU,IAAI,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC5F,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,UAAgC,EAAE,UAAU,GAAG,IAAI;QACtD,OAAO,CAAC,UAAU,IAAI,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC5F,CAAC;IAED,MAAM,CAAC,iBAAiB,CAAC,UAAwC,EAAE,IAAa;QAC/E,6CAA6C;QAC7C,OAAO,UAAU,CAAC,MAAM,CAAC,CAA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
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
async init() {
|
init = async () => {
|
||||||
this.stream = this.collection.watch(this.pipeline, { fullDocument: "updateLookup" });
|
this.stream = this.collection.watch(this.pipeline, { fullDocument: "updateLookup" });
|
||||||
|
|
||||||
this.stream.on("change", this.change);
|
this.stream.on("change", this.change);
|
||||||
@ -40,9 +40,9 @@ export class MongooseCache extends EventEmitter {
|
|||||||
const arr = await this.collection.aggregate(this.pipeline).toArray();
|
const arr = await this.collection.aggregate(this.pipeline).toArray();
|
||||||
this.data = arr.length ? arr[0] : arr;
|
this.data = arr.length ? arr[0] : arr;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
convertResult(obj: any) {
|
convertResult = (obj: any) => {
|
||||||
if (obj instanceof Long) return BigInt(obj.toString());
|
if (obj instanceof Long) return BigInt(obj.toString());
|
||||||
if (typeof obj === "object") {
|
if (typeof obj === "object") {
|
||||||
Object.keys(obj).forEach((key) => {
|
Object.keys(obj).forEach((key) => {
|
||||||
@ -51,40 +51,44 @@ export class MongooseCache extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
};
|
||||||
|
|
||||||
change = (doc: ChangeEvent) => {
|
change = (doc: ChangeEvent) => {
|
||||||
// @ts-ignore
|
try {
|
||||||
if (doc.fullDocument) {
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
if (!this.opts.onlyEvents) this.data = doc.fullDocument;
|
if (doc.fullDocument) {
|
||||||
}
|
// @ts-ignore
|
||||||
|
if (!this.opts.onlyEvents) this.data = doc.fullDocument;
|
||||||
|
}
|
||||||
|
|
||||||
switch (doc.operationType) {
|
switch (doc.operationType) {
|
||||||
case "dropDatabase":
|
case "dropDatabase":
|
||||||
return this.destroy();
|
return this.destroy();
|
||||||
case "drop":
|
case "drop":
|
||||||
return this.destroy();
|
return this.destroy();
|
||||||
case "delete":
|
case "delete":
|
||||||
return this.emit("delete", doc.documentKey._id.toHexString());
|
return this.emit("delete", doc.documentKey._id.toHexString());
|
||||||
case "insert":
|
case "insert":
|
||||||
return this.emit("insert", doc.fullDocument);
|
return this.emit("insert", doc.fullDocument);
|
||||||
case "update":
|
case "update":
|
||||||
case "replace":
|
case "replace":
|
||||||
return this.emit("change", doc.fullDocument);
|
return this.emit("change", doc.fullDocument);
|
||||||
case "invalidate":
|
case "invalidate":
|
||||||
return this.destroy();
|
return this.destroy();
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
this.emit("error", error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
destroy() {
|
destroy = () => {
|
||||||
this.stream.off("change", this.change);
|
this.stream?.off("change", this.change);
|
||||||
this.emit("close");
|
this.emit("close");
|
||||||
|
|
||||||
if (this.stream.isClosed()) return;
|
if (this.stream.isClosed()) return;
|
||||||
|
|
||||||
return this.stream.close();
|
return this.stream.close();
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,9 @@ export async function getPermission(
|
|||||||
member = await MemberModel.findOne({ guild_id, id: user_id }, "roles").exec();
|
member = await MemberModel.findOne({ guild_id, id: user_id }, "roles").exec();
|
||||||
if (!member) throw new Error("Member not found");
|
if (!member) throw new Error("Member not found");
|
||||||
|
|
||||||
var roles = await RoleModel.find({ guild_id, id: { $in: member.roles } }).exec();
|
var roles = await RoleModel.find({ guild_id, id: { $in: member.roles } })
|
||||||
|
.lean()
|
||||||
|
.exec();
|
||||||
if (channel_id) {
|
if (channel_id) {
|
||||||
channel = await ChannelModel.findOne({ id: channel_id }, "permission_overwrites").exec();
|
channel = await ChannelModel.findOne({ id: channel_id }, "permission_overwrites").exec();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user