This is a bot written for the Hackforge Discord server. It does three things:
- People can ask the bot when the next event is
- People can ask the bot how to join Hackforge
- The bot will remind people of an event happening the next day
- NEW: You can query the events using a SQL-Like language
It gets it's information on events by retreiving and then attempting to parse http://hackf.org.
As part of a Software Guild session on parsing languages with grammars, hackfeventbot now parses a SQL-Like language called HEQL (Hackforge Event Query Language, pronounced "heckle"). Below are some examples of executing HEQL.
Hey @hackforgeeventbot can you get me the next event
<?heql
SELECT NEXT title, content, excerpt, start_date_time, end_date_time, meetup_link, facebook_link, group
FROM events?> | pretty
Hey @hackfeventbot can you get me the next event
<?heql
SELECT NEXT title, content, excerpt, start_date_time, end_date_time, meetup_link, facebook_link, group
FROM events
WHERE group = 'Software Guild' and title LIKE '%Grammar%'
?> | json
Hey @hackfeventbot can you get me those links but make it look like a hammer is saying it because that’s awesome
<?heql
SELECT NEXT title, group, facebook_link
FROM events
WHERE group = 'Software Guild' and title LIKE '%Grammar%';
?> | hammersay
Hey @hackfeventbot what groups are there to choose from?
<?heql
SELECT DISTINCT group
FROM events;
?>
Getting reminded about the next event:
- Discord4J Java Interface into the Discord API: https://github.com/austinv11/Discord4J
- GSon Java JSON Parser: https://github.com/google/gson
- Apache Commons IO: https://commons.apache.org/proper/commons-io/
- Apache HTTP Components HTTP Client: http://hc.apache.org/
- jsoup Java HTML Parser: https://jsoup.org/