mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +00:00
hotfix: undefined behavior
This commit is contained in:
parent
61cb7b26fb
commit
fd9b0284a6
@ -241,20 +241,19 @@ export class Session extends EventEmitter {
|
||||
application_id: this.applicationId,
|
||||
details: activity.details,
|
||||
state: activity.state,
|
||||
emoji: activity.emoji || {
|
||||
name: activity.emoji!.name,
|
||||
id: activity.emoji!.id,
|
||||
animated: activity.emoji!.animated,
|
||||
emoji: activity.emoji && {
|
||||
name: activity.emoji.name,
|
||||
id: activity.emoji.id,
|
||||
animated: activity.emoji.animated,
|
||||
},
|
||||
party: activity.party,
|
||||
assets: activity.assets
|
||||
? {
|
||||
assets: activity.assets &&
|
||||
{
|
||||
large_image: activity.assets.largeImage,
|
||||
large_text: activity.assets.largeText,
|
||||
small_image: activity.assets.smallImage,
|
||||
small_text: activity.assets.smallText,
|
||||
}
|
||||
: undefined,
|
||||
},
|
||||
secrets: activity.secrets,
|
||||
instance: activity.instance,
|
||||
flags: activity.flags,
|
||||
|
@ -55,16 +55,16 @@ export function embed(data: Embed): DiscordEmbed {
|
||||
url: data.url,
|
||||
color: data.color,
|
||||
description: data.description,
|
||||
author: {
|
||||
name: data.author?.name!,
|
||||
url: data.author?.url,
|
||||
icon_url: data.author?.iconURL,
|
||||
proxy_icon_url: data.author?.proxyIconURL,
|
||||
author: data.author && {
|
||||
name: data.author.name,
|
||||
url: data.author.url,
|
||||
icon_url: data.author.iconURL,
|
||||
proxy_icon_url: data.author.proxyIconURL,
|
||||
},
|
||||
footer: data.footer || {
|
||||
text: data.footer!.text,
|
||||
icon_url: data.footer!.iconURL,
|
||||
proxy_icon_url: data.footer!.proxyIconURL,
|
||||
footer: data.footer && {
|
||||
text: data.footer.text,
|
||||
icon_url: data.footer.iconURL,
|
||||
proxy_icon_url: data.footer.proxyIconURL,
|
||||
},
|
||||
fields: data.fields?.map((f) => {
|
||||
return {
|
||||
@ -73,11 +73,11 @@ export function embed(data: Embed): DiscordEmbed {
|
||||
inline: f.inline,
|
||||
};
|
||||
}),
|
||||
thumbnail: data.thumbnail || {
|
||||
url: data.thumbnail!.url,
|
||||
proxy_url: data.thumbnail!.proxyURL,
|
||||
width: data.thumbnail!.width,
|
||||
height: data.thumbnail!.height,
|
||||
thumbnail: data.thumbnail && {
|
||||
url: data.thumbnail.url,
|
||||
proxy_url: data.thumbnail.proxyURL,
|
||||
width: data.thumbnail.width,
|
||||
height: data.thumbnail.height,
|
||||
},
|
||||
video: {
|
||||
url: data.video?.url,
|
||||
@ -85,11 +85,11 @@ export function embed(data: Embed): DiscordEmbed {
|
||||
width: data.video?.width,
|
||||
height: data.video?.height,
|
||||
},
|
||||
image: data.image || {
|
||||
url: data.image!.url,
|
||||
proxy_url: data.image!.proxyURL,
|
||||
width: data.image!.width,
|
||||
height: data.image!.height,
|
||||
image: data.image && {
|
||||
url: data.image.url,
|
||||
proxy_url: data.image.proxyURL,
|
||||
width: data.image.width,
|
||||
height: data.image.height,
|
||||
},
|
||||
provider: {
|
||||
url: data.provider?.url,
|
||||
|
@ -74,9 +74,8 @@ export function NewInviteCreate(session: Session, invite: DiscordInviteCreate):
|
||||
maxUses: invite.max_uses,
|
||||
targetType: invite.target_type,
|
||||
targetUser: invite.target_user ? new User(session, invite.target_user) : undefined,
|
||||
targetApplication: invite.target_application
|
||||
? new Application(session, invite.target_application as DiscordApplication)
|
||||
: undefined,
|
||||
targetApplication: invite.target_application &&
|
||||
new Application(session, invite.target_application as DiscordApplication),
|
||||
temporary: invite.temporary,
|
||||
uses: invite.uses,
|
||||
};
|
||||
|
@ -155,11 +155,11 @@ export class Webhook implements Model {
|
||||
embeds: options?.embeds,
|
||||
file: options?.files,
|
||||
components: options?.components,
|
||||
allowed_mentions: options?.allowedMentions || {
|
||||
parse: options?.allowedMentions!.parse,
|
||||
replied_user: options?.allowedMentions!.repliedUser,
|
||||
users: options?.allowedMentions!.users,
|
||||
roles: options?.allowedMentions!.roles,
|
||||
allowed_mentions: options?.allowedMentions && {
|
||||
parse: options?.allowedMentions.parse,
|
||||
replied_user: options?.allowedMentions.repliedUser,
|
||||
users: options?.allowedMentions.users,
|
||||
roles: options?.allowedMentions.roles,
|
||||
},
|
||||
attachments: options?.attachments?.map((attachment) => {
|
||||
return {
|
||||
|
@ -671,8 +671,8 @@ export class Guild extends BaseGuild implements Model {
|
||||
system_channel_flags: options.systemChannelFlags,
|
||||
verification_level: options.verificationLevel,
|
||||
icon: "iconURL" in options
|
||||
? options.iconURL || urlToBase64(options.iconURL!)
|
||||
: options.iconHash || Util.iconBigintToHash(options.iconHash!),
|
||||
? options.iconURL && urlToBase64(options.iconURL)
|
||||
: options.iconHash && Util.iconBigintToHash(options.iconHash),
|
||||
channels: options.channels?.map((channel) => ({
|
||||
name: channel.name,
|
||||
nsfw: channel.nsfw,
|
||||
@ -693,7 +693,7 @@ export class Guild extends BaseGuild implements Model {
|
||||
hoist: role.hoist,
|
||||
position: role.position,
|
||||
unicode_emoji: role.unicodeEmoji,
|
||||
icon: options.iconURL || urlToBase64(options.iconURL!),
|
||||
icon: options.iconURL && urlToBase64(options.iconURL),
|
||||
})),
|
||||
});
|
||||
|
||||
@ -713,18 +713,18 @@ export class Guild extends BaseGuild implements Model {
|
||||
system_channel_flags: options.systemChannelFlags,
|
||||
verification_level: options.verificationLevel,
|
||||
icon: "iconURL" in options
|
||||
? options.iconURL || urlToBase64(options.iconURL!)
|
||||
: options.iconHash || Util.iconBigintToHash(options.iconHash!),
|
||||
? options.iconURL && urlToBase64(options.iconURL)
|
||||
: options.iconHash && Util.iconBigintToHash(options.iconHash),
|
||||
// extra props
|
||||
splash: "splashURL" in options
|
||||
? options.splashURL || urlToBase64(options.splashURL!)
|
||||
: options.splashHash || Util.iconBigintToHash(options.iconHash!),
|
||||
? options.splashURL && urlToBase64(options.splashURL)
|
||||
: options.iconHash && Util.iconBigintToHash(options.iconHash),
|
||||
banner: "bannerURL" in options
|
||||
? options.bannerURL || urlToBase64(options.bannerURL!)
|
||||
: options.bannerHash || Util.iconBigintToHash(options.bannerHash!),
|
||||
? options.bannerURL && urlToBase64(options.bannerURL)
|
||||
: options.bannerHash && Util.iconBigintToHash(options.bannerHash),
|
||||
discovery_splash: "discoverySplashURL" in options
|
||||
? options.discoverySplashURL || urlToBase64(options.discoverySplashURL!)
|
||||
: options.discoverySplashHash || Util.iconBigintToHash(options.discoverySplashHash!),
|
||||
? options.discoverySplashURL && urlToBase64(options.discoverySplashURL)
|
||||
: options.discoverySplashHash && Util.iconBigintToHash(options.discoverySplashHash),
|
||||
owner_id: options.ownerId,
|
||||
rules_channel_id: options.rulesChannelId,
|
||||
public_updates_channel_id: options.publicUpdatesChannelId,
|
||||
|
@ -133,11 +133,11 @@ export abstract class BaseInteraction implements Model {
|
||||
embeds: options.embeds,
|
||||
file: options.files,
|
||||
components: options.components,
|
||||
allowed_mentions: options.allowedMentions || {
|
||||
parse: options.allowedMentions!.parse,
|
||||
replied_user: options.allowedMentions!.repliedUser,
|
||||
users: options.allowedMentions!.users,
|
||||
roles: options.allowedMentions!.roles,
|
||||
allowed_mentions: options.allowedMentions && {
|
||||
parse: options.allowedMentions.parse,
|
||||
replied_user: options.allowedMentions.repliedUser,
|
||||
users: options.allowedMentions.users,
|
||||
roles: options.allowedMentions.roles,
|
||||
},
|
||||
attachments: options.attachments?.map((attachment) => {
|
||||
return {
|
||||
|
Loading…
x
Reference in New Issue
Block a user