mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
refactor: use optional chaining (#6757)
This commit is contained in:
@@ -48,7 +48,7 @@ class APIRequest {
|
||||
if (this.options.headers) headers = Object.assign(headers, this.options.headers);
|
||||
|
||||
let body;
|
||||
if (this.options.files && this.options.files.length) {
|
||||
if (this.options.files?.length) {
|
||||
body = new FormData();
|
||||
for (const file of this.options.files) {
|
||||
if (file?.file) body.append(file.key ?? file.name, file.file, file.name);
|
||||
|
||||
@@ -177,7 +177,7 @@ class RequestHandler {
|
||||
}
|
||||
|
||||
let sublimitTimeout;
|
||||
if (res && res.headers) {
|
||||
if (res.headers) {
|
||||
const serverDate = res.headers.get('date');
|
||||
const limit = res.headers.get('x-ratelimit-limit');
|
||||
const remaining = res.headers.get('x-ratelimit-remaining');
|
||||
|
||||
@@ -926,7 +926,7 @@ class Guild extends AnonymousGuild {
|
||||
const welcome_channels = welcomeChannels?.map(welcomeChannelData => {
|
||||
const emoji = this.emojis.resolve(welcomeChannelData.emoji);
|
||||
return {
|
||||
emoji_id: emoji && emoji.id,
|
||||
emoji_id: emoji?.id,
|
||||
emoji_name: emoji?.name ?? welcomeChannelData.emoji,
|
||||
channel_id: this.channels.resolveId(welcomeChannelData.channel),
|
||||
description: welcomeChannelData.description,
|
||||
|
||||
Reference in New Issue
Block a user