vostpt / bot Goto Github PK
View Code? Open in Web Editor NEWSource code of VOSTPTia - @vostpt's official bot
Home Page: https://vostpt.github.io/bot/
License: MIT License
Source code of VOSTPTia - @vostpt's official bot
Home Page: https://vostpt.github.io/bot/
License: MIT License
Provide a server to POST requests and trigger bot messages.
Ex: POST: <server>:<port>/fuel
will trigger a message in the fuel channel with info sent withing the POST.
Parse alerts form https://www.portaldascomunidades.mne.pt/pt/alertas and send them to a channel in Discord.
Add a trigger to miscellaneous to return the registration link for new volunteers of VOST Portugal
If the warning is sent out to twitter between 02:00h and 6:00h:
Bot is returning the real date+hour time plus one hour.
Command needs a fix to only send one message to the designated channel. At the moment it's sending one per minute for one hour.
With the COVID-19 pandemic, the amount of data that has to be consumed, validated, and tweeted is immense.
FAQ are a great way to gather information in one place, but we still need to make manual tweets to announce new insertions.
Develop a feature on VOSTia that monitors a Google Sheet's responses and when a new response is inserted:
!alerts returns error message
To reproduce, simply try sending a message with more than 1950 characters.
To fix:
// change
lastSentCharacter = lastPos;
// to
lastSentCharacter = lastSentCharacter + lastPos;
Today we saw the first updates on DGS reports. To make clearer the difference between reports, it would be nice to store a checksum of the PDF in the database. Then, when the bot messages the report to Discord, it can include said checksum 😄
It might seem overkill, but it's probably a good pattern to keep for future bot jobs/commands.
WDYT?
const replies = [
'Provavelmente a melhor VOST do mundo',
':eyes:',
':heart:',
'Sabias que a VOSTPT primeiro se chamou CONAC-TW no Twitter?',
];
module.exports = {
name: 'Miscellaneous',
description: 'Miscellaneous things',
async execute(message) {
const messageContent = message.content.toLowerCase();
if (messageContent.includes('vostpt')) {
const replytext = Math.floor(Math.random() * replies.length + 0);
try {
message.reply(replies[replytext]);
} catch (e) {
//
}
return;
Typing the command doesn't return any values
Get stats from 'Já Não Dá Para Abastecer' website (with information about fuel availability in fuel stations), and publish in Twitter
Define new bot criteria for important occurrences. The criteria is being discussed, but for now is:
Parse alerts form https://www.sns24.gov.pt/alertas/ and send them to a channel in Discord.
The bot should have the following behaviour:
Listen for keywords /triggers
only on channel ID: 501329363166560263 (Our public channel) - This is item is high priority or someone will kill the bot soon (looking at you @quetzyg)
Bot will reply to triggers only on aforementioned channel ID.
Weather warnings are fundamental and are the base of any activation for civil protection services, as well as VOST, so they should be broadcasted as fast as they are issued on our social networks.
The flow, that is already implemented but with some errors (mostly formatting), is this:
IPMA Warning -> Bot -> Twitter
Aviso Açores https://twitter.com/VOSTPT/status/1109010606940700677
Aviso Madeira https://twitter.com/VOSTPT/status/1077190310474719232
Thread de Avisos Continente durante o Furacão Leslie https://twitter.com/VOSTPT/status/1051096510203613185
To automatically generate individual tweets or threads when a warning is issued by IPMA, maintaining VOST Portugal's current layout (emojis and pictures/gifs).
Also important: Include in those tweets a random message from a predefined list.
Example: https://twitter.com/VOSTPT/status/1110881712542756864 ( #EstáFlatParaOGareth Boa onda é não enfrentar as ondas)
RCM job is sending IPMA image url, instead of image file.
Discord will show a cached image from the given url, instead of showing updated image.
In order to avoid cluttering channels with information, when a user sends the "?commands" command, the bot should:
Due to recent found vulnerabilities in the library we should swap it.
Bot is returning a string with omissions and formatting errors:
Example:
#IFGrândola,Grandola#troia
Should be
#IFGrândola, #Grândola, #Troia
502836523440537620
latest warning!all
and !all links
delivered by DM only to avoid spam in the channels
Implement tests to cover the code quality and provide extra confidence when refactoring.
Status of "Despacho" and "Despacho 1º alerta" are switched
Bot is not fetching any acronyms
When VOST it's on activation the bot says how many hours since the start of the activation.
Only the founders can !startactivation and !stopactivation.
When someone type !ativacao bot display how many time activation have started in hours.
Only Founders can send to the bot a command, for example,
!vostia start activation <activation_name>
@everyone entramos agora em ativação devido a
<activation_name>
!vostia end activation <activation_name>
@everyone acabou a ativação devido a
<activation_name>
. Obrigado!
The bot should then return the total of hours since the start of the activation to the same public channel
All users should be able to check, and get the information via PM, of current activation hours with a command, for example:
!vostia stats activation <activation name>
At this moment bot replies (when mentioned) only in public channel, but it should reply in all channels.
Note: "When mentioned" - '@VOSTia' (with correct Discord mention; bot ignores 'vostia')
These commands should be in a separate folder called "fires", with a file for each command:
!all
!all [human|ground|air] [numero_filtrar]
!all links
!all important
!op id [numero_id]
!op if [#IFConcelho]
!op status [Despacho|Curso|Resolução|Conclusão|Vigilância]
!op distrito [nome_distrito]
!rmc
These commands should be in a separate folder called "weather", with a file for each command:
!weather
!weather tomorrow
Interaction with Twitter should be made via a separate file.
When someone executes ?commands, bot should react to that message, instead of replying.
Relevant link: Previsão UV
Fetch map everyday at 9:00am and post it on channel 502412680070561803
and on Twitter
At this time the bot works in a fantastic way but:
Proposal
Bot returns error message even if there is an important event occurring
VOSTia is not:
#sismos_tsunamis
channel of earthquakes => 2.5Issue
Since 17.08.2020, the day that DGS launched a new report model, several reports were deleted from the website.
Reports 1 to 11, and report 38 return a "Not Found" message.
DGS has been formally informed that the reports are missing but has done nothing to about it.
Solution (?)
The requested feature is not a solution in itself, but a public awareness campaign for this problem.
Every day, at random hours, VOSTPTia shall check if the missing bulletins are still missing on the official repository for those . If they are still missing send a tweet mentioning DGS. The tweet content should be randomize from a given set of phrases to be written and stored, preferably, in a text file to be updated as needed be.
Change tweet structure to this:
#<warning_level> devido a #<warning_type> entre as <start_HH:mm> de <relative_start_date> <start_DDMMMYY> e as <end_HH:mm> de <relative_end_date> <end_DDMMMYY> para os distritos de <warning_issued_districts>
Example:
ℹ️
We need also to change image tweet to the newest warning images.
!stats should reply total number of means, and filtered by occurrence state
'!op id' command doesn't accept original ANEPC occurrence ID (example: 2019123456789).
The bot should accept, along with bot ID (example: 123456789), the original ANEPC ID.
PR #70
Estou ciente que isto pode alimentar trolls mas podemos criar uma blacklist de palavras.
We need to change the endpoints which the bot is getting info from.
It's not plug&play since the response structure is different since its compliant with JSON API specification.
When an fire is considered 'important', publish a tweet.
Bot is posting the same weather warning over and over again to Discord and Twitter.
It should only do it once
Exception: If warning is posted between 00h and 5h, it should repeat at 7am.
Send tweets from VOSTPT account on Twitter to Discord Channel Facebook
The bot should not reply to the user but to just send message to the public channel.
Example:
JG: A VOSTPT (...)
VOSTia: Sabias que a VOST Portugal (...)
Bot replies undefined - undefined
when !acronimo is requested.
Bot command !op if <city>
should retrieve all fires that occur in a given city or county (even if the given string isn't complete).
Since old API will be deprecated, it's necessary to change the way bot get and save IPMA warnings.
For that, was decided that the best way to do it is to implement sqlite and sequelize.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.