Sidebar Fails to Update with subreddit.mod.update(description=x) Coroutine
TheVexedGerman opened this issue · 2 comments
Describe the bug
Trying to edit a subreddit's sidebar via the subreddit.mod.update() coroutine fails silently.
To Reproduce
Steps to reproduce the behavior:
- Create the subreddit object
- Call the update coroutine on subreddit moderation with the description parameter
- Check subreddit to see that the sidebar hasn't changed.
Expected behavior
The expected behavior is that the sidebar would be updated to the text passed as a parameter. Editing the wiki page at config/sidebar works as a workaround.
Code/Logs
@commands.command(name='edit_sidebar')
async def edit_sidebar_links(self, ctx, post_id: str):
new_link = f'https://redd.it/{post_id}'
sub = await self.reddit.subreddit(SUBREDDIT)
await sub.load()
description = sub.description
description = re.sub(r'(?<=\[Meta Thread here\]\().*?(?=\))', new_link, description)
await sub.mod.update(description=description)
System Info
- OS: Ubuntu 18.04
- Python: 3.8.0
- Async PRAW Version: 7.1.1
This is a bug that exists in both PRAW and Async PRAW. See here for a workaround: praw-dev/praw#1631.
This has been addressed by #77.
After doing some digging, it appears that the sidebar (description
) is not accepted by the endpoint used by subreddit.mod.update
. Moving forward the suggested way to update the sidebar is as follows:
subreddit = await reddit.subreddit("test")
sidebar = await subreddit.wiki.get_page("config/sidebar")
await sidebar.edit(content="new sidebar content")
See the note at the bottom of this page for more info.
Since this was addressed with #77, I will be closing this issue. Thanks for reporting this!