diff --git a/package.json b/package.json index 3249d7b..a2dd92d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "discord-bot", "type": "module", - "version": "0.3.5", + "version": "0.3.6", "description": "", "main": "index.js", "scripts": { diff --git a/src/lib/startAutoPosting.js b/src/lib/startAutoPosting.js index 15ada71..57e450e 100644 --- a/src/lib/startAutoPosting.js +++ b/src/lib/startAutoPosting.js @@ -44,20 +44,53 @@ export const startAutoPosting = async (client, redisClient) => { continue; } + const surveyPrefixes = [ + '# :ballot_box:', + ':page_facing_up:', + ':thought_balloon:', + ':speech_balloon:', + '## :new:', + ':timer:', + ':green_circle:', + // Number Emojis + ':zero:', + ':one:', + ':two:', + ':three:', + ':four:', + ':five:', + ':six:', + ':seven:', + ':eight:', + ':nine:', + // Letter Emojis + ':regional_indicator_a:', + ':regional_indicator_b:', + ':regional_indicator_c:', + ':regional_indicator_d:', + ':regional_indicator_e:', + ':regional_indicator_f:', + ':regional_indicator_g:', + ':regional_indicator_h:', + ':regional_indicator_i:', + ':regional_indicator_j:', + '▬▬▬▬' + ]; + + try { if (channel.isThread()) { const messages = await channel.messages.fetch(); - const surveyMessage = messages.find( - (msg) => - msg.content.startsWith("# :ballot_box:") || - msg.content.startsWith("## :new:"), + const surveyMessage = messages.find((msg) => + surveyPrefixes.some((prefix) => msg.content.startsWith(prefix)) ); + if (surveyMessage) { await surveyMessage.delete(); log.debug(`Deleted survey message: ${surveyMessage.id}`); } else { - log.debug(`No message starting with :ballot_box: found.`); + log.debug(`No survey message found with the specified prefixes.`); } } } catch (error) {