# ModeratorRelationship

class `praw.models.reddit.subreddit.``ModeratorRelationship`(subreddit, relationship)

  Provides methods to interact with a Subreddit’s moderators.

  Moderators of a subreddit can be iterated through like so:

      for moderator in reddit.subreddit('redditdev').moderator():
          print(moderator)

  `__call__`(redditor=None)

    Return a list of Redditors who are moderators.

    Parameters: | redditor – When provided, return a list containing at most one `Redditor` instance. This is useful to confirm if a relationship exists, or to fetch the metadata associated with a particular relationship (default: None).

    Note

    Unlike other relationship callables, this relationship is not paginated. Thus it simply returns the full list, rather than an iterator for the results.

    To be used like:

        moderators = reddit.subreddit('nameofsub').moderator()

    For example, to list the moderators along with their permissions try:

        for moderator in reddit.subreddit('SUBREDDIT').moderator():
            print('{}: {}'.format(moderator, moderator.mod_permissions))

  `__init__`(subreddit, relationship)

    Create a SubredditRelationship instance.

    Parameters:

    - subreddit – The subreddit for the relationship.
    - relationship – The name of the relationship.

  `add`(redditor, permissions=None, **other_settings)

    Add or invite `redditor` to be a moderator of the subreddit.

    Parameters:

    - redditor – A redditor name (e.g., `'spez'`) or `Redditor` instance.
    - permissions – When provided (not `None`), permissions should be a list of strings specifying which subset of permissions to grant. An empty list `[]` indicates no permissions, and when not provided `None`, indicates full permissions.

    An invite will be sent unless the user making this call is an admin user.

    For example, to invite `'spez'` with `'posts'` and `'mail'`
      permissions to `'/r/test/`, try:

        reddit.subreddit('test').moderator.add('spez', ['posts', 'mail'])

  `invite`(redditor, permissions=None, **other_settings)

    Invite `redditor` to be a moderator of the subreddit.

    Parameters:

    - redditor – A redditor name (e.g., `'spez'`) or `Redditor` instance.
    - permissions – When provided (not `None`), permissions should be a list of strings specifying which subset of permissions to grant. An empty list `[]` indicates no permissions, and when not provided `None`, indicates full permissions.

    For example, to invite `'spez'` with `'posts'` and `'mail'`
      permissions to `'/r/test/`, try:

        reddit.subreddit('test').moderator.invite('spez', ['posts', 'mail'])

  `leave`()

    Abdicate the moderator position (use with care).

    Example:

        reddit.subreddit('subredditname').moderator.leave()

  `remove`(redditor)

    Remove `redditor` from this relationship.

    Parameters: | redditor – A redditor name (e.g., `'spez'`) or `Redditor` instance.

  `remove_invite`(redditor)

    Remove the moderator invite for `redditor`.

    Parameters: | redditor – A redditor name (e.g., `'spez'`) or `Redditor` instance.

    Example:

        reddit.subreddit('subredditname').moderator.remove_invite('spez')

  `update`(redditor, permissions=None)

    Update the moderator permissions for `redditor`.

    Parameters:

    - redditor – A redditor name (e.g., `'spez'`) or `Redditor` instance.
    - permissions – When provided (not `None`), permissions should be a list of strings specifying which subset of permissions to grant. An empty list `[]` indicates no permissions, and when not provided, `None`, indicates full permissions.

    For example, to add all permissions to the moderator, try:

        subreddit.moderator.update('spez')

    To remove all permissions from the moderator, try:

        subreddit.moderator.update('spez', [])

  `update_invite`(redditor, permissions=None)

    Update the moderator invite permissions for `redditor`.

    Parameters:

    - redditor – A redditor name (e.g., `'spez'`) or `Redditor` instance.
    - permissions – When provided (not `None`), permissions should be a list of strings specifying which subset of permissions to grant. An empty list `[]` indicates no permissions, and when not provided, `None`, indicates full permissions.

    For example, to grant the flair and mail permissions to the moderator invite, try:

        subreddit.moderator.update_invite('spez', ['flair', 'mail'])