mirror of
https://github.com/nikdoof/dropbot.git
synced 2025-12-22 14:19:24 +00:00
Switch Market Systems to a config item.
This commit is contained in:
@@ -39,6 +39,7 @@ The configuration is passed by using environment variables.
|
||||
* ```DROPBOT_REDIS_URL``` - 12 factor style URL of the Redis server to use (defaults to redis://localhost:6379/0)
|
||||
* ```DROPBOT_CMD_PREFIX``` - Prefix of MUC channel commands (defaults to !)
|
||||
* ```DROPBOT_KOS_URL``` - URL of the CVA KOS API service (defaults to http://kos.cva-eve.org/api/)
|
||||
* ```DROPBOT_MARKET_SYSTEMS``` - A comma seperated list of systems to be used for the best price checker (defaults to Jita, Amarr, Rens, Dodixie)
|
||||
* ```DROPBOT_KILL_CORPS``` - List of Corp IDs to track for kills
|
||||
* ```DROPBOT_KILLS_DISABLED``` - Disables the streaming of zKillboard kills to the channels (default to 0)
|
||||
* ```DROPBOT_OFFICE_API_KEYID``` - API KeyID to use for the nearest office finder.
|
||||
|
||||
@@ -20,14 +20,6 @@ from dropbot.stomp_listener import ZKillboardStompListener
|
||||
|
||||
urlparse.uses_netloc.append("redis")
|
||||
|
||||
market_systems = [
|
||||
('Jita', 30000142),
|
||||
('Amarr', 30002187),
|
||||
('Rens', 30002510),
|
||||
('Dodixie', 30002659),
|
||||
('U-HVIX', 30000575),
|
||||
]
|
||||
|
||||
zkillboard_regex = re.compile(r'http(s|):\/\/(?P<host>.*)\/kill\/(?P<killID>\d+)\/')
|
||||
|
||||
|
||||
@@ -48,6 +40,7 @@ class DropBot(ClientXMPP):
|
||||
self.kills_muted = False
|
||||
self.office_api_key_keyid = kwargs.pop('office_api_keyid', None)
|
||||
self.office_api_key_vcode = kwargs.pop('office_api_vcode', None)
|
||||
self.market_systems = kwargs.pop('market_systems', ['Jita', 'Amarr', 'Rens', 'Dodixie'])
|
||||
|
||||
if 'redis_url' in kwargs:
|
||||
self.redis_pool = ConnectionPool.from_url(kwargs.pop('redis_url', 'redis://localhost:6379/0'))
|
||||
@@ -303,7 +296,10 @@ class DropBot(ClientXMPP):
|
||||
sell_sys = None
|
||||
buy_sys = None
|
||||
|
||||
for name, sys_id in market_systems:
|
||||
for name in self.market_systems:
|
||||
sys_id = self.map.get_system_id(name)
|
||||
if not sys_id:
|
||||
continue
|
||||
sell, buy = self._get_evecentral_price(type_id, sys_id)
|
||||
if (sell < min_sell or min_sell == 0) and sell > 0:
|
||||
min_sell = sell
|
||||
|
||||
@@ -33,7 +33,7 @@ def main():
|
||||
# Parse the environment for config
|
||||
config = dict([(k[8:].lower(), v) for k, v in os.environ.items() if 'DROPBOT_' in k])
|
||||
# Split out array type configs
|
||||
for key in ['rooms', 'admins', 'kill_corps']:
|
||||
for key in ['rooms', 'admins', 'kill_corps', 'market_systems']:
|
||||
if key in config:
|
||||
config[key] = [x.strip() for x in config[key].split(',')]
|
||||
elif opts.config.lower().startswith('http'):
|
||||
|
||||
Reference in New Issue
Block a user