SubredditEmoji

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

Provides a set of functions to a Subreddit for emoji.

__init__(subreddit: Subreddit)

Create a SubredditEmoji instance.

Parameters

subreddit – The subreddit whose emoji are affected.

await add(name: str, image_path: str, mod_flair_only: Optional[bool] = None, post_flair_allowed: Optional[bool] = None, user_flair_allowed: Optional[bool] = None) → asyncpraw.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:

subreddit = await reddit.subreddit("praw_test")
await subreddit.emoji.add("test", "test.png")
await get_emoji(name: str, lazy: bool = False) → asyncpraw.models.reddit.emoji.Emoji

Return the Emoji for the subreddit named name.

Parameters
  • name – The name of the emoji

  • lazy – If True, object is loaded lazily (default: False)

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

subreddit = await reddit.subreddit("praw_test")
emoji = await subreddit.emoji.get_emoji("test")
print(emoji)

If you don’t need the object fetched right away (e.g., to utilize a class method) you can do:

subreddit = await reddit.subreddit("praw_test")
emoji = await subreddit.emoji.get_emoji("test", lazy=True)
await emoji.delete()