You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Returns true if a thread was started farther back in time than
@@ -56,11 +61,35 @@ module.exports = {
56
61
process.env.SOLVED_TAG_NAME
57
62
);
58
63
64
+
if(tagId===undefined){
65
+
logger.warn(
66
+
`Unable to lock thread "${newThread.name}": couldn't find tag name ${process.env.SOLVED_TAG_NAME} in channel #${newThread.parent.name}.`,
67
+
{
68
+
thread: newThread.name,
69
+
solvedTag: process.env.SOLVED_TAG_NAME,
70
+
channe: newThread.parent.name,
71
+
}
72
+
);
73
+
return;
74
+
}
75
+
59
76
if(wasSolved(oldThread,newThread,tagId)){
60
77
if(!isOldThread(newThread)){
61
78
awaitnewThread.send(
62
79
`Since this is resolved I'm locking the thread. For additional questions or similar issues please start a new thread in <#${newThread.parentId}>. Happy flying!`
63
80
);
81
+
}else{
82
+
constcreatedDate=newDate(
83
+
newThread.createdTimestamp
84
+
).toUTCString();
85
+
logger.info(
86
+
`Not sending closed message to "${newThread.name}" since it was created ${createdDate} which is more than ${process.env.OLD_THREAD_AGE_IN_DAYS} days ago.`,
87
+
{
88
+
thread: newThread.name,
89
+
createdDate,
90
+
oldThreadAge: process.env.OLD_THREAD_AGE_IN_DAYS,
91
+
}
92
+
);
64
93
}
65
94
66
95
awaitnewThread.setLocked(true);
@@ -78,6 +107,9 @@ module.exports = {
78
107
constlastMessage=newThread.lastMessage;
79
108
if(lastMessage?.author.bot){
80
109
awaitnewThread.lastMessage.delete();
110
+
logger.debug(
111
+
`Deleted the last message from the thread since it came from the bot`
0 commit comments