0.0.12 β€’ Published 1 year ago

twict v0.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

πŸš€ Installation

yarn add twict
# or
npm install twict

πŸ—ΊοΈ Tutorial

1. Install twict

yarn add twict
# or
npm install twict

2. ngrok

download ngrok to your environment.

start http tunnel on port 5000 and copy https://*.ngrok.io url.

ngrok http 5000

3. Like detection

// like-detection.ts
import { Activity, isExpectEventType } from 'twict'

async function main() {
  const activity = new Activity('your environment label', {
    consumerKey: 'your consumer key',
    consumerSecret: 'your consumer secret',
    token: 'your access token',
    tokenSecret: 'your access token secret',
  })

  activity.onFavorite((event) => {
    for (const like of event.favorite_events) {
      console.log(
        `${like.user.screen_name} liked your tweet (${like.favorited_status.text})`
      )
    }
  })

  await activity.listen(5000)

  await activity.deleteAllWebhooks()
  await activity.registerWebhook('your ngrok url here')
  await activity.subscribe()
}

main()

and run with ts-node.

npx ts-node like-detection.ts
0.0.11

1 year ago

0.0.12

1 year ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago

0.0.0

3 years ago