fix!: Community invites updates (#4724)

* Update permissions for community invites

Use payload_json for invite creation with file upload

The TODO in INVITE_CREATE is to be done after #4436 gets merged as it splits the transformer logic between gateway and the normal invite object, placing the event transformation code in the event itself

* Community invites breaking changes
This commit is contained in:
Fleny
2026-02-16 23:20:42 +05:30
committed by GitHub
parent a4a5f172d4
commit 8939cc8492
8 changed files with 12 additions and 16 deletions
@@ -6,5 +6,6 @@ export async function handleInviteCreate(bot: Bot, data: DiscordGatewayPayload,
const payload = data.d as DiscordInviteCreate;
// TODO: Add role_ids, the transformer should be kept for the Invite type, not for the gateway event
bot.events.inviteCreate(bot.transformers.invite(bot, payload, { shardId }));
}
+1
View File
@@ -35,6 +35,7 @@ export function transformInvite(bot: Bot, payload: DiscordInviteCreate | Discord
invite.expiresAt = Date.parse(payload.expires_at);
}
if (props.flags && payload.flags) invite.flags = new ToggleBitfield(payload.flags);
// @ts-expect-error TODO: Partials
if (props.roles && payload.roles) invite.roles = payload.roles.map((role) => bot.transformers.role(bot, role));
} else {
if (props.channelId && payload.channel_id) invite.channelId = bot.transformers.snowflake(payload.channel_id);
+1 -1
View File
@@ -1144,7 +1144,7 @@ export interface Invite {
/**
* The roles assigned to the user upon accepting the invite
*/
roles?: Role[];
roles?: Pick<Role, 'id' | 'name' | 'position' | 'color' | 'colors' | 'icon' | 'unicodeEmoji'>[];
}
export interface Member {