https://github.com/statebait/poketwitbot
A simple Twitter bot that tweets about a random pokemon everyday.
https://github.com/statebait/poketwitbot
api axios cheerio cron lodash nodejs pokemon serverless twit twitter-bot
Last synced: 9 months ago
JSON representation
A simple Twitter bot that tweets about a random pokemon everyday.
- Host: GitHub
- URL: https://github.com/statebait/poketwitbot
- Owner: statebait
- License: mit
- Created: 2019-01-29T13:32:52.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-09T06:39:48.000Z (over 3 years ago)
- Last Synced: 2025-04-02T00:44:05.526Z (about 1 year ago)
- Topics: api, axios, cheerio, cron, lodash, nodejs, pokemon, serverless, twit, twitter-bot
- Language: JavaScript
- Homepage: https://twitter.com/PokeTwitBot1
- Size: 110 KB
- Stars: 2
- Watchers: 0
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PokeTwitBot - A twitter bot
## Description
A Simple Twitter Bot built using the [twit](https://github.com/ttezel/twit) Twitter API Client and the [PokeAPI](https://pokeapi.co/) (and a little bit of web scraping from https://www.pokemon.com). The bot will tweet about a pokemon.
## Installation & Usage
> The `api` folder in this repo is for the serverless API setup using [Zeit(Vercel)](https://vercel.com/). It uses an [Airtable](https://airtable.com/invite/r/GPY1lsA0) config for storing which pokemons have been tweeted and uses a cron job service like [EasyCron](https://www.easycron.com/?ref=167187) to hit this API everyday.
**1. Ensure that Node.js and yarn have been installed**
- [Node](https://nodejs.org/)
- [Yarn](https://yarnpkg.com/)
**2. Clone the repo**
```bash
git clone https://github.com/statebait/poketwitbot.git
```
**3. Install Dependencies**
```bash
cd poketwitbot # Go to the project root directory
yarn
```
**4. Create the Environment File**
In the project root directory create a file called `.env` which contains your twitter app's access keys and tokens. The file should look like this:
```bash
TWITTER_USERNAME=
TWITTER_CONSUMER_KEY=
TWITTER_CONSUMER_SECRET=
TWITTER_ACCESS_TOKEN=
TWITTER_ACCESS_TOKEN_SECRET=
```
**5. Run the bot**
To run the bot you will need to import/require the bot.js file in your script, function or whatsoever like this:
```js
const bot = require("./path/to/bot.js");
async function main() {
const { success, error, message } = await bot(250); // Pass in any pokemon id as the argument (pokemon id is the pokemon no. in the pokedex
if (err) {
console.error(message);
} else if (success) {
console.log(message);
}
}
```
## License
This project is licensed under the MIT License - Copyright (c) 2020 Mohamed Shadab