WidgetModeration
- class asyncpraw.models.WidgetModeration(widget: asyncpraw.models.Widget, subreddit: asyncpraw.models.Subreddit | str, reddit: asyncpraw.Reddit)
Class for moderating a particular widget.
Example usage:
subreddit = await reddit.subreddit("test") sidebar = [widget async for widget in subreddit.widgets.sidebar()] widget = sidebar[0] await widget.mod.update(shortName="My new title") await widget.mod.delete()
- __init__(widget: asyncpraw.models.Widget, subreddit: asyncpraw.models.Subreddit | str, reddit: asyncpraw.Reddit)
Initialize a
WidgetModeration
instance.
- await delete()
Delete the widget.
Example usage:
await widget.mod.delete()
- await update(**kwargs) asyncpraw.models.ButtonWidget | asyncpraw.models.Calendar | asyncpraw.models.CommunityList | asyncpraw.models.CustomWidget | asyncpraw.models.IDCard | asyncpraw.models.ImageWidget | asyncpraw.models.Menu | asyncpraw.models.ModeratorsWidget | asyncpraw.models.PostFlairWidget | asyncpraw.models.RulesWidget | asyncpraw.models.TextArea | asyncpraw.models.Widget
Update the widget. Returns the updated widget.
Parameters differ based on the type of widget. See Reddit documentation or the document of the particular type of widget.
- Returns:
The updated
Widget
.
For example, update a text widget like so:
await text_widget.mod.update(shortName="New text area", text="Hello!")
Note
Most parameters follow the
lowerCamelCase
convention. When in doubt, check the Reddit documentation linked above.