diff --git a/src/models/Activity.ts b/src/models/Activity.ts
index bf77856f..340590c4 100644
--- a/src/models/Activity.ts
+++ b/src/models/Activity.ts
@@ -4,7 +4,7 @@ import { Schema, model, Types, Document } from "mongoose";
export interface Presence {
user: User;
- guild_id?: bigint;
+ guild_id?: string;
status: Status;
activities: Activity[];
client_status: ClientStatus;
@@ -19,12 +19,12 @@ export interface Activity {
start?: number;
end?: number;
}[];
- application_id?: bigint;
+ application_id?: string;
details?: string;
state?: string;
emoji?: {
name: string;
- id?: bigint;
+ id?: string;
amimated?: boolean;
};
party?: {
@@ -57,12 +57,12 @@ export const Activity = {
$end: Number,
},
],
- $application_id: Types.Long,
+ $application_id: String,
$details: String,
$state: String,
$emoji: {
$name: String,
- $id: Types.Long,
+ $id: String,
$amimated: Boolean,
},
$party: {
diff --git a/src/models/Application.ts b/src/models/Application.ts
index ea443dc9..4c519ff2 100644
--- a/src/models/Application.ts
+++ b/src/models/Application.ts
@@ -1,6 +1,6 @@
export interface ApplicationCommand {
- id: bigint;
- application_id: bigint;
+ id: string;
+ application_id: string;
name: string;
description: string;
options?: ApplicationCommandOption[];
@@ -32,7 +32,7 @@ export enum ApplicationCommandOptionType {
}
export interface ApplicationCommandInteractionData {
- id: bigint;
+ id: string;
name: string;
options?: ApplicationCommandInteractionDataOption[];
}
diff --git a/src/models/AuditLog.ts b/src/models/AuditLog.ts
index a0f91a82..c1f83c13 100644
--- a/src/models/AuditLog.ts
+++ b/src/models/AuditLog.ts
@@ -11,17 +11,17 @@ export interface AuditLogResponse {
}
export interface AuditLogEntries {
- target_id?: bigint;
- user_id: bigint;
- id: bigint;
+ target_id?: string;
+ user_id: string;
+ id: string;
action_type: AuditLogEvents;
options?: {
delete_member_days?: string;
members_removed?: string;
- channel_id?: bigint;
- messaged_id?: bigint;
+ channel_id?: string;
+ messaged_id?: string;
count?: string;
- id?: bigint;
+ id?: string;
type?: string;
role_name?: string;
};
@@ -42,13 +42,13 @@ export interface AuditLogChangeValue {
splash_hash?: string;
discovery_splash_hash?: string;
banner_hash?: string;
- owner_id?: bigint;
+ owner_id?: string;
region?: string;
preferred_locale?: string;
- afk_channel_id?: bigint;
+ afk_channel_id?: string;
afk_timeout?: number;
- rules_channel_id?: bigint;
- public_updates_channel_id?: bigint;
+ rules_channel_id?: string;
+ public_updates_channel_id?: string;
mfa_level?: number;
verification_level?: number;
explicit_content_filter?: number;
@@ -58,14 +58,14 @@ export interface AuditLogChangeValue {
$remove?: {}[];
prune_delete_days?: number;
widget_enabled?: boolean;
- widget_channel_id?: bigint;
- system_channel_id?: bigint;
+ widget_channel_id?: string;
+ system_channel_id?: string;
position?: number;
topic?: string;
bitrate?: number;
permission_overwrites?: ChannelPermissionOverwrite[];
nsfw?: boolean;
- application_id?: bigint;
+ application_id?: string;
rate_limit_per_user?: number;
permissions?: string;
color?: number;
@@ -74,8 +74,8 @@ export interface AuditLogChangeValue {
allow?: string;
deny?: string;
code?: string;
- channel_id?: bigint;
- inviter_id?: bigint;
+ channel_id?: string;
+ inviter_id?: string;
max_uses?: number;
uses?: number;
max_age?: number;
@@ -84,7 +84,7 @@ export interface AuditLogChangeValue {
mute?: boolean;
nick?: string;
avatar_hash?: string;
- id?: bigint;
+ id?: string;
type?: number;
enable_emoticons?: boolean;
expire_behavior?: number;
@@ -93,7 +93,7 @@ export interface AuditLogChangeValue {
}
export interface AuditLogEntriesDocument extends Document, AuditLogEntries {
- id: bigint;
+ id: string;
}
export const AuditLogChanges = {
@@ -103,13 +103,13 @@ export const AuditLogChanges = {
splash_hash: String,
discovery_splash_hash: String,
banner_hash: String,
- owner_id: Types.Long,
+ owner_id: String,
region: String,
preferred_locale: String,
- afk_channel_id: Types.Long,
+ afk_channel_id: String,
afk_timeout: Number,
- rules_channel_id: Types.Long,
- public_updates_channel_id: Types.Long,
+ rules_channel_id: String,
+ public_updates_channel_id: String,
mfa_level: Number,
verification_level: Number,
explicit_content_filter: Number,
@@ -119,14 +119,14 @@ export const AuditLogChanges = {
$remove: [{}],
prune_delete_days: Number,
widget_enabled: Boolean,
- widget_channel_id: Types.Long,
- system_channel_id: Types.Long,
+ widget_channel_id: String,
+ system_channel_id: String,
position: Number,
topic: String,
bitrate: Number,
permission_overwrites: [{}],
nsfw: Boolean,
- application_id: Types.Long,
+ application_id: String,
rate_limit_per_user: Number,
permissions: String,
color: Number,
@@ -135,8 +135,8 @@ export const AuditLogChanges = {
allow: String,
deny: String,
code: String,
- channel_id: Types.Long,
- inviter_id: Types.Long,
+ channel_id: String,
+ inviter_id: String,
max_uses: Number,
uses: Number,
max_age: Number,
@@ -145,7 +145,7 @@ export const AuditLogChanges = {
mute: Boolean,
nick: String,
avatar_hash: String,
- id: Types.Long,
+ id: String,
type: Number,
enable_emoticons: Boolean,
expire_behavior: Number,
@@ -154,17 +154,17 @@ export const AuditLogChanges = {
};
export const AuditLogSchema = new Schema({
- target_id: Types.Long,
- user_id: { type: Types.Long, required: true },
- id: { type: Types.Long, required: true },
+ target_id: String,
+ user_id: { type: String, required: true },
+ id: { type: String, required: true },
action_type: { type: Number, required: true },
options: {
delete_member_days: String,
members_removed: String,
- channel_id: Types.Long,
- messaged_id: Types.Long,
+ channel_id: String,
+ messaged_id: String,
count: String,
- id: Types.Long,
+ id: String,
type: String,
role_name: String,
},
diff --git a/src/models/Ban.ts b/src/models/Ban.ts
index 8fc3b124..27893029 100644
--- a/src/models/Ban.ts
+++ b/src/models/Ban.ts
@@ -2,17 +2,17 @@ import { Schema, model, Types, Document } from "mongoose";
import db from "../util/Database";
export interface Ban extends Document {
- user_id: bigint;
- guild_id: bigint;
- executor_id: bigint;
+ user_id: string;
+ guild_id: string;
+ executor_id: string;
ip: string;
reason?: string;
}
export const BanSchema = new Schema({
- user_id: { type: Types.Long, required: true },
- guild_id: { type: Types.Long, required: true },
- executor_id: { type: Types.Long, required: true },
+ user_id: { type: String, required: true },
+ guild_id: { type: String, required: true },
+ executor_id: { type: String, required: true },
reason: String,
ip: String, // ? Should we store this in here, or in the UserModel?
});
diff --git a/src/models/Channel.ts b/src/models/Channel.ts
index bf03c939..82ad2999 100644
--- a/src/models/Channel.ts
+++ b/src/models/Channel.ts
@@ -4,20 +4,20 @@ import db from "../util/Database";
export interface AnyChannel extends Channel, DMChannel, TextChannel, VoiceChannel {}
export interface ChannelDocument extends Document, AnyChannel {
- id: bigint;
+ id: string;
}
export const ChannelSchema = new Schema({
- id: Types.Long,
+ id: String,
created_at: { type: Schema.Types.Date, required: true },
name: { type: String, required: true },
type: { type: Number, required: true },
- guild_id: Types.Long,
- owner_id: Types.Long,
- parent_id: Types.Long,
- recipients: [Types.Long],
+ guild_id: String,
+ owner_id: String,
+ parent_id: String,
+ recipients: [String],
position: Number,
- last_message_id: Types.Long,
+ last_message_id: String,
last_pin_timestamp: Date,
nsfw: Boolean,
rate_limit_per_user: Number,
@@ -26,7 +26,7 @@ export const ChannelSchema = new Schema({
{
allow: Types.Long,
deny: Types.Long,
- id: Types.Long,
+ id: String,
type: Number,
},
],
@@ -36,28 +36,28 @@ export const ChannelSchema = new Schema({
export const ChannelModel = db.model<ChannelDocument>("Channel", ChannelSchema, "channels");
export interface Channel {
- id: bigint;
+ id: string;
created_at: Date;
name: string;
type: number;
}
export interface TextBasedChannel {
- last_message_id?: bigint;
+ last_message_id?: string;
last_pin_timestamp?: number;
}
export interface GuildChannel extends Channel {
- guild_id: bigint;
+ guild_id: string;
position: number;
- parent_id?: bigint;
+ parent_id?: string;
permission_overwrites: ChannelPermissionOverwrite[];
}
export interface ChannelPermissionOverwrite {
- allow: bigint;
- deny: bigint;
- id: bigint;
+ allow: bigint; // for bitfields we use bigints
+ deny: bigint; // for bitfields we use bigints
+ id: string;
type: ChannelPermissionOverwriteType;
}
@@ -75,8 +75,8 @@ export interface TextChannel extends GuildChannel, TextBasedChannel {
}
export interface DMChannel extends Channel, TextBasedChannel {
- owner_id: bigint;
- recipients: bigint[];
+ owner_id: string;
+ recipients: string[];
}
export enum ChannelType {
diff --git a/src/models/Emoji.ts b/src/models/Emoji.ts
index 530c2cc7..3e5cad53 100644
--- a/src/models/Emoji.ts
+++ b/src/models/Emoji.ts
@@ -2,27 +2,27 @@ import { Schema, model, Types, Document } from "mongoose";
import db from "../util/Database";
export interface Emoji extends Document {
- id: bigint;
+ id: string;
animated: boolean;
available: boolean;
- guild_id: bigint;
+ guild_id: string;
managed: boolean;
name: string;
require_colons: boolean;
url: string;
- roles: bigint[]; // roles this emoji is whitelisted to
+ roles: string[]; // roles this emoji is whitelisted to (new discord feature?)
}
export const EmojiSchema = new Schema({
- id: { type: Types.Long, required: true },
+ id: { type: String, required: true },
animated: Boolean,
available: Boolean,
- guild_id: Types.Long,
+ guild_id: String,
managed: Boolean,
name: String,
require_colons: Boolean,
url: String,
- roles: [Types.Long],
+ roles: [String],
});
// @ts-ignore
diff --git a/src/models/Event.ts b/src/models/Event.ts
index 97da98c0..9a5b5283 100644
--- a/src/models/Event.ts
+++ b/src/models/Event.ts
@@ -14,9 +14,9 @@ import { Schema, model, Types, Document } from "mongoose";
import db from "../util/Database";
export interface Event {
- guild_id?: bigint;
- user_id?: bigint;
- channel_id?: bigint;
+ guild_id?: string;
+ user_id?: string;
+ channel_id?: string;
created_at?: Date;
event: EVENT;
data?: any;
@@ -25,9 +25,9 @@ export interface Event {
export interface EventDocument extends Event, Document {}
export const EventSchema = new Schema({
- guild_id: Types.Long,
- user_id: Types.Long,
- channel_id: Types.Long,
+ guild_id: String,
+ user_id: String,
+ channel_id: String,
created_at: { type: Date, required: true },
event: { type: String, required: true },
data: Object,
@@ -98,7 +98,7 @@ export interface ReadyEventData {
partial: boolean;
};
application?: {
- id: bigint;
+ id: string;
flags: bigint;
};
merged_members?: Omit<Member, "settings" | "user">[][];
@@ -106,7 +106,7 @@ export interface ReadyEventData {
users?: {
avatar?: string;
discriminator: string;
- id: bigint;
+ id: string;
username: string;
bot: boolean;
public_flags: bigint;
@@ -136,8 +136,8 @@ export interface ChannelDeleteEvent extends Event {
export interface ChannelPinsUpdateEvent extends Event {
event: "CHANNEL_PINS_UPDATE";
data: {
- guild_id?: bigint;
- channel_id: bigint;
+ guild_id?: string;
+ channel_id: string;
last_pin_timestamp: number;
};
}
@@ -155,7 +155,7 @@ export interface GuildUpdateEvent extends Event {
export interface GuildDeleteEvent extends Event {
event: "GUILD_DELETE";
data: {
- id: bigint;
+ id: string;
unavailable?: boolean;
};
}
@@ -163,7 +163,7 @@ export interface GuildDeleteEvent extends Event {
export interface GuildBanAddEvent extends Event {
event: "GUILD_BAN_ADD";
data: {
- guild_id: bigint;
+ guild_id: string;
user: User;
};
}
@@ -171,7 +171,7 @@ export interface GuildBanAddEvent extends Event {
export interface GuildBanRemoveEvent extends Event {
event: "GUILD_BAN_REMOVE";
data: {
- guild_id: bigint;
+ guild_id: string;
user: User;
};
}
@@ -179,7 +179,7 @@ export interface GuildBanRemoveEvent extends Event {
export interface GuildEmojiUpdateEvent extends Event {
event: "GUILD_EMOJI_UPDATE";
data: {
- guild_id: bigint;
+ guild_id: string;
emojis: Emoji[];
};
}
@@ -187,21 +187,21 @@ export interface GuildEmojiUpdateEvent extends Event {
export interface GuildIntegrationUpdateEvent extends Event {
event: "GUILD_INTEGRATIONS_UPDATE";
data: {
- guild_id: bigint;
+ guild_id: string;
};
}
export interface GuildMemberAddEvent extends Event {
event: "GUILD_MEMBER_ADD";
data: PublicMember & {
- guild_id: bigint;
+ guild_id: string;
};
}
export interface GuildMemberRemoveEvent extends Event {
event: "GUILD_MEMBER_REMOVE";
data: {
- guild_id: bigint;
+ guild_id: string;
user: User;
};
}
@@ -209,8 +209,8 @@ export interface GuildMemberRemoveEvent extends Event {
export interface GuildMemberUpdateEvent extends Event {
event: "GUILD_MEMBER_UPDATE";
data: {
- guild_id: bigint;
- roles: bigint[];
+ guild_id: string;
+ roles: string[];
user: User;
nick?: string;
joined_at: Date;
@@ -222,11 +222,11 @@ export interface GuildMemberUpdateEvent extends Event {
export interface GuildMembersChunkEvent extends Event {
event: "GUILD_MEMBERS_CHUNK";
data: {
- guild_id: bigint;
+ guild_id: string;
members: PublicMember[];
chunk_index: number;
chunk_count: number;
- not_found: bigint[];
+ not_found: string[];
presences: Presence[];
nonce?: string;
};
@@ -235,7 +235,7 @@ export interface GuildMembersChunkEvent extends Event {
export interface GuildRoleCreateEvent extends Event {
event: "GUILD_ROLE_CREATE";
data: {
- guild_id: bigint;
+ guild_id: string;
role: Role;
};
}
@@ -243,7 +243,7 @@ export interface GuildRoleCreateEvent extends Event {
export interface GuildRoleUpdateEvent extends Event {
event: "GUILD_ROLE_UPDATE";
data: {
- guild_id: bigint;
+ guild_id: string;
role: Role;
};
}
@@ -251,31 +251,31 @@ export interface GuildRoleUpdateEvent extends Event {
export interface GuildRoleDeleteEvent extends Event {
event: "GUILD_ROLE_DELETE";
data: {
- guild_id: bigint;
- role_id: bigint;
+ guild_id: string;
+ role_id: string;
};
}
export interface InviteCreateEvent extends Event {
event: "INVITE_CREATE";
data: Omit<Invite, "guild" | "channel"> & {
- channel_id: bigint;
- guild_id?: bigint;
+ channel_id: string;
+ guild_id?: string;
};
}
export interface InviteDeleteEvent extends Event {
event: "INVITE_DELETE";
data: {
- channel_id: bigint;
- guild_id?: bigint;
+ channel_id: string;
+ guild_id?: string;
code: string;
};
}
export type MessagePayload = Omit<Message, "author_id"> & {
- channel_id: bigint;
- guild_id?: bigint;
+ channel_id: string;
+ guild_id?: string;
author: User;
member: PublicMember;
mentions: (User & { member: PublicMember })[];
@@ -294,28 +294,28 @@ export interface MessageUpdateEvent extends Event {
export interface MessageDeleteEvent extends Event {
event: "MESSAGE_DELETE";
data: {
- id: bigint;
- channel_id: bigint;
- guild_id?: bigint;
+ id: string;
+ channel_id: string;
+ guild_id?: string;
};
}
export interface MessageDeleteBulkEvent extends Event {
event: "MESSAGE_DELETE_BULK";
data: {
- ids: bigint[];
- channel_id: bigint;
- guild_id?: bigint;
+ ids: string[];
+ channel_id: string;
+ guild_id?: string;
};
}
export interface MessageReactionAddEvent extends Event {
event: "MESSAGE_REACTION_ADD";
data: {
- user_id: bigint;
- channel_id: bigint;
- message_id: bigint;
- guild_id?: bigint;
+ user_id: string;
+ channel_id: string;
+ message_id: string;
+ guild_id?: string;
member?: PublicMember;
emoji: PartialEmoji;
};
@@ -324,10 +324,10 @@ export interface MessageReactionAddEvent extends Event {
export interface MessageReactionRemoveEvent extends Event {
event: "MESSAGE_REACTION_REMOVE";
data: {
- user_id: bigint;
- channel_id: bigint;
- message_id: bigint;
- guild_id?: bigint;
+ user_id: string;
+ channel_id: string;
+ message_id: string;
+ guild_id?: string;
emoji: PartialEmoji;
};
}
@@ -335,18 +335,18 @@ export interface MessageReactionRemoveEvent extends Event {
export interface MessageReactionRemoveAllEvent extends Event {
event: "MESSAGE_REACTION_REMOVE_ALL";
data: {
- channel_id: bigint;
- message_id: bigint;
- guild_id?: bigint;
+ channel_id: string;
+ message_id: string;
+ guild_id?: string;
};
}
export interface MessageReactionRemoveEmojiEvent extends Event {
event: "MESSAGE_REACTION_REMOVE_EMOJI";
data: {
- channel_id: bigint;
- message_id: bigint;
- guild_id?: bigint;
+ channel_id: string;
+ message_id: string;
+ guild_id?: string;
emoji: PartialEmoji;
};
}
@@ -359,10 +359,10 @@ export interface PresenceUpdateEvent extends Event {
export interface TypingStartEvent extends Event {
event: "TYPING_START";
data: {
- channel_id: bigint;
- user_id: bigint;
+ channel_id: string;
+ user_id: string;
timestamp: number;
- guild_id?: bigint;
+ guild_id?: string;
member?: PublicMember;
};
}
@@ -383,7 +383,7 @@ export interface VoiceServerUpdateEvent extends Event {
event: "VOICE_SERVER_UPDATE";
data: {
token: string;
- guild_id: bigint;
+ guild_id: string;
endpoint: string;
};
}
@@ -391,13 +391,13 @@ export interface VoiceServerUpdateEvent extends Event {
export interface WebhooksUpdateEvent extends Event {
event: "WEBHOOKS_UPDATE";
data: {
- guild_id: bigint;
- channel_id: bigint;
+ guild_id: string;
+ channel_id: string;
};
}
export type ApplicationCommandPayload = ApplicationCommand & {
- guild_id: bigint;
+ guild_id: string;
};
export interface ApplicationCommandCreateEvent extends Event {
diff --git a/src/models/Guild.ts b/src/models/Guild.ts
index a92a60cf..d3f098ea 100644
--- a/src/models/Guild.ts
+++ b/src/models/Guild.ts
@@ -6,14 +6,14 @@ import { MemberModel } from "./Member";
import { RoleModel } from "./Role";
export interface GuildDocument extends Document, Guild {
- id: bigint;
+ id: string;
}
export interface Guild {
- id: bigint;
- afk_channel_id?: bigint;
+ id: string;
+ afk_channel_id?: string;
afk_timeout?: number;
- application_id?: bigint;
+ application_id?: string;
banner?: string;
default_message_notifications?: number;
description?: string;
@@ -34,29 +34,29 @@ export interface Guild {
// voice_states: []; // * voice_states are stored in a seperate collection
mfa_level?: number;
name: string;
- owner_id: bigint;
+ owner_id: string;
preferred_locale?: string; // only community guilds can choose this
premium_subscription_count?: number;
premium_tier?: number; // nitro boost level
- public_updates_channel_id?: bigint;
+ public_updates_channel_id?: string;
region?: string;
- rules_channel_id?: bigint;
+ rules_channel_id?: string;
splash?: string;
system_channel_flags?: number;
- system_channel_id?: bigint;
+ system_channel_id?: string;
unavailable?: boolean;
vanity_url_code?: string;
verification_level?: number;
welcome_screen: []; // welcome splash screen if a user joins guild
- widget_channel_id?: bigint;
+ widget_channel_id?: string;
widget_enabled?: boolean;
}
export const GuildSchema = new Schema({
- id: { type: Types.Long, required: true },
- afk_channel_id: Types.Long,
+ id: { type: String, required: true },
+ afk_channel_id: String,
afk_timeout: Number,
- application_id: Types.Long,
+ application_id: String,
banner: String,
default_message_notifications: Number,
description: String,
@@ -72,22 +72,22 @@ export const GuildSchema = new Schema({
presence_count: Number,
mfa_level: Number,
name: { type: String, required: true },
- owner_id: { type: Types.Long, required: true },
+ owner_id: { type: String, required: true },
preferred_locale: String,
premium_subscription_count: Number,
premium_tier: Number,
- public_updates_channel_id: Types.Long,
+ public_updates_channel_id: String,
region: String,
- rules_channel_id: Types.Long,
+ rules_channel_id: String,
splash: String,
system_channel_flags: Number,
- system_channel_id: Types.Long,
+ system_channel_id: String,
unavailable: Boolean,
vanity_url_code: String,
verification_level: Number,
voice_states: { type: [Object], default: [] },
welcome_screen: { type: [Object], default: [] },
- widget_channel_id: Types.Long,
+ widget_channel_id: String,
widget_enabled: Boolean,
});
diff --git a/src/models/Interaction.ts b/src/models/Interaction.ts
index 6f36c14a..764247a5 100644
--- a/src/models/Interaction.ts
+++ b/src/models/Interaction.ts
@@ -1,12 +1,12 @@
import { AllowedMentions, Embed } from "./Message";
export interface Interaction {
- id: bigint;
+ id: string;
type: InteractionType;
data?: {};
- guild_id: bigint;
- channel_id: bigint;
- member_id: bigint;
+ guild_id: string;
+ channel_id: string;
+ member_id: string;
token: string;
version: number;
}
diff --git a/src/models/Invite.ts b/src/models/Invite.ts
index fc60b93c..590a4598 100644
--- a/src/models/Invite.ts
+++ b/src/models/Invite.ts
@@ -8,14 +8,13 @@ export interface Invite extends Document {
max_uses: number;
max_age: number;
created_at: Date;
- guild_id: bigint;
- channel_id: bigint;
- inviter_id: bigint;
+ guild_id: string;
+ channel_id: string;
+ inviter_id: string;
- //! What the fucking shit is this
- target_user_id?: bigint;
+ // ? What the fucking shit is this
+ target_user_id?: string;
target_user_type?: number;
- // !
}
export const InviteSchema = new Schema({
@@ -25,14 +24,13 @@ export const InviteSchema = new Schema({
max_uses: Number,
max_age: Number,
created_at: Date,
- guild_id: Types.Long,
- channel_id: Types.Long,
- inviter_id: Types.Long,
+ guild_id: String,
+ channel_id: String,
+ inviter_id: String,
- //! What the fucking shit is this
- target_user_id: Types.Long,
+ // ? What the fucking shit is this
+ target_user_id: String,
target_user_type: Number,
- // !
});
// @ts-ignore
diff --git a/src/models/Member.ts b/src/models/Member.ts
index 145b5df4..fc9d5b99 100644
--- a/src/models/Member.ts
+++ b/src/models/Member.ts
@@ -3,10 +3,10 @@ import { Schema, Types, Document } from "mongoose";
import db from "../util/Database";
export interface Member {
- id: bigint;
- guild_id: bigint;
+ id: string;
+ guild_id: string;
nick?: string;
- roles: bigint[];
+ roles: string[];
joined_at: Date;
premium_since?: number;
deaf: boolean;
@@ -17,12 +17,12 @@ export interface Member {
}
export interface MemberDocument extends Member, Document {
- id: bigint;
+ id: string;
}
export interface UserGuildSettings {
channel_overrides: {
- channel_id: bigint;
+ channel_id: string;
message_notifications: number;
mute_config: MuteConfig;
muted: boolean;
@@ -47,10 +47,10 @@ const MuteConfig = {
};
export const MemberSchema = new Schema({
- id: { type: Types.Long, required: true },
- guild_id: Types.Long,
+ id: { type: String, required: true },
+ guild_id: String,
nick: String,
- roles: [Types.Long],
+ roles: [String],
joined_at: Date,
premium_since: Number,
deaf: Boolean,
@@ -59,7 +59,7 @@ export const MemberSchema = new Schema({
settings: {
channel_overrides: [
{
- channel_id: Types.Long,
+ channel_id: String,
message_notifications: Number,
mute_config: MuteConfig,
muted: Boolean,
diff --git a/src/models/Message.ts b/src/models/Message.ts
index e80ec1f8..4adf8024 100644
--- a/src/models/Message.ts
+++ b/src/models/Message.ts
@@ -5,20 +5,20 @@ import { MemberModel } from "./Member";
import { RoleModel } from "./Role";
export interface Message {
- id: bigint;
- channel_id: bigint;
- guild_id?: bigint;
- author_id?: bigint;
- webhook_id?: bigint;
- application_id?: bigint;
+ id: string;
+ channel_id: string;
+ guild_id?: string;
+ author_id?: string;
+ webhook_id?: string;
+ application_id?: string;
content?: string;
timestamp: Date;
edited_timestamp?: Date;
tts?: boolean;
mention_everyone?: boolean;
- mention_user_ids: bigint[];
- mention_role_ids: bigint[];
- mention_channels_ids: bigint[];
+ mention_user_ids: string[];
+ mention_role_ids: string[];
+ mention_channels_ids: string[];
attachments: Attachment[];
embeds: Embed[];
reactions: Reaction[];
@@ -32,14 +32,14 @@ export interface Message {
flags?: bigint;
stickers?: [];
message_reference?: {
- message_id: bigint;
- channel_id?: bigint;
- guild_id?: bigint;
+ message_id: string;
+ channel_id?: string;
+ guild_id?: string;
};
}
export interface MessageDocument extends Document, Message {
- id: bigint;
+ id: string;
}
export enum MessageType {
@@ -63,7 +63,7 @@ export enum MessageType {
}
export interface Attachment {
- id: bigint; // attachment id
+ id: string; // attachment id
filename: string; // name of file attached
size: number; // size of file in bytes
url: string; // source url of file
@@ -118,20 +118,20 @@ export interface Reaction {
}
export interface PartialEmoji {
- id?: bigint;
+ id?: string;
name: string;
animated?: boolean;
}
export interface AllowedMentions {
parse?: ("users" | "roles" | "everyone")[];
- roles?: bigint[];
- users?: bigint[];
+ roles?: string[];
+ users?: string[];
replied_user?: boolean;
}
export const Attachment = {
- id: Types.Long, // attachment id
+ id: String, // attachment id
filename: String, // name of file attached
size: Number, // size of file in bytes
url: String, // source url of file
@@ -150,7 +150,7 @@ export const EmbedImage = {
const Reaction = {
count: Number,
emoji: {
- id: Types.Long,
+ id: String,
name: String,
animated: Boolean,
},
@@ -191,20 +191,20 @@ export const Embed = {
};
export const MessageSchema = new Schema({
- id: Types.Long,
- channel_id: Types.Long,
- author_id: Types.Long,
- webhook_id: Types.Long,
- guild_id: Types.Long,
- application_id: Types.Long,
+ id: String,
+ channel_id: String,
+ author_id: String,
+ webhook_id: String,
+ guild_id: String,
+ application_id: String,
content: String,
timestamp: Date,
edited_timestamp: Date,
tts: Boolean,
mention_everyone: Boolean,
- mention_user_ids: [Types.Long],
- mention_role_ids: [Types.Long],
- mention_channel_ids: [Types.Long],
+ mention_user_ids: [String],
+ mention_role_ids: [String],
+ mention_channel_ids: [String],
attachments: [Attachment],
embeds: [Embed],
reactions: [Reaction],
@@ -218,9 +218,9 @@ export const MessageSchema = new Schema({
flags: Types.Long,
stickers: [],
message_reference: {
- message_id: Types.Long,
- channel_id: Types.Long,
- guild_id: Types.Long,
+ message_id: String,
+ channel_id: String,
+ guild_id: String,
},
});
diff --git a/src/models/Role.ts b/src/models/Role.ts
index fe716593..adb75b0a 100644
--- a/src/models/Role.ts
+++ b/src/models/Role.ts
@@ -2,8 +2,8 @@ import { Schema, model, Types, Document } from "mongoose";
import db from "../util/Database";
export interface Role {
- id: bigint;
- guild_id: bigint;
+ id: string;
+ guild_id: string;
color: number;
hoist: boolean;
managed: boolean;
@@ -12,17 +12,17 @@ export interface Role {
permissions: bigint;
position: number;
tags?: {
- bot_id?: bigint;
+ bot_id?: string;
};
}
export interface RoleDocument extends Document, Role {
- id: bigint;
+ id: string;
}
export const RoleSchema = new Schema({
- id: Types.Long,
- guild_id: Types.Long,
+ id: String,
+ guild_id: String,
color: Number,
hoist: Boolean,
managed: Boolean,
@@ -31,7 +31,7 @@ export const RoleSchema = new Schema({
permissions: Types.Long,
position: Number,
tags: {
- bot_id: Types.Long,
+ bot_id: String,
},
});
diff --git a/src/models/User.ts b/src/models/User.ts
index 9f447d91..7173e9a3 100644
--- a/src/models/User.ts
+++ b/src/models/User.ts
@@ -4,7 +4,7 @@ import { Schema, Types, Document } from "mongoose";
import db from "../util/Database";
export interface User {
- id: bigint;
+ id: string;
username: string; // username max length 32, min 2
discriminator: string; // #0001 4 digit long string from #0001 - #9999
avatar: string | null; // hash of the user avatar
@@ -24,7 +24,7 @@ export interface User {
flags: bigint; // UserFlags
public_flags: bigint;
user_settings: UserSettings;
- guilds: bigint[]; // array of guild ids the user is part of
+ guilds: string[]; // array of guild ids the user is part of
user_data: UserData;
presence: {
status: Status;
@@ -43,11 +43,11 @@ export interface UserData {
}
export interface UserDocument extends User, Document {
- id: bigint;
+ id: string;
}
export interface PublicUser {
- id: bigint;
+ id: string;
discriminator: string;
username: string;
avatar?: string;
@@ -67,10 +67,10 @@ export interface ConnectedAccount {
}
export interface Relationship {
- id: bigint;
+ id: string;
nickname?: string;
type: number;
- user_id: bigint;
+ user_id: string;
}
export interface UserSettings {
@@ -81,7 +81,7 @@ export interface UserSettings {
contact_sync_enabled: boolean;
convert_emoticons: boolean;
custom_status: {
- emoji_id: bigint | null;
+ emoji_id: string | null;
emoji_name: string | null;
expires_at: number | null;
text: string | null;
@@ -98,11 +98,11 @@ export interface UserSettings {
guild_folders: // every top guild is displayed as a "folder"
{
color: number;
- guild_ids: bigint[];
+ guild_ids: string[];
id: number;
name: string;
}[];
- guild_positions: bigint[]; // guild ids ordered by position
+ guild_positions: string[]; // guild ids ordered by position
inline_attachment_media: boolean;
inline_embed_media: boolean;
locale: string; // en_US
@@ -110,7 +110,7 @@ export interface UserSettings {
native_phone_integration_enabled: boolean;
render_embeds: boolean;
render_reactions: boolean;
- restricted_guilds: bigint[];
+ restricted_guilds: string[];
show_current_game: boolean;
status: "online" | "offline" | "dnd" | "idle";
stream_notifications_enabled: boolean;
@@ -119,7 +119,7 @@ export interface UserSettings {
}
export const UserSchema = new Schema({
- id: Types.Long,
+ id: String,
username: String,
discriminator: String,
avatar: String,
@@ -138,17 +138,17 @@ export const UserSchema = new Schema({
email: String,
flags: Types.Long, // TODO: automatically convert Types.Long to BitField of UserFlags
public_flags: Types.Long,
- guilds: [Types.Long], // array of guild ids the user is part of
+ guilds: [String], // array of guild ids the user is part of
user_data: {
fingerprints: [String],
hash: String, // hash of the password, salt is saved in password (bcrypt)
valid_tokens_since: Date, // all tokens with a previous issue date are invalid
relationships: [
{
- id: Types.Long,
+ id: String,
nickname: String,
type: Number,
- user_id: Types.Long,
+ user_id: String,
},
],
connected_accounts: [
@@ -173,7 +173,7 @@ export const UserSchema = new Schema({
contact_sync_enabled: Boolean,
convert_emoticons: Boolean,
custom_status: {
- emoji_id: Types.Long,
+ emoji_id: String,
emoji_name: String,
expires_at: Number,
text: String,
@@ -191,12 +191,12 @@ export const UserSchema = new Schema({
guild_folders: [
{
color: Number,
- guild_ids: [Types.Long],
+ guild_ids: [String],
id: Number,
name: String,
},
],
- guild_positions: [Types.Long], // guild ids ordered by position
+ guild_positions: [String], // guild ids ordered by position
inline_attachment_media: Boolean,
inline_embed_media: Boolean,
locale: String, // en_US
@@ -204,7 +204,7 @@ export const UserSchema = new Schema({
native_phone_integration_enabled: Boolean,
render_embeds: Boolean,
render_reactions: Boolean,
- restricted_guilds: [Types.Long],
+ restricted_guilds: [String],
show_current_game: Boolean,
status: String,
stream_notifications_enabled: Boolean,
diff --git a/src/models/VoiceState.ts b/src/models/VoiceState.ts
index 30439feb..c1f90edd 100644
--- a/src/models/VoiceState.ts
+++ b/src/models/VoiceState.ts
@@ -3,9 +3,9 @@ import { Schema, model, Types, Document } from "mongoose";
import db from "../util/Database";
export interface VoiceState extends Document {
- guild_id?: bigint;
- channel_id: bigint;
- user_id: bigint;
+ guild_id?: string;
+ channel_id: string;
+ user_id: string;
session_id: string;
deaf: boolean;
mute: boolean;
@@ -17,9 +17,9 @@ export interface VoiceState extends Document {
}
export const VoiceSateSchema = new Schema({
- guild_id: Types.Long,
- channel_id: Types.Long,
- user_id: Types.Long,
+ guild_id: String,
+ channel_id: String,
+ user_id: String,
session_id: String,
deaf: Boolean,
mute: Boolean,
diff --git a/src/util/Permissions.ts b/src/util/Permissions.ts
index 809111bf..4bad70d3 100644
--- a/src/util/Permissions.ts
+++ b/src/util/Permissions.ts
@@ -121,7 +121,7 @@ export class Permissions extends BitField {
guild,
channel,
}: {
- user: { id: bigint; roles: bigint[] };
+ user: { id: string; roles: string[] };
guild: { roles: Role[] };
channel?: {
overwrites?: ChannelPermissionOverwrite[];
@@ -144,9 +144,9 @@ export class Permissions extends BitField {
}
export async function getPermission(
- user_id: bigint,
- guild_id: bigint,
- channel_id?: bigint,
+ user_id: string,
+ guild_id: string,
+ channel_id?: string,
cache?: { channel?: ChannelDocument | null; member?: MemberDocument | null }
) {
var { channel, member } = cache || {};
diff --git a/src/util/Snowflake.ts b/src/util/Snowflake.ts
index 9e94bbd9..1ccae43c 100644
--- a/src/util/Snowflake.ts
+++ b/src/util/Snowflake.ts
@@ -87,7 +87,7 @@ export class Snowflake {
var worker = Snowflake.workerId << 17n;
var process = Snowflake.processId << 12n;
var increment = Snowflake.INCREMENT++;
- return time | worker | process | increment;
+ return (time | worker | process | increment).toString();
}
/**
|