JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10
  • Score
    100M100P100Q38555F
  • License MIT

🔔 receive a daily email informing whenever at least one of your favorite esports teams has a match in the current date.

Package Exports

  • esports-notifier
  • esports-notifier/dist/EsportsNotifier.min.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (esports-notifier) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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:

  • counter-strike global offense: liquipedia
  • valorant: vlr.gg
  • rainbow six siege: siege.gg
    const CONFIGS = {
      esports: {
        favoriteTeams: ['loud', 'mibr', 'imperial'], // specify your favorite teams
        games: {                                     // select the games you're interested
          csgo: true,
          valorant: true,
          rainbowSixSiege: true
        }
      },
      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: false,                // 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(){
      const version = "1.1.0"
      const content = UrlFetchApp.fetch(`https://cdn.jsdelivr.net/npm/esports-notifier@${version}`).getContentText();
      eval(content)
      const 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

If you want to contribute to the project, fork the project, make the necessary changes, and to test your work you can load your version in apps scripts with almost no effort do this: replace the content of the getEsportsNotifier function with the following code:

function getEsportsNotifier() {
  // const version = "1.1.0" // version
  // const content = getEsportsProduction(version)
  const content = getEsportsDevelopment('yourgithub/project-fork', 'branch_name');
  eval(content);
  const esportsNotifier = new EsportsNotifier(CONFIGS);
  return esportsNotifier;
}

function getEsportsProduction(version) {
  return UrlFetchApp.fetch(`https://cdn.jsdelivr.net/npm/esports-notifier@${version}`).getContentText();
}

function getEsportsDevelopment(repository, branch) {
  const filePath = 'dist/EsportsNotifier.min.js';
  const final_link = `https://api.github.com/repos/${repository}/contents/${filePath}${branch ? `?ref=${branch}` : ''}`;
  const response = UrlFetchApp.fetch(final_link, { method: 'get', contentType: 'application/json' });
  const base64Content = JSON.parse(response.toString()).content;
  const decodedArr = Utilities.base64Decode(base64Content);
  const decodedAsString = Utilities.newBlob(decodedArr).getDataAsString();
  return decodedAsString;
}

This will allow you to select the esports-notifier source place (github repository or npm package) and specify the intended version.

Used technologies

This project uses the following thechnologies:

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

📚 About

  • twitch-notifier: get email notifications when only your favorite twitch streamers go live.
  • cheerio for GAS: project used in order to parse the html pages content into javascript objects.
  • 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 Github

Made with ❤️ by Lucas Vieira

👉 See also all my projects

👉 See also all my articles