A BigBrotherBot plugin which introduces geolocation capabilities. This plugin is meant to be used as subplugin since it doesn't provide commands or visual reaction to B3 events. The plugin intercepts new clients connection and retrieve geolocation data using multiple data sources:
NOTE: since B3 v1.10.1 beta this plugin has been included in the standard plugins set, thus all patches and updates will be performed in the official B3 repository.
To notify other plugins of client geolocation being completed, two events are being fired:
EVT_CLIENT_GEOLOCATION_SUCCESS
: when the geolocation succeedsEVT_CLIENT_GEOLOCATION_FAILURE
: when the geolocation fails
When the geolocation succeed a new attribute is added the the b3.clients.Client
object: location
. This attribute
will hold all the geolocation data the plugin could retrieve:
client.location.country
: the country nameclient.location.region
: the region nameclient.location.city
: the city nameclient.location.cc
: the two letter country codeclient.location.rc
: the two letter region codeclient.location.isp
: the Internet Service Provider nameclient.location.lat
: the latitude valueclient.location.lon
: the longitude valueclient.location.timezone
: the timezone stringclient.location.zipcode
: the postal code
NOTE #1 : when EVT_CLIENT_GEOLOCATION_FAILURE
is fired client.location
is set to None
NOTE #2 : when the plugin cannot retrieve a specific geolocation value, its attribute is set to None
Latest version available here.
This plugin is meant to work only with B3 version 1.10dev or higher. No 1.9.x version will be released since the plugin makes use of some new B3 core features which have been added in version 1.10 development branch.
Simply drop the geolocation
directory into b3/extplugins
. B3 will automatically load the plugin if needed. If you want you can load the plugin in b3 main configuration file but it's not mandatory.
- reworked external module imports
- renamed Locator class (and all inherited ones) into Geolocator: updated module name
- moved GeoIP.dat file into lib/geoip/db folder
- minor code changes to respect PEP8 constraints
- import single locators classes instead of importing the whole module
- now plugin reacts also on EVT_CLIENT_UPDATE: see http://bit.ly/1LmHpIJ
- initial release
If you have found a bug or have a suggestion for this plugin, please report it on the B3 forums.