@@ -364,52 +364,6 @@ impl GuildChannel {
364364 cache. guild ( self . guild_id )
365365 }
366366
367- /// Calculates the permissions of a member.
368- ///
369- /// The Id of the argument must be a [`Member`] of the [`Guild`] that the channel is in.
370- ///
371- /// # Examples
372- ///
373- /// Calculate the permissions of a [`User`] who posted a [`Message`] in a channel:
374- ///
375- /// ```rust,no_run
376- /// # use serenity::model::prelude::*;
377- /// # use serenity::prelude::*;
378- /// # struct Handler;
379- ///
380- /// #[serenity::async_trait]
381- /// impl EventHandler for Handler {
382- /// async fn message(&self, context: Context, msg: Message) {
383- /// let Some(guild) = msg.guild(&context.cache) else {
384- /// return;
385- /// };
386- ///
387- /// let Some(channel) = guild.channels.get(&msg.channel_id) else {
388- /// return;
389- /// };
390- ///
391- /// if let Ok(permissions) = channel.permissions_for_user(&context.cache, msg.author.id) {
392- /// println!("The user's permissions: {:?}", permissions);
393- /// }
394- /// }
395- /// }
396- /// ```
397- ///
398- /// # Errors
399- ///
400- /// Returns a [`ModelError::GuildNotFound`] if the channel's guild could not be found in the
401- /// [`Cache`].
402- ///
403- /// [Attach Files]: Permissions::ATTACH_FILES
404- /// [Send Messages]: Permissions::SEND_MESSAGES
405- #[ cfg( feature = "cache" ) ]
406- #[ deprecated = "Use `Guild::user_permissions_in`" ]
407- pub fn permissions_for_user ( & self , cache : & Cache , user_id : UserId ) -> Result < Permissions > {
408- let guild = self . guild ( cache) . ok_or ( Error :: Model ( ModelError :: GuildNotFound ) ) ?;
409- let member = guild. members . get ( & user_id) . ok_or ( Error :: Model ( ModelError :: MemberNotFound ) ) ?;
410- Ok ( guild. user_permissions_in ( self , member) )
411- }
412-
413367 /// Sends a message to the channel.
414368 ///
415369 /// Refer to the documentation for [`CreateMessage`] for information regarding content
0 commit comments