/KFUPM-semester-progress-bar

A Twitter bot that tweets the current progress of a KFUPM current semester

Primary LanguageTypeScriptApache License 2.0Apache-2.0

KFUPM Semester Progress Twitter Bot

TypeScript version Node.js version APLv2 Build Status - GitHub Actions

A Twitter bot that tweets the current progress of the KFUPM current semester.

The tweet will look something like this:

 [🁢🁢🁢🁢🁢🁢🁢🁢🁢🁢🁢🁢🁢🁢🁢🁢🁢🁢🁢🁢]100% 🎉

130/130 days left 🗓

Today: Last day for faculty to submit grades to the Deanship (2:00 PM);Official Graduation Date 💡


#KFUPM

Don't forget to follow the bot account KFUPM_SP 🫶

Table of Contents

Contribute to This Project

Repo Issues

If you find a bug throughout your development or testing process, please do not hesitate to file an issue describing the bug you noticed.

How to File an Issue?

Here is how you create an issue:

  • Go to the issues tab.
  • Click on "New issue".
  • Add an informative title following the naming convention below.
  • Add a detailed description with the suggested solution if possible.
  • Select applicable labels after reading each label's description.

Creating a New Branch

If you want to start working on a new feature/fix a bug, create a new branch with a descriptive title preceded by your name as @yourname/new-feature-title.

Note: branch names are all small cases separated by a dash -, e.g. @hady/twitter-api-migration

Conventions

Commits and PRs

The commit message should be structured as follows:

<type>[optional scope]: <description>

[optional body]

[optional footer(s)]

The commit contains the following structural elements:

  • fix: a commit of the type fix patches a bug in the codebase.

  • feat: a commit of the type feat introduces a new feature to the codebase.

  • BREAKING CHANGE: a commit that has a footer BREAKING CHANGE:, or appends a ! after the type/scope, introduces a breaking change.

  • types other than fix: and feat: are allowed, for example build:, chore:, ci:, docs:, style:, refactor:, perf:, test:, and others.

Refer to Conventional Commits for more information.

TypeScript File Naming

  • Small letters only.
  • Use underscore as delimiters.
  • Keep it short, clear, and simple.

Examples : date_helper.ts settings_controller.ts

Build, Run and Deploy

This project is intended to be used with the latest Active LTS release of Node.js.

Clone Repository

To clone this repo:

  1. Open a new terminal/powershell window.

  2. Clone the repo:

    git clone https://github.com/hadysata/KFUPM-semester-progress-bar.git
  3. Open the project in your favorite IDE/Code editor

Setup

  1. In the project root folder, run
npm i && cd functions && npm i
  1. If you wish to use Firebase cloud functions, run:
npm install -g firebase-tools
cd functions && firebase init

Follow the instructions in your CLI, and make sure to setup Firebase cloud functions(Your Firebase project plan should be Blaze)

  1. In the project root folder, create a new .env file with the following variables:
APP_KEY=""
APP_SECRET=""
ACCESS_TOKEN=""
ACCESS_SECRET=""

These are Twitter keys used by the bot to use Twitter API; you can get these keys from Twitter developer portal

Run

To run the script, in the project root folder run:

npm run build
npm run start

To run the simulator, run:

npm run start:simulator

To run the bot on Firebase cloud functions, run:

cd fuctions
npm run serve

Deploy

To deploy the bot script to Firebase cloud functions, run:

cd fuctions
firebase deploy

You could also run this script on other cloud platform such as Heroku or Railway; just make sure to setup a cron job/scheduler to run this script in any time interval you want.

What is a simulator?

The simulator script will simulate and try to generate whole semester tweets; this script is connected to Github workflow, so any changes that break the simulator will result in a failing test.

License

Licensed under the APLv2. See the LICENSE file for details.