@@ -98,17 +98,29 @@ class GuildChannelManager extends CachedManager {
98
98
return super . resolveId ( channel ) ;
99
99
}
100
100
101
+ /**
102
+ * Data that can be resolved to a News Channel object. This can be:
103
+ * * A NewsChannel object
104
+ * * A Snowflake
105
+ * @typedef {NewsChannel|Snowflake } NewsChannelResolvable
106
+ */
107
+
101
108
/**
102
109
* Adds the target channel to a channel's followers.
103
- * @param {NewsChannel|Snowflake } channel The channel to follow
110
+ * @param {NewsChannelResolvable } channel The channel to follow
104
111
* @param {TextChannelResolvable } targetChannel The channel where published announcements will be posted at
105
112
* @param {string } [reason] Reason for creating the webhook
106
113
* @returns {Promise<Snowflake> } Returns created target webhook id.
107
114
*/
108
115
async addFollower ( channel , targetChannel , reason ) {
109
116
const channelId = this . resolveId ( channel ) ;
117
+ if ( ! channelId ) {
118
+ throw new DiscordjsTypeError ( ErrorCodes . InvalidType , 'channel' , 'NewsChannelResolvable' ) ;
119
+ }
110
120
const targetChannelId = this . resolveId ( targetChannel ) ;
111
- if ( ! channelId || ! targetChannelId ) throw new Error ( ErrorCodes . GuildChannelResolve ) ;
121
+ if ( ! targetChannelId ) {
122
+ throw new DiscordjsTypeError ( ErrorCodes . InvalidType , 'targetChannel' , 'TextChannelResolvable' ) ;
123
+ }
112
124
const { webhook_id } = await this . client . rest . post ( Routes . channelFollowers ( channelId ) , {
113
125
body : { webhook_channel_id : targetChannelId } ,
114
126
reason,
0 commit comments