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(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 – When provided, indicate whether the emoji is restricted to mod use only (default: None).

  • 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("emoji", "emoji.png")
await get_emoji(name: str, fetch: bool = True, **kwargs) asyncpraw.models.reddit.emoji.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()