mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
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:
@@ -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 }));
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user