<commit_before># @drm2/twitterbot

A JavaScript/Node framework for building better Twitter bots. Built on Twit with full Promise support.

## Installation

@drm2/twitterbot is available via NPM.

```bash
npm install @drm2/twitterbot --save
```

## Features

- REST API Access
- Streaming API Access
- Scheduling

## API

### Initialization

TwitterBot is built on top of Twit, so it is initialized the same way.

#### Example

```javascript
var TwitterBot = require('@drm2/twitterbot');

var options = {
    consumer_key: process.env.TWITTER_CONSUMER_KEY,
    consumer_secret: process.env.TWITTER_CONSUMER_SECRET,
    access_token: process.env.TWITTER_ACCESS_TOKEN,
    access_token_secret: process.env.TWITTER_ACCESS_TOKEN_SECRET,
};

var bot = new TwitterBot(options);
```

#### References

Twit

- [Initialization](https://github.com/ttezel/twit/blob/master/README.md#var-t--new-twitconfig)

Twitter

- [Authentication and Authorization](https://dev.twitter.com/oauth/overview/application-owner-access-tokens)

### `[TwitterBot].tweet(message)`

Posts a new Tweet.

#### message: string

The status you want to post on Twitter.

#### Example

```javascript
bot.tweet('Hello, World!')
    .catch(function (error) {
        console.log('Error:', error);
    })
    .then(function (result) {
        console.log('Data:', result.data);
        console.log('Response:', result.resp);
    });
```

### `[TwitterBot].getTweet(id)`

Retrieves a Tweet with the given id.

#### id: string

The id of the Tweet you want to retrieve.

#### Example

```javascript
bot.getTweet('IdOfTheTweetYouWantToRetrieve')
    .catch(function (error) {
        console.log('Error:', error);
    })
    .then(function (result) {
        console.log('Data:', result.data);
        console.log('Response:', result.resp);
    });
```

### `[TwitterBot].removeTweet(id)`

Removes a Tweet with the given id.

#### id: string<commit_msg>Adding external references for [TwitterBot].tweet().<commit_after># @drm2/twitterbot

A JavaScript/Node framework for building better Twitter bots. Built on Twit with full Promise support.

## Installation

@drm2/twitterbot is available via NPM.

```bash
npm install @drm2/twitterbot --save
```

## Features

- REST API Access
- Streaming API Access
- Scheduling

## API

### Initialization

TwitterBot is built on top of Twit, so it is initialized the same way.

#### Example

```javascript
var TwitterBot = require('@drm2/twitterbot');

var options = {
    consumer_key: process.env.TWITTER_CONSUMER_KEY,
    consumer_secret: process.env.TWITTER_CONSUMER_SECRET,
    access_token: process.env.TWITTER_ACCESS_TOKEN,
    access_token_secret: process.env.TWITTER_ACCESS_TOKEN_SECRET,
};

var bot = new TwitterBot(options);
```

#### References

Twit

- [Initialization](https://github.com/ttezel/twit/blob/master/README.md#var-t--new-twitconfig)

Twitter

- [Authentication and Authorization](https://dev.twitter.com/oauth/overview/application-owner-access-tokens)

### `[TwitterBot].tweet(message)`

Posts a new Tweet.

#### message: string

The status you want to post on Twitter.

#### Example

```javascript
bot.tweet('Hello, World!')
    .catch(function (error) {
        console.log('Error:', error);
    })
    .then(function (result) {
        console.log('Data:', result.data);
        console.log('Response:', result.resp);
    });
```

#### References

Twit

- [Twit.post()](https://github.com/ttezel/twit/blob/master/README.md#tpostpath-params-callback)

Twitter

- [POST statuses/update](https://dev.twitter.com/rest/reference/post/statuses/update)

### `[TwitterBot].getTweet(id)`

Retrieves a Tweet with the given id.

#### id: string

The id of the Tweet you want to retrieve.

#### Example

```javascript
bot.getTweet('IdOfTheTweetYouWantToRetrieve')
    .catch(function (error) {
        console.log('Error:', error);
    })
    .then(function (result) {
        console.log('Data:', result.data);
        console.log('Response:', result.resp);
    });
```

### `[TwitterBot].removeTweet(id)`

Removes a Tweet with the given id.

#### id: string
{'fraction_non_alphanumeric': 0.1501597444089457, 'fraction_numerical': 0.001966085033177685, 'mean_word_length': 4.006150061500615, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '159065', 'n_tokens_mistral': 1405, 'n_tokens_neox': 1339, 'n_words': 307}