Skip to content

Commit

Permalink
Countermeasures against being closed without using the "クローズする" button (
Browse files Browse the repository at this point in the history
  • Loading branch information
Mogyuchi authored Mar 9, 2024
1 parent 54d3e02 commit 7e5c746
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/handleReopenNotify.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
*/
export async function handleReopenNotify(logger, entry, thread, setting) {
logger.info(`"${thread.name}" (${thread.id}) has been reopened.`)
if (entry.executorId === thread.client.user.id) return
if (!entry.executorId) {
await thread.send(setting.onReopen())
return
Expand All @@ -43,6 +44,12 @@ export async function handleReopenNotify(logger, entry, thread, setting) {
error instanceof DiscordjsError &&
error.code === DiscordjsErrorCodes.InteractionCollectorError
) {
if (thread.archived) {
await thread.setArchived(false)
await message.delete()
await thread.setArchived()
return
}
await message.edit({
content: setting.onReopenButtonRejected(entry.executorId),
components: [],
Expand Down

0 comments on commit 7e5c746

Please sign in to comment.