esports-notifier

1.2.3 • Public • Published

ESPORTS NOTIFIER

contributions
npm version

FeaturesRequirementsUsageDevelopmentAbout

see table of content

🎺 Overview

Receive a daily email informing whenever at least one of your favorite esports teams has a match on the current date in a bunch of esports games, including csgo, valorant and rainbow six siege.

Desktop view

Mobile view

It is worth mentioning that the tool currently informs about the following games with each respective source:

🎯 Features

   ✔️ receive a daily email informing whenever at least one of your favorite teams has a match in the current date;
   ✔️ select the games you are interested in to check for matches;
   ✔️ option to specify teams per each game;
   ✔️ specify the time to send the daily email;
   ✔️ option to inform matches about only the current date or also from the following days.

⚠️ Requirements

The only thing you need to use this project is a gmail/google account.

💡 Usage

How it works

It basically sets a function to run in google apps scripts to run everyday at a specified time, and this function is responsable for:

  • get all the the matches scheduled for the next couple of days in all games that you're interested in;
  • filter the matches list to get only the ones about your favorite teams;
  • if there's at least one game of your favorite teams, send you an email about informing the details.

The matches list are obtained from a bunch of specialize sites. You can check the corresponding site of everygame by clicking in their links in this section.

Installation

To effectively use this project, do the following steps:

1 - create a Google Apps Scripts (GAS) project

Go to the google apps script and create a new project by clicking in the button showed in the next image.
It would be a good idea to rename the project to something like "esports-notifier".

2 - setup the esports-notifier code on GAS

Click on the initial file, which is the rectangle-1 on the image.

Replace the initial content present in the rectangle-2 with the content present in code bellow.

⚠️ Warning
Remember to update the CONFIGS object according to your data and needs.

const CONFIGS = {
    esports: {
      favoriteTeams: ['mibr'],              // specify your global favorite teams, that will be search in all games
      games: {                              // select the games you're interested
        csgo: {
          sync: true,
          teams: ['imperial']               // specify the teams you want to search only in this game
        },
        valorant: {
          sync: true,
          teams: ['sentinels', 'furia', 'loud', 'mibr']
        },
        rainbowSixSiege: {
          sync: true,
          teams: ['nip', 'faze', 'liquid', 'w7m']
        },
        leagueOfLegends: {
          sync: true,
          teams: []
        },
        rocketLeague: {
          sync: true,
          teams: []
        },
        dota: {
          sync: true,
          teams: []
        },
        callOfDuty: {
          sync: true,
          teams: []
        }
      }
    },
    datetime: {
      timeToSendEmail: '07:00',                    // time to send the daily email if there is at least on game of your favorite teams
      diffHoursFromGmtTimezone: -3                 // specify the hour difference between your timezone and GMT/UTC timezone | https://www.utctime.net/ | -3 means that in my timezone (15h) is 3 hours behind from utc timezone (18h).
    },
    settings: {
      notifyOnlyAboutTodayGames: true,             // if 'false' it will alse send email in case of matchs of favorite teams in the next days
      strictTeamComparasion: true,                 // if 'true' the name of the teams must be exact in all the matches source sites
      maintanceMode: false,                        // development option, dont need to change
      loopFunction: 'checkTodayGames'              // development option, dont need to change
    }
  };

function getEsportsNotifier(){

  let esportsNotifier;
  const useDevVersion = false

  if (useDevVersion){
    const EsportsNotifier = getEsportsNotifierDev()
    esportsNotifier = new EsportsNotifier(CONFIGS);
  } else {
    const version = "1.2.3"
    const content = UrlFetchApp.fetch(`https://cdn.jsdelivr.net/npm/esports-notifier@${version}`).getContentText();
    eval(content)
    esportsNotifier = new EsportsNotifier(CONFIGS);
  }

  return esportsNotifier;
}

function checkTodayGames() {
  const esportsNotifier = getEsportsNotifier();
  esportsNotifier.checkTodayGames();
}

function setup() {
  const esportsNotifier = getEsportsNotifier();
  esportsNotifier.install();
}

function uninstall() {
  const esportsNotifier = getEsportsNotifier();
  esportsNotifier.uninstall();
}
3 - allow the required google permissions

Go to the project settings by clicking on the first image rectangle. After that, check the option to show the appsscript.json in our project, a file that manages the required google api access.

Go back to the project files, and replace the content present in the appsscript.json with the following code:

{
  "timeZone": "Etc/GMT",
  "dependencies": {
    "libraries": [
      {
        "userSymbol": "Cheerio",
        "version": "14",
        "libraryId": "1ReeQ6WO8kKNxoaA_O0XEQ589cIrRvEBA9qcWpNqdOP17i47u6N9M5Xh0"
      }
    ]
  },
  "oauthScopes": [
    "https://www.googleapis.com/auth/script.scriptapp",
    "https://www.googleapis.com/auth/script.external_request",
    "https://www.googleapis.com/auth/script.send_mail",
    "https://www.googleapis.com/auth/userinfo.email"
  ],
  "exceptionLogging": "STACKDRIVER",
  "runtimeVersion": "V8"
}
4 - check if the tool is working as expected

Go to the esports-notifier code page as it was explained in the step 2 and on the header menu select checkTodayGames in the functions menu and run it, by clicking in the Run button.

If everything is okay, it is expected to you receive an email informing about your favorite teams matches if they have a game today. if there's an error, read the logs messages, adjust the necessary settings and try again.

5 - setup the esports-notifier to run automatically every x minutes

Just follow what the bellow image shows, which is to select the setup function and run it.
After, a popup will appear asking your permission, and you'll have to accept it.

Updating

To update your esports-notifier instance and use the latest features, you just need to change the version number in the getEsportsNotifier function, as it is shown bellow:

function getEsportsNotifier(){
  const version = "1.0.0" // update here to use the latest features
  const content = UrlFetchApp.fetch(`https://cdn.jsdelivr.net/npm/esports-notifier@${version}`).getContentText();
  eval(content)
  const esportsNotifier = new EsportsNotifier(CONFIGS)
  return esportsNotifier;
}

So if your instance is running at version "1.0.0" and the latest is "3.6.1", just replace those numbers in the version variable.

It is a good practice to go to the dist folder everytime you update your instance to check if your files in GAS have same properties as the new version; if they're not this may cause errors.

Uninstall

If you want to receive the daily emails, just go to the GAS respective project in the header dropdown menu select the uninstall function and then click on the Run button. By doing that, the GAS trigger responsable for running everyday the function will be deleted.

🔧 Development

Development setup

Instructions for development setup

To setup this project in your computer, run the following commands:
# Clone this repository
$ git clone https://github.com/lucasvtiradentes/esports-notifier

# Go into the repository
$ cd esports-notifier

# Install dependencies
$ npm install

Used technologies

This project uses the following thechnologies:

Scope Subject Technologies
Project Main
Setup Code linting
Commit linting Gitmoji
Other

📚 About

Related

  • [x] twitch-notifier: get email notifications when only your favorite twitch streamers go live.
  • [x] cheerio for GAS: project used in order to parse the html pages content into javascript objects.
  • [x] GAS docs: documentation related to triggering functions in Google Apps script.

License

This project is distributed under the terms of the MIT License Version 2.0. A complete version of the license is available in the LICENSE file in this repository. Any contribution made to this project will be licensed under the MIT License Version 2.0.

Feedback

If you have any questions or suggestions you are welcome to discuss it on github issues or, if you prefer, you can reach me in my social media provided bellow.

LinkedIn Gmail Discord

Made with ❤️ by Lucas Vieira

👉 See also all my projects

👉 See also all my articles

Package Sidebar

Install

npm i esports-notifier

Weekly Downloads

1

Version

1.2.3

License

MIT

Unpacked Size

86.8 kB

Total Files

8

Last publish

Collaborators

  • lucasvtiradentes