Add a cog to bump threads#2084
Conversation
02e07e3 to
4dda4ca
Compare
vivekashok1221
left a comment
There was a problem hiding this comment.
Neat and concise!
4dda4ca to
805a994
Compare
ca1ccc0 to
0ae5ee9
Compare
df6c8a4 to
a958d6d
Compare
ab268b8 to
8181821
Compare
ToxicKidz
left a comment
There was a problem hiding this comment.
LGTM, works well,
, just one comment.
c68d629 to
3647317
Compare
vivekashok1221
left a comment
There was a problem hiding this comment.
Two minor suggestions, feel free to ignore if you feel they're not needed.
| if not ctx.invoked_subcommand: | ||
| await ctx.send_help(ctx.command) | ||
|
|
||
| @thread_bump_group.command(name="add") |
There was a problem hiding this comment.
| @thread_bump_group.command(name="add") | |
| @thread_bump_group.command(name="add", aliases=("a",)) |
How about adding a as an alias to add? Feel free to ignore this comment because add is short as it is, but, personally, I would expect a to be an alias for add since r is an alias for remove.
| else: | ||
| raise commands.BadArgument("You must provide a thread, or run this command within a thread.") | ||
|
|
||
| await self.threads_to_bump.set(thread.id, "sentinel") |
There was a problem hiding this comment.
When trying to add a thread which is already in the bump list, it might be useful to send a message like "Thread is already in the bump list. ".
vivekashok1221
left a comment
There was a problem hiding this comment.
Sorry, but I one more thing I wanted to point out 😅 .
| bumped_threads = [k for k, _ in await self.threads_to_bump.items()] | ||
| if after.id in bumped_threads: | ||
| await self.unarchive_threads_not_manually_archived([after]) |
There was a problem hiding this comment.
PS: I believe you can do something like this here instead.
| bumped_threads = [k for k, _ in await self.threads_to_bump.items()] | |
| if after.id in bumped_threads: | |
| await self.unarchive_threads_not_manually_archived([after]) | |
| if await bumped_threads.contains(after.id): | |
| await self.unarchive_threads_not_manually_archived([after]) |
There was a problem hiding this comment.
You could also use RedisCache.contains() in line 88 if you decide to incorporate this suggestion.
Quite often we want threads such as event discussions, or moderation discussions to live beyond their maximum of 1 week of auto-archival. This cog allows staff to add a thread to a list that will get 'bumped' back open by the bot when they are auto-archived
3647317 to
3346d71
Compare
Quite often we want threads such as event discussions, or moderation discussions to live beyond their maximum of 1 week of auto-archival. This cog allows staff to add a thread to a list that will get 'bumped' back open by the bot when they are auto-archived