Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions cogs/dpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
DISCORD_PY_JP_ROLE = 490286873311182850
DISCORD_PY_PROF_ROLE = 381978395270971407
DISCORD_PY_HELP_FORUM = 985299059441025044
DISCORD_PY_SHOWCASE_FORUM = 1065212540595998740
DISCORD_PY_SOLVED_TAG = 985309124285837312

GITHUB_TODO_COLUMN = 9341868
Expand Down Expand Up @@ -307,25 +308,26 @@ async def on_message(self, message: discord.Message):

@commands.Cog.listener()
async def on_thread_create(self, thread: discord.Thread) -> None:
if thread.parent_id != DISCORD_PY_HELP_FORUM:
if thread.parent_id != DISCORD_PY_HELP_FORUM and thread.parent_id != DISCORD_PY_SHOWCASE_FORUM:
return

if len(thread.name) <= 20:
low_quality_title = (
'This thread has been automatically closed due to a potentially low quality title. '
'Your title should be descriptive of the problem you are having.\n\n'
'Please remake your thread with a new and more descriptive title.'
)
try:
await thread.send(low_quality_title)
except discord.Forbidden as e:
# Race condition with Discord...
if e.code == 40058:
await asyncio.sleep(2)
if thread.parent_id == DISCORD_PY_HELP_FORUM:
if len(thread.name) <= 20:
low_quality_title = (
'This thread has been automatically closed due to a potentially low quality title. '
'Your title should be descriptive of the problem you are having.\n\n'
'Please remake your thread with a new and more descriptive title.'
)
try:
await thread.send(low_quality_title)
except discord.Forbidden as e:
# Race condition with Discord...
if e.code == 40058:
await asyncio.sleep(2)
await thread.send(low_quality_title)

await thread.edit(archived=True, locked=True, reason='Low quality title.')
return
await thread.edit(archived=True, locked=True, reason='Low quality title.')
return

message = thread.get_partial_message(thread.id)
try:
Expand Down