1-
1+
22import type {
33 Message ,
44 CollectorFilter ,
@@ -211,6 +211,7 @@ const createJobPost = async (
211211 // const url = generateURL(guild.id, channelID, msgID);
212212 try {
213213 const msg = await targetChannel . send ( {
214+ content : `Job Poster: <@${ userID } >` ,
214215 embeds : [
215216 createEmbed ( {
216217 author : {
@@ -219,11 +220,6 @@ const createJobPost = async (
219220 description : `A user has created a new job post!` ,
220221 // Using the spam provider because we only need the color/icon, which it provides anyway
221222 fields : [
222- {
223- inline : true ,
224- name : 'User' ,
225- value : `<@!${ userID } >` ,
226- } ,
227223 {
228224 inline : true ,
229225 name : 'Created On' ,
@@ -245,7 +241,7 @@ const createJobPost = async (
245241 new MessageButton ( )
246242 . setCustomId ( `job🤔${ userID } 🤔response` )
247243 . setStyle ( 'PRIMARY' )
248- . setLabel ( 'DM me the username ' )
244+ . setLabel ( 'DM me the posting ' )
249245 . setEmoji ( '✉️' ) ,
250246 new MessageButton ( )
251247 . setCustomId ( `job🤔${ userID } 🤔delete` )
@@ -286,10 +282,10 @@ const handleJobPostingRequest = async (
286282
287283 const filter : CollectorFilter < [ Message ] > = m => m . author . id === id ;
288284 const send = ( str : string ) => author . send ( str ) ;
285+ // Generate cache entry
286+ const entry = generateCacheEntry ( id ) ;
289287
290288 try {
291- // Generate cache entry
292- const entry = generateCacheEntry ( id ) ;
293289 // Check if the user has been cached
294290 const isCached = cache . get ( entry . key ) ;
295291
@@ -317,8 +313,6 @@ const handleJobPostingRequest = async (
317313 // Notify the user regarding the rules, and get the channel
318314 const channel = await author . createDM ( ) ;
319315
320- const { id : channelID } = channel ;
321-
322316 const form = new MultistepForm ( questions , channel , author ) ;
323317
324318 const answers = ( await form . getResult ( 'guidelines' ) ) as unknown as Answers ;
@@ -342,9 +336,13 @@ const handleJobPostingRequest = async (
342336 // Store the job post in the cache
343337 cache . set ( entry . key , entry . value , POST_LIMITER ) ;
344338 } catch ( error ) {
339+ cache . del ( entry . key )
340+
345341 interaction . reply (
346342 'Please temporarily enable direct messages as the bot cares about your privacy.'
347343 ) ;
344+
345+
348346 // eslint-disable-next-line no-console
349347 console . error ( 'post.handleJobPostingRequest' , error ) ;
350348 }
0 commit comments