Skip to content

Bot pings itself when auto-archiving thread due to inactivity #968

@ankitsmt211

Description

@ankitsmt211

Describe the bug

When a help thread is inactive for more than 12 hrs, it's auto archived by a routine. During auto-archive it pings OP and sends some information about why the thread was closed. Ideally it would ping OP, but with transfer-feature help threads also contains Embed posted on behalf of OP by TJ-Bot. In that case, to auto-archive routine it seems as if author of post is Bot itself and hence the ping to itself.

Expected behavior
It should ping the effective author of post(if post contains an embed than find author of embed, otherwise just the author of thread is fine).

To Reproduce
Steps to reproduce the behavior:

  1. Transfer a message using apps>transfer-feature from message context menu.
  2. Wait for 12 hrs of inactivity for routine to trigger(if working on local machine, can change duration of inactivity from 12 hrs to a couple minutes and change that for routine time interval as well).

Screenshots
image

Additional context
Auto-archive(HelpThreadAutoArchiver.java) routine is inside features/help package.
if owner of thread is bot, get the embed from message that started this thread.
Then get the owner of that embed, that is the effective author of post and should be used to ping.

HelpThreadAutoArchiver.java:133 ->
.retrieveMemberById(threadChannel.getOwnerIdLong())//retrives owner of thread
.flatMap(author -> threadChannel.sendMessage(author.getAsMention()).addEmbeds(embed))//pings that owner

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions