SubredditEmoji

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

Provides a set of functions to a Subreddit for emoji.

__init__(subreddit: asyncpraw.models.Subreddit)

Initialize a SubredditEmoji instance.

Parameters:

subreddit – The subreddit whose emoji are affected.

await add(*, image_path: str, mod_flair_only: bool | None = None, name: str, post_flair_allowed: bool | None = None, user_flair_allowed: bool | None = None) Emoji

Add an emoji to this subreddit.

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

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

  • name – The name of the emoji.

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

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

Returns:

The Emoji added.

To add "emoji" to r/test try:

subreddit = await reddit.subreddit("test")
await subreddit.emoji.add(name="emoji", image_path="emoji.png")
await get_emoji(name: str, fetch: bool = True, **kwargs) Emoji

Return the Emoji for the subreddit named name.

Parameters:
  • name – The name of the emoji.

  • fetch – Determines if Async PRAW will fetch the object (default: True).

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

subreddit = await reddit.subreddit("test")
emoji = await subreddit.emoji.get_emoji("emoji")
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("test")
emoji = await subreddit.emoji.get_emoji("emoji", fetch=False)
await emoji.delete()