From 2d8a6fca53e5a2c0eab5dfc5f60988bbde762846 Mon Sep 17 00:00:00 2001 From: Starman <30315137+Starman3787@users.noreply.github.com> Date: Thu, 22 Aug 2024 17:14:06 +0100 Subject: [PATCH] additional validation --- src/managers/ChannelMessageManager.js | 4 ++++ src/managers/GuildChannelsManager.js | 2 ++ src/managers/GuildEmojisManager.js | 2 ++ src/managers/GuildInviteManager.js | 2 ++ src/managers/GuildMemberManager.js | 2 ++ src/managers/GuildRoleManager.js | 2 ++ src/managers/GuildScheduledEventManager.js | 2 ++ src/managers/MessagePollManager.js | 2 ++ src/managers/MessageReactionManager.js | 3 +++ 9 files changed, 21 insertions(+) diff --git a/src/managers/ChannelMessageManager.js b/src/managers/ChannelMessageManager.js index 21182288..215f9e3f 100644 --- a/src/managers/ChannelMessageManager.js +++ b/src/managers/ChannelMessageManager.js @@ -26,6 +26,10 @@ class ChannelMessageManager extends BaseCacheManager { if (!(client instanceof Client)) throw new TypeError("GLUON: Client must be a Client instance."); + if (!guild) + throw new TypeError("GLUON: Guild must be a valid guild instance."); + if (!channel) + throw new TypeError("GLUON: Channel must be a valid channel instance."); /** * The client instance. diff --git a/src/managers/GuildChannelsManager.js b/src/managers/GuildChannelsManager.js index b7ee9cb3..0b06efda 100644 --- a/src/managers/GuildChannelsManager.js +++ b/src/managers/GuildChannelsManager.js @@ -25,6 +25,8 @@ class GuildChannelsManager extends BaseCacheManager { if (!(client instanceof Client)) throw new TypeError("GLUON: Client must be a Client instance."); + if (!guild) + throw new TypeError("GLUON: Guild must be a valid guild instance."); /** * The client instance. diff --git a/src/managers/GuildEmojisManager.js b/src/managers/GuildEmojisManager.js index c2851541..8fd95d5c 100644 --- a/src/managers/GuildEmojisManager.js +++ b/src/managers/GuildEmojisManager.js @@ -19,6 +19,8 @@ class GuildEmojisManager extends BaseCacheManager { if (!(client instanceof Client)) throw new TypeError("GLUON: Client must be a Client instance."); + if (!guild) + throw new TypeError("GLUON: Guild must be a valid guild instance."); /** * The client instance. diff --git a/src/managers/GuildInviteManager.js b/src/managers/GuildInviteManager.js index c17807de..4c50b8a3 100644 --- a/src/managers/GuildInviteManager.js +++ b/src/managers/GuildInviteManager.js @@ -21,6 +21,8 @@ class GuildInviteManager extends BaseCacheManager { if (!(client instanceof Client)) throw new TypeError("GLUON: Client must be a Client instance."); + if (!guild) + throw new TypeError("GLUON: Guild must be a valid guild instance."); /** * The client instance. diff --git a/src/managers/GuildMemberManager.js b/src/managers/GuildMemberManager.js index 8ef2e4f4..81c400b7 100644 --- a/src/managers/GuildMemberManager.js +++ b/src/managers/GuildMemberManager.js @@ -19,6 +19,8 @@ class GuildMemberManager extends BaseCacheManager { if (!(client instanceof Client)) throw new TypeError("GLUON: Client must be a Client instance."); + if (!guild) + throw new TypeError("GLUON: Guild must be a valid guild instance."); /** * The client instance. diff --git a/src/managers/GuildRoleManager.js b/src/managers/GuildRoleManager.js index 1eee1ae2..ac699f37 100644 --- a/src/managers/GuildRoleManager.js +++ b/src/managers/GuildRoleManager.js @@ -20,6 +20,8 @@ class GuildRoleManager extends BaseCacheManager { if (!(client instanceof Client)) throw new TypeError("GLUON: Client must be a Client instance."); + if (!guild) + throw new TypeError("GLUON: Guild must be a valid guild instance."); /** * The client instance. diff --git a/src/managers/GuildScheduledEventManager.js b/src/managers/GuildScheduledEventManager.js index 99fc270f..1618754a 100644 --- a/src/managers/GuildScheduledEventManager.js +++ b/src/managers/GuildScheduledEventManager.js @@ -11,6 +11,8 @@ class GuildScheduledEventManager extends BaseCacheManager { if (!(client instanceof Client)) throw new TypeError("GLUON: Client must be a Client instance."); + if (!guild) + throw new TypeError("GLUON: Guild must be a valid guild instance."); /** * The client instance. diff --git a/src/managers/MessagePollManager.js b/src/managers/MessagePollManager.js index 69bccf22..592b5763 100644 --- a/src/managers/MessagePollManager.js +++ b/src/managers/MessagePollManager.js @@ -14,6 +14,8 @@ class MessagePollManager { constructor(client, existingResponses = {}) { if (!(client instanceof Client)) throw new TypeError("GLUON: Client must be an instance of Client."); + if (typeof existingResponses !== "object") + throw new TypeError("GLUON: Existing responses must be an object."); /** * The client instance. diff --git a/src/managers/MessageReactionManager.js b/src/managers/MessageReactionManager.js index b723e471..e811a28d 100644 --- a/src/managers/MessageReactionManager.js +++ b/src/managers/MessageReactionManager.js @@ -16,6 +16,9 @@ class MessageReactionManager { constructor(client, guild, existingReactions = {}) { if (!(client instanceof Client)) throw new TypeError("GLUON: Client must be an instance of Client."); + if (!guild) throw new TypeError("GLUON: Guild must be provided."); + if (typeof existingReactions !== "object") + throw new TypeError("GLUON: Existing reactions must be an object."); /** * The client instance.