summary refs log tree commit diff
path: root/util/src
diff options
context:
space:
mode:
Diffstat (limited to 'util/src')
-rw-r--r--util/src/entities/Emoji.ts2
-rw-r--r--util/src/util/Constants.ts28
-rw-r--r--util/src/util/Database.ts1
-rw-r--r--util/src/util/Rights.ts15
4 files changed, 38 insertions, 8 deletions
diff --git a/util/src/entities/Emoji.ts b/util/src/entities/Emoji.ts

index 32d39234..a3615b7d 100644 --- a/util/src/entities/Emoji.ts +++ b/util/src/entities/Emoji.ts
@@ -41,6 +41,6 @@ export class Emoji extends BaseClass { @Column({ type: "simple-array" }) roles: string[]; // roles this emoji is whitelisted to (new discord feature?) - @Column({ type: "simple-array" }) + @Column({ type: "simple-array", nullable: true }) groups: string[]; // user groups this emoji is whitelisted to (Fosscord extension) } diff --git a/util/src/util/Constants.ts b/util/src/util/Constants.ts
index 5fdf5bc0..8d61b9b4 100644 --- a/util/src/util/Constants.ts +++ b/util/src/util/Constants.ts
@@ -727,26 +727,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", ]; @@ -755,11 +773,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", ]; diff --git a/util/src/util/Database.ts b/util/src/util/Database.ts
index e8177093..9ab5d14c 100644 --- a/util/src/util/Database.ts +++ b/util/src/util/Database.ts
@@ -25,6 +25,7 @@ export function initDatabase(): Promise<Connection> { // @ts-ignore promise = createConnection({ type, + charset: 'utf8mb4', url: isSqlite ? undefined : dbConnectionString, database: isSqlite ? dbConnectionString : undefined, // @ts-ignore diff --git a/util/src/util/Rights.ts b/util/src/util/Rights.ts
index f0d00baf..9a99d393 100644 --- a/util/src/util/Rights.ts +++ b/util/src/util/Rights.ts
@@ -35,9 +35,9 @@ export class Rights extends BitField { ADD_MEMBERS: BitFlag(8), // can manually add any members in their guilds BYPASS_RATE_LIMITS: BitFlag(9), CREATE_APPLICATIONS: BitFlag(10), - CREATE_CHANNELS: BitFlag(11), + CREATE_CHANNELS: BitFlag(11), // can create guild channels or threads in the guilds that they have permission CREATE_DMS: BitFlag(12), - CREATE_DM_GROUPS: BitFlag(13), + CREATE_DM_GROUPS: BitFlag(13), // can create group DMs or custom orphan channels CREATE_GUILDS: BitFlag(14), CREATE_INVITES: BitFlag(15), // can create mass invites in the guilds that they have CREATE_INSTANT_INVITE CREATE_ROLES: BitFlag(16), @@ -57,6 +57,17 @@ export class Rights extends BitField { SELF_DELETE_DISABLE: BitFlag(30), // can disable/delete own account DEBTABLE: BitFlag(31), // can use pay-to-use features CREDITABLE: BitFlag(32), // can receive money from monetisation related features + KICK_BAN_MEMBERS: BitFlag(33), + // can kick or ban guild or group DM members in the guilds/groups that they have KICK_MEMBERS, or BAN_MEMBERS + SELF_LEAVE_GROUPS: BitFlag(34), + // can leave the guilds or group DMs that they joined on their own (one can always leave a guild or group DMs they have been force-added) + PRESENCE: BitFlag(35), + // inverts the presence confidentiality default (OPERATOR's presence is not routed by default, others' are) for a given user + SELF_ADD_DISCOVERABLE: BitFlag(36), // can mark discoverable guilds that they have permissions to mark as discoverable + MANAGE_GUILD_DIRECTORY: BitFlag(37), // can change anything in the primary guild directory + INITIATE_INTERACTIONS: BitFlag(40), // can initiate interactions + RESPOND_TO_INTERACTIONS: BitFlag(41), // can respond to interactions + SEND_BACKDATED_EVENTS: BitFlag(42), // can send backdated events }; any(permission: RightResolvable, checkOperator = true) {