@@ -68,22 +68,22 @@ export default event({
6868 message . channel . setAppliedTags ( tags ) ;
6969 // If this is a new post and not just a regular message
7070 // Disabled for now due to the fact that nobody reads the message
71- if ( ! message . nonce && message . position === 0 && false ) {
72- const msg = await message . channel . send (
73- wrap_in_embed (
74- `Thank you for your message!
71+ // if (!message.nonce && message.position === 0) {
72+ // const msg = await message.channel.send(
73+ // wrap_in_embed(
74+ // `Thank you for your message!
7575
76- 1. Search the <#${ SUPPORT_FORUM } > forum for existing posts
77- 2. Search Github issues to see if this is a known issue
78- 3. Send the output of \`tauri info\`
79- 4. Provide reproduction steps for your issue
80- 5. Be polite and remember to follow the [Tauri Code of Conduct](https://github.com/tauri-apps/governance-and-guidance/blob/main/CODE_OF_CONDUCT.md)
76+ // 1. Search the <#${SUPPORT_FORUM}> forum for existing posts
77+ // 2. Search Github issues to see if this is a known issue
78+ // 3. Send the output of \`tauri info\`
79+ // 4. Provide reproduction steps for your issue
80+ // 5. Be polite and remember to follow the [Tauri Code of Conduct](https://github.com/tauri-apps/governance-and-guidance/blob/main/CODE_OF_CONDUCT.md)
8181
82- Once you've read this and taken the appropriate steps, react to this message` ,
83- ) ,
84- ) ;
85- await msg . react ( MESSAGE_READ ) ;
86- }
82+ // Once you've read this and taken the appropriate steps, react to this message`,
83+ // ),
84+ // );
85+ // await msg.react(MESSAGE_READ);
86+ // }
8787 } else if (
8888 message . channel instanceof ThreadChannel &&
8989 JOBS_FORUM === message . channel . parentId &&
@@ -126,7 +126,9 @@ export default event({
126126 . filter ( ( thread ) => thread . ownerId === message . author . id )
127127 . filter ( ( thread ) => thread . id !== message . id ) ;
128128 // bulkDelete only works for messages younger than 2 weeks.
129- console . log ( `Deleting ${ userThreads . length } threads` ) ;
129+ console . log (
130+ `Deleting ${ userThreads . length } threads of same author` ,
131+ ) ;
130132 userThreads . forEach ( ( thread ) =>
131133 thread
132134 . delete ( )
@@ -137,10 +139,58 @@ export default event({
137139 } )
138140 . catch ( ( err ) =>
139141 console . error (
140- `Error deleting thread ${ thread . id } : ${ err } ` ,
142+ `Error deleting thread ${ thread . id } " ${ thread . name } " : ${ err } ` ,
141143 ) ,
142144 ) ,
143145 ) ;
146+
147+ const oldThreads = allJobPosts
148+ . filter (
149+ ( thread ) =>
150+ thread . createdTimestamp + 15778476 < Date . now ( ) ,
151+ )
152+ . filter ( ( thread ) => thread . archived ) ;
153+ console . log (
154+ `Deleting ${ oldThreads . length } old archived threads` ,
155+ ) ;
156+ oldThreads . forEach ( async ( thread ) => {
157+ try {
158+ if ( thread . id === '1115981718336311296' ) {
159+ console . log ( 'skipping Guidelines thread' ) ;
160+ return ;
161+ }
162+ const owner = await thread . fetchOwner ( ) ;
163+ if (
164+ owner . guildMember . roles . cache . some (
165+ ( role ) => role . name === 'working-group' ,
166+ )
167+ ) {
168+ console . log (
169+ `skipping thread ${ thread . id } "${ thread . name } " by WG member` ,
170+ ) ;
171+ return ;
172+ }
173+ userThreads . forEach ( ( thread ) =>
174+ thread
175+ . delete ( )
176+ . then ( ( ) => {
177+ console . log (
178+ `thread ${ thread . id } "${ thread . name } " deleted` ,
179+ ) ;
180+ } )
181+ . catch ( ( err ) =>
182+ console . error (
183+ `Error deleting thread ${ thread . id } "${ thread . name } ": ${ err } ` ,
184+ ) ,
185+ ) ,
186+ ) ;
187+ } catch ( err ) {
188+ console . error (
189+ `Error handling old thread ${ thread . id } - "${ thread . name } "` ,
190+ err ,
191+ ) ;
192+ }
193+ } ) ;
144194 } catch ( err ) {
145195 console . error ( 'Error handling post in Jobs forum.' , err ) ;
146196 }
0 commit comments