SubredditModNotes#
- class praw.models.SubredditModNotes(reddit: praw.Reddit, subreddit: Union[praw.models.Subreddit, str])#
Provides methods to interact with moderator notes at the subreddit level.
Note
The authenticated user must be a moderator of this subreddit.
For example, all the notes for u/spez in r/test can be iterated through like so:
subreddit = reddit.subreddit("test") for note in subreddit.mod.notes.redditors("spez"): print(f"{note.label}: {note.note}")
- __init__(reddit: praw.Reddit, subreddit: Union[praw.models.Subreddit, str])#
Initialize a
SubredditModNotesinstance.
- create(*, label: Optional[str] = None, note: str, redditor: Optional[Union[Redditor, str]] = None, subreddit: Optional[Union[praw.models.Subreddit, str]] = None, thing: Optional[Union[Comment, Submission, str]] = None, **other_settings: Any) praw.models.ModNote#
Create a
ModNotefor a redditor in the specified subreddit.- Parameters:
label – The label for the note. As of this writing, this can be one of the following:
"ABUSE_WARNING","BAN","BOT_BAN","HELPFUL_USER","PERMA_BAN","SOLID_CONTRIBUTOR","SPAM_WARNING","SPAM_WATCH", orNone(default:None).note – The content of the note. As of this writing, this is limited to 250 characters.
redditor –
The redditor to create the note for (default:
None).Note
This parameter is required if
thingis not provided or this is not called from aRedditorinstance (e.g.,reddit.redditor.notes).subreddit –
The subreddit associated with the note (default:
None).Note
This parameter is required if
thingis not provided or this is not called from aSubredditinstance (e.g.,reddit.subreddit.mod).thing – Either the fullname of a comment/submission, a
Comment, or aSubmissionto associate with the note.other_settings – Additional keyword arguments can be provided to handle new parameters as Reddit introduces them.
- Returns:
The new
ModNoteobject.
For example, to create a note for u/spez in r/test:
reddit.subreddit("test").mod.notes.create( label="HELPFUL_USER", note="Test note", redditor="spez" ) # or reddit.redditor("spez").mod.notes.create( label="HELPFUL_USER", note="Test note", subreddit="test" ) # or reddit.notes.create( label="HELPFUL_USER", note="Test note", redditor="spez", subreddit="test" )
- delete(*, delete_all: bool = False, note_id: Optional[str] = None, redditor: Optional[Union[Redditor, str]] = None, subreddit: Optional[Union[praw.models.Subreddit, str]] = None)#
Delete note(s) for a redditor.
- Parameters:
delete_all –
When
True, delete all notes for the specified redditor in the specified subreddit (default:False).Note
This will make a request for each note.
note_id – The ID of the note to delete. This parameter is ignored if
delete_allisTrue.redditor –
The redditor to delete the note(s) for (default:
None). Can be aRedditorinstance or a redditor name.Note
This parameter is required if this method is not called from a
Redditorinstance (e.g.,redditor.notes).subreddit –
The subreddit to delete the note(s) from (default:
None). Can be aSubredditinstance or a subreddit name.Note
This parameter is required if this method is not called from a
Subredditinstance (e.g.,reddit.subreddit.mod).
For example, to delete a note with the ID
"ModNote_d324b280-5ecc-435d-8159-3e259e84e339", try:reddit.subreddit("test").mod.notes.delete( note_id="ModNote_d324b280-5ecc-435d-8159-3e259e84e339", redditor="spez" ) # or reddit.redditor("spez").notes.delete( note_id="ModNote_d324b280-5ecc-435d-8159-3e259e84e339", subreddit="test" ) # or reddit.notes.delete( note_id="ModNote_d324b280-5ecc-435d-8159-3e259e84e339", subreddit="test", redditor="spez", )
To delete all notes for u/spez, try:
reddit.subreddit("test").mod.notes.delete(delete_all=True, redditor="spez") # or reddit.redditor("spez").notes.delete(delete_all=True, subreddit="test") # or reddit.notes.delete(delete_all=True, subreddit="test", redditor="spez")
- redditors(*redditors: Union[Redditor, str], all_notes: Optional[bool] = None, **generator_kwargs: Any) Generator[praw.models.ModNote, None, None]#
Return notes from this
Subredditfor one or more redditors.- Parameters:
redditors – One or more redditors to retrieve notes for. Must be either a
Redditoror a redditor name.all_notes –
Whether to return all notes or only the latest note (default:
Trueif only one redditor is provided otherwiseFalse).Note
Setting this to
Truewill result in a request for each redditor.
- Returns:
A generator that yields the most recent
ModNote(orNoneif the user doesn’t have any notes in this subreddit) per redditor in their relative order. Ifall_notesisTrue, this will yield all notes for each redditor.
For example, all the notes for u/spez in r/test can be iterated through like so:
subreddit = reddit.subreddit("test") for note in subreddit.mod.notes.redditors("spez"): print(f"{note.label}: {note.note}")
For example, the latest note for u/spez and u/bboe from r/test can be iterated through like so:
subreddit = reddit.subreddit("test") redditor = reddit.redditor("bboe") for note in subreddit.mod.notes.redditors("spez", redditor): print(f"{note.label}: {note.note}")
For example, all the notes for both u/spez and u/bboe in r/test can be iterated through like so:
subreddit = reddit.subreddit("test") redditor = reddit.redditor("bboe") for note in subreddit.mod.notes.redditors("spez", redditor, all_notes=True): print(f"{note.label}: {note.note}")