mirror of
https://github.com/spacebarchat/server.git
synced 2026-08-29 01:09:20 +00:00
Merge branch 'master' into maddyrtc
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { PrimaryColumn, Column, Entity} from "typeorm";
|
||||
import { BaseClassWithoutId } from "./BaseClass";
|
||||
|
||||
// TODO: categories:
|
||||
// [{
|
||||
// "id": 16,
|
||||
// "default": "Anime & Manga",
|
||||
// "localizations": {
|
||||
// "de": "Anime & Manga",
|
||||
// "fr": "Anim\u00e9s et mangas",
|
||||
// "ru": "\u0410\u043d\u0438\u043c\u0435 \u0438 \u043c\u0430\u043d\u0433\u0430"
|
||||
// }
|
||||
// },
|
||||
// "is_primary": false/true
|
||||
// }]
|
||||
// Also populate discord default categories
|
||||
|
||||
@Entity("categories")
|
||||
export class Categories extends BaseClassWithoutId { // Not using snowflake
|
||||
|
||||
@PrimaryColumn()
|
||||
id: number;
|
||||
|
||||
@Column({ nullable: true })
|
||||
name: string;
|
||||
|
||||
@Column({ type: "simple-json" })
|
||||
localizations: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
is_primary: boolean;
|
||||
|
||||
}
|
||||
@@ -157,7 +157,12 @@ export interface ConfigValue {
|
||||
available: Region[];
|
||||
};
|
||||
guild: {
|
||||
showAllGuildsInDiscovery: boolean;
|
||||
discovery: {
|
||||
showAllGuilds: boolean;
|
||||
useRecommendation: boolean; // TODO: Recommendation, privacy concern?
|
||||
offset: number;
|
||||
limit: number;
|
||||
};
|
||||
autoJoin: {
|
||||
enabled: boolean;
|
||||
guilds: string[];
|
||||
@@ -353,7 +358,12 @@ export const DefaultConfigOptions: ConfigValue = {
|
||||
],
|
||||
},
|
||||
guild: {
|
||||
showAllGuildsInDiscovery: false,
|
||||
discovery: {
|
||||
showAllGuilds: false,
|
||||
useRecommendation: false,
|
||||
offset: 0,
|
||||
limit: 24,
|
||||
},
|
||||
autoJoin: {
|
||||
enabled: true,
|
||||
canLeave: true,
|
||||
|
||||
@@ -17,28 +17,6 @@ import { Webhook } from "./Webhook";
|
||||
// TODO: guild_scheduled_events
|
||||
// TODO: stage_instances
|
||||
// TODO: threads
|
||||
// TODO: categories:
|
||||
// [{
|
||||
// "id": 16,
|
||||
// "name": {
|
||||
// "default": "Anime & Manga",
|
||||
// "localizations": {
|
||||
// "de": "Anime & Manga",
|
||||
// "fr": "Anim\u00e9s et mangas",
|
||||
// "ru": "\u0410\u043d\u0438\u043c\u0435 \u0438 \u043c\u0430\u043d\u0433\u0430"
|
||||
// }
|
||||
// },
|
||||
// "is_primary": false
|
||||
// }]
|
||||
// TODO:
|
||||
// primary_category :{
|
||||
// id: 1,
|
||||
// name: {
|
||||
// default: "Gaming",
|
||||
// localizations: { de: "Gaming", fr: "Gaming", ru: "\u0418\u0433\u0440\u044b" },
|
||||
// is_primary: true,
|
||||
// },
|
||||
// };
|
||||
// TODO:
|
||||
// "keywords": [
|
||||
// "Genshin Impact",
|
||||
@@ -107,6 +85,9 @@ export class Guild extends BaseClass {
|
||||
features: string[]; //TODO use enum
|
||||
//TODO: https://discord.com/developers/docs/resources/guild#guild-object-guild-features
|
||||
|
||||
@Column({ nullable: true })
|
||||
primary_category_id: number;
|
||||
|
||||
@Column({ nullable: true })
|
||||
icon?: string;
|
||||
|
||||
@@ -289,6 +270,9 @@ export class Guild extends BaseClass {
|
||||
@Column({ nullable: true })
|
||||
nsfw?: boolean;
|
||||
|
||||
// only for developer portal
|
||||
permissions?: number;
|
||||
|
||||
static async createGuild(body: {
|
||||
name?: string;
|
||||
icon?: string | null;
|
||||
@@ -306,6 +290,7 @@ export class Guild extends BaseClass {
|
||||
default_message_notifications: 1, // defaults effect: setting the push default at mentions-only will save a lot
|
||||
explicit_content_filter: 0,
|
||||
features: [],
|
||||
primary_category_id: null,
|
||||
id: guild_id,
|
||||
max_members: 250000,
|
||||
max_presences: 250000,
|
||||
|
||||
+11
-17
@@ -256,7 +256,7 @@ export class User extends BaseClass {
|
||||
disabled: false,
|
||||
deleted: false,
|
||||
email: email,
|
||||
rights: "0",
|
||||
rights: "0", // TODO: grant rights correctly, as 0 actually stands for no rights at all
|
||||
nsfw_allowed: true, // TODO: depending on age
|
||||
public_flags: "0",
|
||||
flags: "0", // TODO: generate
|
||||
@@ -283,23 +283,18 @@ export class User extends BaseClass {
|
||||
}
|
||||
|
||||
export const defaultSettings: UserSettings = {
|
||||
afk_timeout: 300,
|
||||
afk_timeout: 3600,
|
||||
allow_accessibility_detection: true,
|
||||
animate_emoji: true,
|
||||
animate_stickers: 0,
|
||||
contact_sync_enabled: false,
|
||||
convert_emoticons: false,
|
||||
custom_status: {
|
||||
emoji_id: undefined,
|
||||
emoji_name: undefined,
|
||||
expires_at: undefined,
|
||||
text: undefined,
|
||||
},
|
||||
custom_status: null,
|
||||
default_guilds_restricted: false,
|
||||
detect_platform_accounts: true,
|
||||
developer_mode: false,
|
||||
disable_games_tab: false,
|
||||
enable_tts_command: true,
|
||||
detect_platform_accounts: false,
|
||||
developer_mode: true,
|
||||
disable_games_tab: true,
|
||||
enable_tts_command: false,
|
||||
explicit_content_filter: 0,
|
||||
friend_source_flags: { all: true },
|
||||
gateway_connected: false,
|
||||
@@ -309,17 +304,16 @@ export const defaultSettings: UserSettings = {
|
||||
inline_attachment_media: true,
|
||||
inline_embed_media: true,
|
||||
locale: "en-US",
|
||||
message_display_compact: false,
|
||||
message_display_compact: true,
|
||||
native_phone_integration_enabled: true,
|
||||
render_embeds: true,
|
||||
render_reactions: true,
|
||||
restricted_guilds: [],
|
||||
show_current_game: true,
|
||||
status: "online",
|
||||
stream_notifications_enabled: true,
|
||||
stream_notifications_enabled: false,
|
||||
theme: "dark",
|
||||
timezone_offset: 0,
|
||||
// timezone_offset: // TODO: timezone from request
|
||||
timezone_offset: 0, // TODO: timezone from request
|
||||
};
|
||||
|
||||
export interface UserSettings {
|
||||
@@ -334,7 +328,7 @@ export interface UserSettings {
|
||||
emoji_name?: string;
|
||||
expires_at?: number;
|
||||
text?: string;
|
||||
};
|
||||
} | null;
|
||||
default_guilds_restricted: boolean;
|
||||
detect_platform_accounts: boolean;
|
||||
developer_mode: boolean;
|
||||
|
||||
@@ -3,6 +3,7 @@ export * from "./Attachment";
|
||||
export * from "./AuditLog";
|
||||
export * from "./Ban";
|
||||
export * from "./BaseClass";
|
||||
export * from "./Categories";
|
||||
export * from "./Channel";
|
||||
export * from "./Config";
|
||||
export * from "./ConnectedAccount";
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
//TODO: populate default discord categories + init, get and set methods
|
||||
@@ -730,26 +730,44 @@ export const DiscordApiErrors = {
|
||||
* An error encountered while performing an API request (Fosscord only). Here are the potential errors:
|
||||
*/
|
||||
export const FosscordApiErrors = {
|
||||
MANUALLY_TRIGGERED_ERROR: new ApiError("This is an artificial error", 1),
|
||||
PREMIUM_DISABLED_FOR_GUILD: new ApiError("This guild cannot be boosted", 25001),
|
||||
NO_FURTHER_PREMIUM: new ApiError("This guild does not receive further boosts", 25002),
|
||||
GUILD_PREMIUM_DISABLED_FOR_YOU: new ApiError("This guild cannot be boosted by you", 25003),
|
||||
CANNOT_FRIEND_SELF: new ApiError("Cannot friend oneself", 25009),
|
||||
USER_SPECIFIC_INVITE_WRONG_RECIPIENT: new ApiError("This invite is not meant for you", 25010),
|
||||
USER_SPECIFIC_INVITE_FAILED: new ApiError("Failed to invite user", 25011),
|
||||
CANNOT_MODIFY_USER_GROUP: new ApiError("This user cannot manipulate this group", 25050),
|
||||
CANNOT_REMOVE_SELF_FROM_GROUP: new ApiError("This user cannot remove oneself from user group", 25051),
|
||||
CANNOT_BAN_OPERATOR: new ApiError("Non-OPERATOR cannot ban OPERATOR from instance", 25052),
|
||||
CANNOT_LEAVE_GUILD: new ApiError("You are not allowed to leave guilds that you joined by yourself", 25059),
|
||||
EDITS_DISABLED: new ApiError("You are not allowed to edit your own messages", 25060),
|
||||
DELETE_MESSAGE_DISABLED: new ApiError("You are not allowed to delete your own messages", 25061),
|
||||
FEATURE_PERMANENTLY_DISABLED: new ApiError("This feature has been disabled server-side", 45006),
|
||||
MISSING_RIGHTS: new ApiError("You lack rights to perform that action ({})", 50013, undefined, [""]),
|
||||
CANNOT_GRANT_PERMISSIONS_EXCEEDING_RIGHTS: new ApiError("You cannot grant permissions exceeding your own rights", 50050),
|
||||
ROUTES_LOOPING: new ApiError("Loops in the route definition ({})", 50060, undefined, [""]),
|
||||
CANNOT_REMOVE_ROUTE: new ApiError("Cannot remove message route while it is in effect and being used", 50061),
|
||||
};
|
||||
|
||||
/**
|
||||
* The value set for a guild's default message notifications, e.g. `ALL`. Here are the available types:
|
||||
* * ALL
|
||||
* * MENTIONS
|
||||
* * MUTED (Fosscord extension)
|
||||
* @typedef {string} DefaultMessageNotifications
|
||||
*/
|
||||
export const DefaultMessageNotifications = ["ALL", "MENTIONS"];
|
||||
export const DefaultMessageNotifications = ["ALL", "MENTIONS", "MUTED"];
|
||||
|
||||
/**
|
||||
* The value set for a team members's membership state:
|
||||
* * INVITED
|
||||
* * ACCEPTED
|
||||
* * INSERTED (Fosscord extension)
|
||||
* @typedef {string} MembershipStates
|
||||
*/
|
||||
export const MembershipStates = [
|
||||
// They start at 1
|
||||
null,
|
||||
"INSERTED",
|
||||
"INVITED",
|
||||
"ACCEPTED",
|
||||
];
|
||||
@@ -758,11 +776,11 @@ export const MembershipStates = [
|
||||
* The value set for a webhook's type:
|
||||
* * Incoming
|
||||
* * Channel Follower
|
||||
* * Custom (Fosscord extension)
|
||||
* @typedef {string} WebhookTypes
|
||||
*/
|
||||
export const WebhookTypes = [
|
||||
// They start at 1
|
||||
null,
|
||||
"Custom",
|
||||
"Incoming",
|
||||
"Channel Follower",
|
||||
];
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
export * from "./ApiError";
|
||||
export * from "./BitField";
|
||||
export * from "./Token";
|
||||
//export * from "./Categories";
|
||||
export * from "./cdn";
|
||||
export * from "./Config";
|
||||
export * from "./Constants";
|
||||
|
||||
Reference in New Issue
Block a user