Added null safety

This commit is contained in:
2023-11-30 17:38:37 +01:00
parent 0e4ed441a0
commit f21608cf86
2 changed files with 5 additions and 5 deletions

View File

@@ -18,7 +18,6 @@ module.exports = {
await interaction.deferReply({ ephemeral: true }) await interaction.deferReply({ ephemeral: true })
const embedColor = Number(color.replace("#", "0x")) const embedColor = Number(color.replace("#", "0x"))
const footerText = interaction.guild ? interaction.guild.name : interaction.user.username + " | " + devMessage const footerText = interaction.guild ? interaction.guild.name : interaction.user.username + " | " + devMessage
const footerIcon = interaction.guild ? interaction.guild.iconURL({ dynamic: true }) : interaction.user.avatarURL({ dynamic: true }) const footerIcon = interaction.guild ? interaction.guild.iconURL({ dynamic: true }) : interaction.user.avatarURL({ dynamic: true })
@@ -46,7 +45,7 @@ module.exports = {
], ],
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: interaction?.guild.iconURL({ dynamic: true }) || null url: interaction?.guild?.iconURL({ dynamic: true }) || null
}, },
footer: { footer: {
icon_url: footerIcon, icon_url: footerIcon,

View File

@@ -1,6 +1,6 @@
const { SlashCommandBuilder } = require("discord.js") const { SlashCommandBuilder } = require("discord.js")
const { color, devMessage } = require("../../config/options.json") const { color, devMessage } = require("../../config/options.json")
const { bwfkdr, bwstars, bwwins, swstars, duelswins, duelswlr } = require("../../config/reqs.json") const { bwfkdr, bwstars, bwwins, swstars, swkdr, duelswins, duelswlr } = require("../../config/reqs.json")
module.exports = { module.exports = {
name: "reqs", name: "reqs",
@@ -26,7 +26,7 @@ module.exports = {
description: "**You must make 100k-150k weekly GEXP.\nAs well as onne of the game stats below**", description: "**You must make 100k-150k weekly GEXP.\nAs well as onne of the game stats below**",
color: embedColor, color: embedColor,
thumbnail: { thumbnail: {
url: interaction.guild.iconURL() url: interaction?.guild?.iconURL({ dynamic: true }) || null
}, },
fields: [ fields: [
{ {
@@ -37,7 +37,8 @@ module.exports = {
}, },
{ {
name: "**Skywars**", name: "**Skywars**",
value: "**Stars:** `" + swstars.toString() + "`" value: "**Stars:** `" + swstars.toString() +
"`\n**KDR:** `" + swkdr.toString() + "`"
}, },
{ {
name: "**Duels**", name: "**Duels**",