SubredditEmoji

class praw.models.reddit.emoji.SubredditEmoji(subreddit)

Provides a set of functions to a Subreddit for emoji.

Parameters:

subreddit (models.Subreddit)

__getitem__(name)

Lazily return the Emoji for the subreddit named name.

Parameters:

name (str) – The name of the emoji.

Return type:

Emoji

This method is to be used to fetch a specific emoji url, like so:

emoji = reddit.subreddit("test").emoji["emoji"]
print(emoji)
__init__(subreddit)

Initialize a SubredditEmoji instance.

Parameters:

subreddit (Subreddit) – The subreddit whose emoji are affected.

Return type:

None

__iter__()

Return a list of Emoji for the subreddit.

This method is to be used to discover all emoji for a subreddit:

for emoji in reddit.subreddit("test").emoji:
    print(emoji)
Return type:

Iterator[Emoji]

add(*, image_path, mod_flair_only=None, name, post_flair_allowed=None, user_flair_allowed=None)

Add an emoji to this subreddit.

Parameters:
  • image_path (str) – A path to a jpeg or png image.

  • mod_flair_only (bool | None) – When provided, indicate whether the emoji is restricted to mod use only (default: None).

  • name (str) – The name of the emoji.

  • post_flair_allowed (bool | None) – When provided, indicate whether the emoji may appear in post flair (default: None).

  • user_flair_allowed (bool | None) – When provided, indicate whether the emoji may appear in user flair (default: None).

Return type:

Emoji

Returns:

The Emoji added.

To add "emoji" to r/test try:

reddit.subreddit("test").emoji.add(name="emoji", image_path="emoji.png")