@@ -198,6 +198,49 @@ public function kick(?string $reason = null): PromiseInterface
198198 });
199199 }
200200
201+ /**
202+ * Modifies the current member (no validation).
203+ *
204+ * @link https://discord.com/developers/docs/resources/guild#modify-current-member-json-params
205+ *
206+ * @since 10.19.0
207+ *
208+ * @param array $params The parameters to modify.
209+ * @param ?string|null $params['nick'] Value to set user's nickname to.
210+ * @param ?string|null $params['banner'] Data URI base64 encoded banner image.
211+ * @param ?string|null $params['avatar'] Data URL base64 encoded avatar image.
212+ * @param ?string|null $params['bio'] Guild member bio.
213+ * @param string|null $reason Reason for Audit Log.
214+ *
215+ * @throws NoPermissionsException Member is not the current user.
216+ *
217+ * @return PromiseInterface<self>
218+ */
219+ public function modifyCurrentMember (array $ params , ?string $ reason = null ): PromiseInterface
220+ {
221+ if ($ this ->discord ->id != $ this ->id ) {
222+ return reject (new NoPermissionsException ('You can only modify the current member. ' ));
223+ }
224+
225+ $ allowed = ['nick ' , 'banner ' , 'avatar ' , 'bio ' ];
226+ $ params = array_filter (
227+ $ params ,
228+ fn ($ key ) => in_array ($ key , $ allowed , true ),
229+ ARRAY_FILTER_USE_KEY
230+ );
231+
232+ if (empty ($ params )) {
233+ return reject (new \InvalidArgumentException ('No valid parameters to modify. ' ));
234+ }
235+
236+ $ headers = [];
237+ if (isset ($ reason )) {
238+ $ headers ['X-Audit-Log-Reason ' ] = $ reason ;
239+ }
240+
241+ return $ this ->http ->patch (Endpoint::bind (Endpoint::GUILD_MEMBER_SELF , $ this ->guild_id ), $ params , $ headers );
242+ }
243+
201244 /**
202245 * Sets the nickname of the member.
203246 *
0 commit comments