Skip to content

Commit

Permalink
fix: make prop check correct and fix sticker format
Browse files Browse the repository at this point in the history
  • Loading branch information
iShibi committed Jun 13, 2021
1 parent bb89aff commit 512287c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/structures/Guild.js
Expand Up @@ -832,7 +832,7 @@ class Guild extends BaseGuild {
edit(data, reason) {
const _data = {};
if (data.name) _data.name = data.name;
if (data.verificationLevel) {
if (typeof data.verificationLevel !== 'undefined') {
_data.verification_level =
typeof data.verificationLevel === 'number'
? data.verificationLevel
Expand All @@ -850,13 +850,13 @@ class Guild extends BaseGuild {
if (data.splash) _data.splash = data.splash;
if (data.discoverySplash) _data.discovery_splash = data.discoverySplash;
if (data.banner) _data.banner = data.banner;
if (data.explicitContentFilter) {
if (typeof data.explicitContentFilter !== 'undefined') {
_data.explicit_content_filter =
typeof data.explicitContentFilter === 'number'
? data.explicitContentFilter
: ExplicitContentFilterLevels[data.explicitContentFilter];
}
if (data.defaultMessageNotifications) {
if (typeof data.defaultMessageNotifications !== 'undefined') {
_data.default_message_notifications =
typeof data.defaultMessageNotifications === 'number'
? data.defaultMessageNotifications
Expand Down
2 changes: 1 addition & 1 deletion src/structures/Sticker.js
Expand Up @@ -31,7 +31,7 @@ class Sticker extends Base {

/**
* The format of the sticker
* @type {StickerFormatTypes}
* @type {StickerFormatType}
*/
this.format = StickerFormatTypes[sticker.format_type];

Expand Down
2 changes: 1 addition & 1 deletion src/util/Constants.js
Expand Up @@ -736,7 +736,7 @@ exports.WebhookTypes = createEnum([null, 'Incoming', 'Channel Follower']);
* * PNG
* * APNG
* * LOTTIE
* @typedef {string} StickerFormatTypes
* @typedef {string} StickerFormatType
*/
exports.StickerFormatTypes = createEnum([null, 'PNG', 'APNG', 'LOTTIE']);

Expand Down
4 changes: 3 additions & 1 deletion typings/index.d.ts
Expand Up @@ -3719,14 +3719,16 @@ declare module 'discord.js' {
public readonly createdTimestamp: number;
public readonly createdAt: Date;
public description: string;
public format: StickerFormatTypes;
public format: StickerFormatType;
public id: Snowflake;
public name: string;
public packID: Snowflake;
public tags: string[];
public readonly url: string;
}

type StickerFormatType = keyof typeof StickerFormatTypes;

type SystemChannelFlagsString =
| 'SUPPRESS_JOIN_NOTIFICATIONS'
| 'SUPPRESS_PREMIUM_SUBSCRIPTIONS'
Expand Down

0 comments on commit 512287c

Please sign in to comment.