def __init__(self, talk): # Slackbot output function self.talk = talk # Bounty Database initialization self.bountydb = BountyDb(os.path.join(basedir, "epicenter.db"), os.path.join(basedir, "bounties.db"), "wormholes", "generics", self.report_kill, self.report_thera, self.report_thera_generic, self.report_thera_tripnull, BountyConfig.INTERVAL, BountyConfig.WAIT, BountyConfig.CYCLE) if BountyConfig.MASS_TRACKER_ENABLED: whmanager = WhManager(self) else: whmanager = None # ----------------------------------------------------------------------------- # Channel Settings self.ch = BountyConfig.get_channels() # Construct a list of channels where commands can be executed self.chlist_cfg = [self.ch["bountybot-config"]] self.chlist_all = [self.ch["wormhole-sales"], self.ch["testing"] ] + self.chlist_cfg # Should Bounty Bot accept commands in direct channels? if BountyConfig.PM_ENABLED: self.chlist_all += "D" # Should Bounty Bot accept commands in private groups? if BountyConfig.PG_ENABLED: self.chlist_all += "G" # ----------------------------------------------------------------------------- # Command section # Each command starts with one of the following prefixes: self.cmd_start = ["!bountybot", "!bounty", "!bb"] # Command configuration list self.cmd_list = [ [ "help", self.chlist_all, self.cbk_help, [("", "displays this message")] ], [ "about", self.chlist_all, self.cbk_about, [("", "displays information about BountyBot and shows link to the manual" )] ], [ "hello", self.chlist_all, self.cbk_hello, [("", "simple verification which tests if BountyBot is up and running" )] ], [ "check", self.chlist_all, self.cbk_check, [("<jcode>", "verify if J-code is in the specific or generic orders list") ] ], [ "list", self.chlist_all, self.cbk_list, [("[generic/jcode/jcode+] [id]", "displays current bounty systems (systems with ~ symbol have kill reports disabled)" )] ], [ "generic", self.chlist_all, self.cbk_generic, [("<id>", "displays J-codes associated with generic of specified ID")] ], [ "info", self.chlist_all, self.cbk_info, [("<jcode>", "displays characteristics of a wormhole")] ], [ "search", self.chlist_all, self.cbk_search, [("<description>", "displays J-codes which match the description")] ], [ "static", self.chlist_all, self.cbk_static, [("<code>", "displays information on a static code (ex. D382)") ] ], # ----------------------------------------------------------------------------- [ "add", self.chlist_cfg, self.cbk_add, [("<jcode> <watchlist> <comments>", "add new bounty system to database; <watchlist> must be either true or false" ), ("generic <description>", "add new generic bounty system")] ], [ "remove", self.chlist_cfg, self.cbk_remove, [("<jcode>", "remove bounty system from Watch List"), ("generic <id>", "remove generic bounty system")] ], [ "edit", self.chlist_cfg, self.cbk_edit, [("<jcode> <watchlist> [new_comments]", "modify the comments of a specific wormhole; <watchlist> must be either true or false" ), ("generic <id> <new_description>", "modify the description of a generic wormhole")] ], [ "destroy", self.chlist_cfg, self.cbk_destroy, [("[generic/jcode]", "CAUTION! removes all [generic/jcode] bounty systems")] ], [ "echo", self.chlist_cfg, self.cbk_echo, [("<channel> <message>", "send a message as Bounty Bot")] ], [ "announce", self.chlist_cfg, self.cbk_announce, [("<message>", "make an announcement as Bounty Bot")] ], ] # ----------------------------------------------------------------------------- if whmanager: self.cmd_list.append([ "spawn", self.chlist_all, whmanager.cbk_spawn, [("", "view spawned wormholes in current channel"), ("<sig> <type> <state>", "spawn a wormhole")] ]) self.cmd_list.append([ "splash", self.chlist_all, whmanager.cbk_splash, [ ("<sig> <ship_mass>", "splash a wormhole with specified ship mass"), ] ]) self.cmd_list.append([ "shrink", self.chlist_all, whmanager.cbk_shrink, [ ("<sig>", "report when wormhole shrinks"), ] ], ) self.cmd_list.append([ "collapse", self.chlist_all, whmanager.cbk_collapse, [ ("<sig>", "remove wormhole from channel"), ] ], ) self.cmd_list.append([ "chance", self.chlist_all, whmanager.cbk_chance, [ ("<sig> <ship_mass>", "compute probability of wormhole collapse with specified ship mass" ), ] ]) # Announce that BountyBot is back online when not in development mode if not BountyConfig.DEBUG: self.talk(self.ch["general"], "Back online") self.talk(self.ch["wormhole-sales"], "Back online")