SubredditEmoji¶
- class asyncpraw.models.reddit.emoji.SubredditEmoji(subreddit)¶
Provides a set of functions to a
Subredditfor emoji.- Parameters:
subreddit (asyncpraw.models.Subreddit)
- __init__(subreddit)¶
Initialize a
SubredditEmojiinstance.- Parameters:
subreddit (
Subreddit) – The subreddit whose emoji are affected.- Return type:
None
- await add(*, media, mod_flair_only=None, name, post_flair_allowed=None, user_flair_allowed=None)¶
Add an emoji to this subreddit.
- Parameters:
media (
EmojiMedia) – TheEmojiMediato be uploaded as an emoji.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:
- Returns:
The
Emojiadded.
To add
"emoji"to r/test try:from asyncpraw.models import EmojiMedia media = EmojiMedia("emoji.png") subreddit = await reddit.subreddit("test") await subreddit.emoji.add(media=media, name="emoji")
- await get_emoji(name, *, fetch=True)¶
Return the
Emojifor the subreddit namedname.- Parameters:
- Return type:
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()