/hackremind

[Currently NOT Operational] A Discord bot that notifies about upcoming CP & ML contests, CTF challenges, hackathons, etc.

Primary LanguageJavaScriptMIT LicenseMIT

HackRemind β

HackRemind (currently in Beta) is a Discord bot that notifies about upcoming competitive programming and machine learning contests, hackathons, capture-the-flag challenges and other coding related events.

How to Use?

There are two ways to use the bot.

I don't want to mess things up 😐

Join our Discord Server and follow #upcoming-competitions to add the channel's notifications to your server.

After adding bot to your server, you may like to change its name or avatar. You can modify them by editing your channel (little cogwheel icon alongside channel name). Open Integrations > Channels Followed > CodeBase #upcoming-competitions to get the required settings.

59

I kinda like doing things my way!

Head over to developers' guide to learn more and deploy your version of the bot to⠀58

Event Providers

Click to expand

Developers' Guide

Click to expand

This bot is an Azure Function App using Node.js as runtime. You can customize the following:

Environment Variables

Variable Description Possible Values, Defaults and Format
NODE_ENV Tells if the app is running in production or not. Note that dotenv is listed as a development-only dependency and won't be available on production to extract variables from .env file, even if it is pushed, so you must set this to ensure that the app runs fine on server also. development (default) or production
MONGO_URI Connection string of a MongoDB database. A database is required to record which events have already been pushed. You don't need to worry about the storage (512MB should be sufficient). The app will automatically remove old records. Connection String URI Format (default: mongodb://localhost:27017/hackremind)
CLIST_BEARER CLIST (Bearer Token) Authorization Header ApiKey clist-user:api-key
BOT_TOKEN Discord Bot Token (Ref. Creating a discord bot & getting a token) ...
CHANNEL_ID Discord Channel ID (to which you wanna push notifications). If the specified channel is an announcement (news) channel then the bot will automatically publish all the notifications to followers. (Ref. Where can I find my User/ Server/ Message ID?) ...
ICONS_URL A location containing icons of all hosts. Icon URL of the host is generated by this code. default
ONE_PX_IMG URL containing a 1px transparent image of at least 432px (required to fix width of embeds). (Ref. Discord.js embed width is unreliable) default
CONCURRENCY The max number of tabs your environment can handle in a Puppeteer (Chromium) browser instance. High concurrency may result in failure (like socket hang up, EventEmitter memory leak) depending on free memory, processing power, network speed,.. any decimal value between 1 to 5 (both inclusive, default 4)

Locally, one can set/modify environment variables in numerous ways. Some of them are:

  • Create a .env at root of the folder. Ref.
  • Set variables in the shell itself. Ref. 1,2,3
  • Use local.settings.json. Ref. SO,docs

On server, you need to specify application settings. Apart from the methods mentioned in that article, one can use this VSCode extension or use --publish-local-settings switch while publishing.

All the environment variables having a default value are optional.

Deployment Notes

Puppeteer works only on Linux consumption plan and when deployed using remote build.

You can modify this cron expression if you want to run the bot at different intervals. It currently runs every 2 hours.

The default timezone in an Azure Functions App is UTC. If you wanna run your job in some other timezone you need to set WEBSITE_TIME_ZONE.

If you're stuck on something we might be of some help. Feel free to create a new discussion.