SubredditEmoji

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

Provides a set of functions to a Subreddit for emoji.

__getitem__(name: str) → praw.models.reddit.emoji.Emoji

Lazily return the Emoji for the subreddit named name.

Parameters

name – The name of the emoji

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

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

Create a SubredditEmoji instance.

Parameters

subreddit – The subreddit whose emoji are affected.

__iter__() → List[praw.models.reddit.emoji.Emoji]

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("praw_test").emoji:
    print(emoji)
add(name: str, image_path: str, mod_flair_only: Optional[bool] = None, post_flair_allowed: Optional[bool] = None, user_flair_allowed: Optional[bool] = None) → praw.models.reddit.emoji.Emoji

Add an emoji to this subreddit.

Parameters
  • name – The name of the emoji

  • image_path – A path to a jpeg or png image.

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

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

  • user_flair_allowed – (boolean) When provided, indicate whether the emoji may appear in user flair. (Default: None) :returns: The Emoji added.

To add test to the subreddit praw_test try:

reddit.subreddit("praw_test").emoji.add("test", "test.png")