mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
feat(*): use enums for consistency and speed (#5843)
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
This commit is contained in:
@@ -13,7 +13,7 @@ const {
|
||||
ChannelTypes,
|
||||
Events,
|
||||
VerificationLevels,
|
||||
DefaultMessageNotifications,
|
||||
DefaultMessageNotificationLevels,
|
||||
ExplicitContentFilterLevels,
|
||||
} = require('../util/Constants');
|
||||
const DataResolver = require('../util/DataResolver');
|
||||
@@ -168,14 +168,14 @@ class GuildManager extends BaseManager {
|
||||
} = {},
|
||||
) {
|
||||
icon = await DataResolver.resolveImage(icon);
|
||||
if (typeof verificationLevel !== 'undefined' && typeof verificationLevel !== 'number') {
|
||||
verificationLevel = VerificationLevels.indexOf(verificationLevel);
|
||||
if (typeof verificationLevel === 'string') {
|
||||
verificationLevel = VerificationLevels[verificationLevel];
|
||||
}
|
||||
if (typeof defaultMessageNotifications !== 'undefined' && typeof defaultMessageNotifications !== 'number') {
|
||||
defaultMessageNotifications = DefaultMessageNotifications.indexOf(defaultMessageNotifications);
|
||||
if (typeof defaultMessageNotifications === 'string') {
|
||||
defaultMessageNotifications = DefaultMessageNotificationLevels[defaultMessageNotifications];
|
||||
}
|
||||
if (typeof explicitContentFilter !== 'undefined' && typeof explicitContentFilter !== 'number') {
|
||||
explicitContentFilter = ExplicitContentFilterLevels.indexOf(explicitContentFilter);
|
||||
if (typeof explicitContentFilter === 'string') {
|
||||
explicitContentFilter = ExplicitContentFilterLevels[explicitContentFilter];
|
||||
}
|
||||
for (const channel of channels) {
|
||||
if (channel.type) channel.type = ChannelTypes[channel.type.toUpperCase()];
|
||||
|
||||
Reference in New Issue
Block a user