Skip to content
Merged
Changes from 1 commit
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
34 changes: 34 additions & 0 deletions intbot/core/bot/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,40 @@ async def wiki(ctx):
suppress_embeds=True,
)

@bot.command()
async def close(ctx):
channel = ctx.channel
parent = channel.parent
author = ctx.message.author

# Check if it's a public or private post (thread)
if channel.type in (discord.ChannelType.public_thread, discord.ChannelType.private_thread):

# Check if the post (thread) was sent in a forum,
# so we can add a tag
if parent.type == discord.ChannelType.forum:

# Get tag from forum
tag = None
for _tag in parent.available_tags:
if _tag.name.lower() == "done":
tag = _tag
break

if tag is not None:
await channel.add_tags(tag)

# Remove command message
await ctx.message.delete()

# We need to archive after adding tags in case it was a forum.
# Otherwise we only archive the thread
await channel.edit(archived=True)

# Send notification to the thread
await channel.send(f"# This was marked as done by {author.mention}")



@bot.command()
async def version(ctx):
Expand Down