Releases: jordans-code/AFB-Bot
AFBbot 1.1
AFB-Bot - A Reddit Bot
Features:
-
When summoned for information the bot will currently provide the full base name, the MAJCOM, the city/state/country, links to recent discussions on /r/ratemyafb, a sneak peak of the top comment from one of those discussions, current weather information, and the various base ratings.
-
Ability to easily rate bases / change your previous rating of a base in up to four categories: "rate", "arearate", "offbaserate", and "onbaserate".
-
Ability to summon the bot for overall statistics. The bot will provide the highest and lowest rated bases along with the current coldest and warmest temperature bases.
-
Maintains a dynamic wiki for all of the bases which includes base discussions, top comments, the base ranking against others, and more.
Usage:
- To summon the bot for base information, either in a comment or a submission include the bot's name (afbbot) and a base name, ex: Langley. The base name triggers are keywords and nicknames. If you have any suggestions for additional bases or nicknames please let me know.
AFBbot, tell me about Langley!
-
To rate a base, either in a comment or a submission include the bot's name (afbbot), one or more of the following words: rate/arearate/onbaserate/offbaserate, a number (can be anything but will be rounded between 1-10) after each rating word, and the base name. The only thing that matters is that the rating number comes after the rating word.
-
Rate is for a general rating of the base.
-
AreaRate is for a rating of the local area around the base.
-
OnBaseRate is for a rating of the on base housing (dorms/actual housing).
-
OffBaseRate is for a rating of the off base housing.
I was at langley for 2 years and the housing is great! Overall I rate it an 8, and I arearate it 9.5 AFBbot.
- To summon the bot for overall statistics, either in a comment or a submission include the bot's name (afbbot) and "stats".
AFBbot, lets see those stats!
Planned Features:
-
Add the ability to request a blacklist addition. Currently I have to manually add usernames/submission id's/comment id's to the blacklist to not appear on sneak peaks/get replies from the bot. I would like to give select users the ability to simply PM the bot with the comment/thread/user id and the word "blacklist".
-
Add additional bases as they are suggested. I did not include many National Guard / Reserve bases due to a lack of mentions, however if you think a base should be added please let me know and it can be easily done. Undisclosed locations will obviously not be added.
-
Add a leaderboard for the base rankings.
-
Potentially add other branch bases (if requested).
-
Open to any suggestions.
Notes:
-
For base information the bot will only handle one base per comment, if multiple are mentioned it will take the first it sees in it's list.
-
If a user has already rated a base it will change their previous rating, ratings are stored in a SQLite3 DB.
-
The bot looks at both submissions and comments for all features.
-
The bot can take negative numbers, decimals, 0, but will always round between 1-10.
-
The bot does not care about fractions, ex: if you say "I rate langley 5/5" it will rate it 10 (55 rounded down). It just looks for the first number after the word rate along with spaces.
-
The bot currently runs on /r/AFBbot (feel free to test things here), /r/AirForce, and /r/RateMyAFB
The bot will ignore single lines of quoted text and attempt to function as normal with the rest of the comment/thread.
However, if there are multiple lines of quoted text such as this the bot will NOT reply.
- The bot maintains a wiki on /r/RateMyAFB for all bases. The bot loops through each base page to check for an update roughly every 15 minutes. Sometimes the bot will cycle top comments when the scores are similar, this is due to reddit's anti upvote bot fuzzing which randomly changes the scores.
Huge thanks to /u/Rate_My_AF_Base for letting me trial the bot.
Lastly if you wish to use any of the code you are absolutely welcome to it.
1.0
Finally got time to finish fixing a few bugs and I have determined the bot is stable.
AFB-Bot - A Reddit Bot
Features:
-
When summoned for information the bot will currently provide the full base name, the MAJCOM, the city/state/country, current weather information, and the overall base rating.
-
Ability to easily rate bases / change your previous rating of a base.
-
Ability to summon the bot for overall statistics. The bot will provide the highest and lowest rated bases along with the current coldest and warmest temperature bases.
Usage:
- To summon the bot for base information, simply include the bot's name (afbbot) and a base name, ex: Langley. The base name triggers are keywords and nicknames. If you have any suggestions for additional bases or nicknames please let me know.
AFBbot, tell me about Langley!
- To rate a base you do not need to mention the bot's name, simply include the word "rate" along with a number (can be anything but will be rounded between 1-10) and the base name. The only thing that matters is that the rating number comes after the word "rate".
I was at langley for 2 years and the DFAC sucks! I rate it a 3.5 at best.
- To summon the bot for overall statistics, simply include the bot's name (afbbot) and "stats".
AFBbot, lets see those stats!
Planned Features:
-
Have the bot link the three most recent discussions for the base on /r/ratemyafb when called.
-
Add additional bases as they are suggested. I did not include many National Guard / Reserve bases due to a lack of mentions, however if you think a base should be added please let me know and it can be easily done. Undisclosed locations will obviously not be added.
-
Potentially add other branch bases (if requested).
-
Open to any suggestions.
Notes:
-
For base information the bot will only reply with a single base's information if multiple are mentioned.
-
If a user has already rated a base it will change their previous rating, ratings are stored in a SQLite3 DB.
-
The bot looks at both submissions and comments for all features.
-
The bot can take negative numbers, decimals, 0, but will always round between 1-10.
-
The bot does not care about fractions, ex: if you say "I rate langley 5/5" it will rate it 10 (55 rounded down). It just looks for the first number after the word rate along with spaces.
-
The bot currently only runs on /r/AFBbot (feel free to test things here) and /r/RateMyAFB
The bot will ignore single lines of quoted text and attempt to function as normal with the rest of the comment/thread.
However, if there are multiple lines of quoted text such as this the bot will NOT reply.
Huge thanks to /u/Rate_My_AF_Base for letting me trial the bot.
Lastly if you wish to use any of the code you are absolutely welcome to it.
AFB-Bot
New:
Bot will only reply if a user is trying to rate a base or if the post contains !AFBbot / AFBbot / /u/AFBbot. This will prevent false positives as it is unlikely a post will contain "rate", an integer and a base name without someone trying to rate it (though it could be implemented here as well. Usage: !AFBbot Langley
Bot will now accept negative numbers, decimals, zero and any other number and in most formats (9/10, 9 out of 10). It will round to a number between 1-10.
The bot currently will search comments on a list of subreddits (with their permission) for a base name/nickname and respond with the full base name, the base city/state/country, the majcom the base falls under and a dynamic rating. Users are able to rate a base by including "rate" in their post along with the base name and a number (will be rounded to 1-10).
Ratings are stored in a sqlite3 DB, each base has an individual table. A log table is kept in the db with actions that the bot takes and exceptions that are raised.
Future: Better exception handling, potentially switch db to a class and open/close it each time the bot does its loop. In reply comments potentially link to recent threads for mentioned bases.