Skip to content

Commit

Permalink
refactor: rename GUILD_EVENT target type and error message key
Browse files Browse the repository at this point in the history
  • Loading branch information
iShibi committed Nov 14, 2021
1 parent a83f47a commit ccc1a17
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/errors/Messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const Messages = {
GUILD_UNCACHED_ME: 'The client user as a member of this guild is uncached.',
CHANNEL_NOT_CACHED: 'Could not find the channel where this message came from in the cache!',
STAGE_CHANNEL_RESOLVE: 'Could not resolve channel to a stage channel.',
GUILD_EVENT_RESOLVE: 'Could not resolve the guild event.',
GUILD_SCHEDULED_EVENT_RESOLVE: 'Could not resolve the guild scheduled event.',

INVALID_TYPE: (name, expected, an = false) => `Supplied ${name} is not a${an ? 'n' : ''} ${expected}.`,
INVALID_ELEMENT: (type, name, elem) => `Supplied ${type} ${name} includes an invalid element: ${elem}`,
Expand Down
4 changes: 2 additions & 2 deletions src/managers/GuildScheduledEventManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class GuildScheduledEventManager extends CachedManager {
*/
async edit(guildScheduledEvent, options) {
const guildScheduledEventId = this.resolveId(guildScheduledEvent);
if (!guildScheduledEventId) throw new Error('GUILD_EVENT_RESOLVE');
if (!guildScheduledEventId) throw new Error('GUILD_SCHEDULED_EVENT_RESOLVE');

if (typeof options !== 'object') throw new TypeError('INVALID_TYPE', 'options', 'object', true);
let { privacyLevel, entityType, channel } = options;
Expand Down Expand Up @@ -159,7 +159,7 @@ class GuildScheduledEventManager extends CachedManager {
*/
async delete(guildScheduledEvent) {
const guildScheduledEventId = this.resolveId(guildScheduledEvent);
if (!guildScheduledEventId) throw new Error('GUILD_EVENT_RESOLVE');
if (!guildScheduledEventId) throw new Error('GUILD_SCHEDULED_EVENT_RESOLVE');

await this.client.api('guild-events', guildScheduledEventId).delete();
}
Expand Down
8 changes: 4 additions & 4 deletions src/structures/GuildAuditLogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const Util = require('../util/Util');
* * STAGE_INSTANCE
* * STICKER
* * THREAD
* * GUILD_EVENT
* * GUILD_SCHEDULED_EVENT
* @typedef {string} AuditLogTargetType
*/

Expand All @@ -37,7 +37,7 @@ const Util = require('../util/Util');
const Targets = {
ALL: 'ALL',
GUILD: 'GUILD',
GUILD_EVENT: 'GUILD_EVENT',
GUILD_SCHEDULED_EVENT: 'GUILD_SCHEDULED_EVENT',
CHANNEL: 'CHANNEL',
USER: 'USER',
ROLE: 'ROLE',
Expand Down Expand Up @@ -252,7 +252,7 @@ class GuildAuditLogs {
if (target < 83) return Targets.INTEGRATION;
if (target < 86) return Targets.STAGE_INSTANCE;
if (target < 100) return Targets.STICKER;
if (target < 110) return Targets.GUILD_EVENT;
if (target < 110) return Targets.GUILD_SCHEDULED_EVENT;
if (target < 120) return Targets.THREAD;
return Targets.UNKNOWN;
}
Expand Down Expand Up @@ -588,7 +588,7 @@ class GuildAuditLogsEntry {
{ id: data.target_id },
),
);
} else if (targetType === Targets.GUILD_EVENT) {
} else if (targetType === Targets.GUILD_SCHEDULED_EVENT) {
this.target =
guild.scheduledEvents.cache.get(data.target_id) ??
new GuildScheduledEvent(
Expand Down

0 comments on commit ccc1a17

Please sign in to comment.