Code for alerts.perl6.org and supporting IRC bot
The alerts are posted by addressing the
p6lert bot. Four commands exist
Adds a new alert, using your IRC for
created by information.
The bot will give a direct link to it on the site. While
the direct link will show the alert right away, it'll take 10 minutes for
the alert to show up on the main site's page, on its API endpoints, or to be
tweeted. This is by-design, to allow for some editing or deleting of the alert,
<Zoffix> p6lert, add some normal alert <Zoffix> p6lert, add severity:high some high alert <Zoffix> p6lert, add affects:[2017.12 and earlier] some normal alert <Zoffix> p6lert, add severity:high affects:[2017.12 and earlier] some high alert
The brackets for
affects are mandatory and
severity must come before
affects. Both are optional and
severity defaults to
affects defaults to an empty string. See P6lert blog
to get the idea for what severity values are meant to mean.
https:// links will automatically be made clickable
on the website.
If you need a reminder of command syntax, you can always issue
to the bot:
<Zoffix> p6lert: help <p6lert> Zoffix, https://github.com/perl6/alerts P6lert commands: [insta]?add ALERT, update ID ALERT, delete ID; ALERT format: ['severity:'\S+]? ['affects:['<-[\]]>+']']? ALERT_TEXT
Available severity levels
Exactly the same as
add command, except it does not have a 10-minute grace
period and the alert will be distributed and tweeted immediately. This exists
mostly for debugging and you should always use the
<Zoffix> p6lert, instaadd some normal alert
Syntax is the same as
add, except it takes an alert ID as the first argument.
Updates the alert content. Note that omitting
WILL NOT set them to default values and will leave them as they were
before the update.
<Zoffix> p6lert, update 5 severity:high actually, it's now a high alert
The bot will tell you if this alert was already tweeted.
Takes an alert ID as the argument and deletes it from the database. The bot will tell you if this alert was already tweeted. The tweet will NOT be deleted by the bot.
<Zoffix> p6lert, delete 5
Takes an alert ID and some text to append to alert text for the alert under that ID. Generally alerts should be kept rather small and this command is a semi-emergency hatch to append a bit of extra text that doesn't fit into a single IRC text message.
<Zoffix> p6lert, append 5 some extra text
The styles are in
static/main.scss. You'll need to run
have SASS preprocessor watch for changes and
generate CSS styles for the site.
IRC Bot development mode
./dev-BOT script to power on the bot in dev mode. It'll start the bot
P6LERT_DEBUG=1 env vars. The available
P6LERT_IRC_HOST—Specifies the IRC server host to connect to
P6LERT_DEBUG—Enables debug mode, which:
- Sets alerter URL to
#zofbotIRC channel instead of the usual set
- Disables tweeting by default
- Reduces delay before alerts go public to 60 seconds (only affects the time when they get tweeted out)
- Sets alerter URL to
P6LERT_DEBUG_DO_TWEET—Enables debug mode tweeting. This includes re-tweeting untweeted alerts from the database on load.
IRC Bot Admins
Admins are allowed to post/update/delete alerts. Their hosts are stored in
admin-list property. When adding new
hosts, please only add registered Freenode users (those who have a
cloak are even better, since we can
see to whom the host belongs)
The server and bot are hosted on hack with Apache on www server reverse-proxying
all the requests. The repo checkout lives in
/home/p6lert/alerts/ and two services exist:
To pull new changes, log in to hack, then run:
sudo su -l p6lert cd alerts/ git pull logout sudo service p6lert-web restart sudo service p6lert-irc restart
The alerts database is in
/home/p6lert/alerts/alerts.sqlite.db SQLite file.
Zoffix has the keys to
@p6lert Twitter account.
Fork this module on GitHub: https://github.com/perl6/alerts
To report bugs or request features, please use https://github.com/perl6/alerts
Zoffix Znet (http://perl6.party/)
You can use and distribute this module under the terms of the
The Artistic License 2.0. See the
LICENSE file included in this
distribution for complete details.
META6.json file of this distribution may be distributed and modified
without restrictions or attribution.