hackclub / toriel

👋 A friendly bot that assists new members with joining Hack Club
https://toriel.hackclub.com
33 stars 16 forks source link

Configure timing of help message scheduling #224

Closed ShubhamPatilsd closed 7 months ago

ShubhamPatilsd commented 7 months ago

Configured it so that help message is scheduled 6 hours after the user is dropped into the slack. Also, mirrored message to say that someone has been dropped in cave.

index.js

  if (
    subtype === 'channel_join' &&
    text === `<@${user}> has joined the channel` &&
    defaultAddsId.includes(channel)
  ) {
    console.log('Deleting "user has joined" message')
    await client.chat
      .delete({
        token: process.env.SLACK_LEGACY_TOKEN, // sudo
        channel,
        ts,
      })
      .catch((e) => {
        console.warn(e)
      })
    mirrorMessage({
      message: `<@${user}> has been dropped into cave`,
      user,
      channel,
      type,
    })
    scheduleHelpMeMessage(client, user)
  } // delete "user has joined" message if it is sent in one of the default channels that TORIEL adds new members to
})