예제 #1
0
    def setup(self):
        self.logger.trace("Entered setup method.")
        self.storage = StorageManager()
        try:
            self.config = self.storage.get_file(self, "config", YAML,
                                                "plugins/minecraft.yml")
        except Exception:
            self.logger.exception("Error loading configuration!")
            self._disable_self()
            return
        if not self.config.exists:
            self.logger.error("Unable to find config/plugins/minecraft.yml")
            self.logger.error("Disabling..")
            self._disable_self()
            return

        if not self.relay_targets:
            self.logger.warn("No valid target protocols found. "
                             "Disabling status relaying.")

        self.commands = CommandManager()
        self.commands.register_command("mcquery",
                                       self.query_command,
                                       self,
                                       "minecraft.query",
                                       default=True)

        if self.do_relay:
            reactor.callLater(30, self.start_relay)
예제 #2
0
    def setup(self):
        self.logger.trace("Entered setup method.")

        self.commands = CommandManager()
        self.events = EventManager()
        self.storage = StorageManager()

        try:
            self.config = self.storage.get_file(self, "config", YAML,
                                                "plugins/inter.yml")
        except Exception:
            self.logger.exception("Error loading configuration!")
            self.logger.error(_("Disabling.."))
            self._disable_self()
            return

        if not self.config.exists:
            self.logger.error("Unable to find config/plugins/inter.yml")
            self.logger.error(_("Disabling.."))
            self._disable_self()
            return

        self.config.add_callback(self.reload)

        self.commands.register_command("players", self.players_command, self,
                                       "inter.players", default=True)

        if not reactor.running:
            self.events.add_callback(
                "ReactorStarted", self, self.first_load, 0
            )
        else:
            self.first_load()
예제 #3
0
    def setup(self):
        """
        Called when the plugin is loaded. Performs initial setup.
        """

        self.commands = CommandManager()

        self.commands.register_command("storage", self.storage_command, self,
                                       "management.storage",
                                       ["st", "files", "file"])
        self.commands.register_command("protocols", self.protocols_command,
                                       self, "management.protocols",
                                       ["pr", "protos", "proto"])
        self.commands.register_command("plugins", self.plugins_command, self,
                                       "management.plugins",
                                       ["pl", "plugs", "plug"])
        self.commands.register_command("packages", self.packages_command, self,
                                       "management.packages",
                                       ["pa", "packs", "pack"])
        self.commands.register_command("permissions", self.permissions_command,
                                       self, "management.permissions",
                                       ["pe", "perms", "perm"])
        self.commands.register_command("users", self.users_command, self,
                                       "management.users", ["us", "user"])
        self.commands.register_command("shutdown", self.shutdown_command, self,
                                       "management.shutdown")
예제 #4
0
 def setup(self):
     self.commands = CommandManager()
     self.commands.register_command("geoip",
                                    self.command,
                                    self,
                                    "geoip.command",
                                    default=True)
예제 #5
0
    def setup(self):
        self.logger.trace("Entered setup method.")
        self.storage = StorageManager()
        try:
            self.config = self.storage.get_file(self, "config", YAML,
                                                "plugins/wolfram.yml")
        except Exception:
            self.logger.exception("Error loading configuration!")
            self.logger.error("Disabling..")
            self._disable_self()
            return
        if not self.config.exists:
            self.logger.error("Unable to find config/plugins/wolfram.yml")
            self.logger.error("Disabling..")
            self._disable_self()
            return

        self.commands = CommandManager()

        self._load()
        self.config.add_callback(self._load)

        self.commands.register_command("wolfram",
                                       self.wolfram_command,
                                       self,
                                       "wolfram.wolfram",
                                       aliases=["wa"],
                                       default=True)
예제 #6
0
    def setup(self):
        self.storage = StorageManager()
        try:
            self.config = self.storage.get_file(self, "config", YAML,
                                                "plugins/wordnik.yml")
        except Exception:
            self.logger.exception("Unable to load the configuration!")
            return self._disable_self()
        if not self.config.exists:
            self.logger.error("Unable to find the configuration at "
                              "config/plugins/wordnik.yml - Did you fill "
                              "it out?")
            return self._disable_self()
        if "apikey" not in self.config or not self.config["apikey"]:
            self.logger.error("Unable to find an API key; did you fill out the"
                              " config?")
            return self._disable_self()

        self._load()
        self.config.add_callback(self._load)

        self.plugman = PluginManager()

        self.commands = CommandManager()

        self.commands.register_command("dict",
                                       self.dict_command,
                                       self,
                                       "wordnik.dict",
                                       default=True)
        self.commands.register_command("wotd",
                                       self.wotd_command,
                                       self,
                                       "wordnik.wotd",
                                       default=True)
예제 #7
0
    def setup(self):
        ### Grab important shit
        self.commands = CommandManager()
        self.storage = StorageManager()

        ### Initial config load
        try:
            self._config = self.storage.get_file(self, "config", YAML,
                                                 "plugins/8ball.yml")
        except Exception:
            self.logger.exception("Error loading configuration!")
            self.logger.error("Disabling...")
            self._disable_self()
            return
        if not self._config.exists:
            self.logger.error("Unable to find config/plugins/8ball.yml")
            self.logger.error("Disabling...")
            self._disable_self()
            return

        ### Setup some stuff
        self._random = random.Random()
        self._question_regex = re.compile("[\W_]+")

        ### Register commands
        self.commands.register_command("8ball",
                                       self.eight_ball_cmd,
                                       self,
                                       "8ball.8ball",
                                       default=True)
예제 #8
0
    def setup(self):
        ### Grab important shit
        self.commands = CommandManager()
        self.events = EventManager()
        self.storage = StorageManager()

        ### Initial config load
        try:
            self._config = self.storage.get_file(self, "config", YAML,
                                                 "plugins/triggers.yml")
        except Exception:
            self.logger.exception("Error loading configuration!")
            self.logger.error("Disabling...")
            self._disable_self()
            return
        if not self._config.exists:
            self.logger.error("Unable to find config/plugins/triggers.yml")
            self.logger.error("Disabling...")
            self._disable_self()
            return

        ### Register event handlers
        def _message_event_filter(event=MessageReceived):
            return isinstance(event.target, Channel)

        self.events.add_callback("MessageReceived", self, self.message_handler,
                                 1, _message_event_filter)

        self.events.add_callback("ActionReceived", self, self.action_handler,
                                 1, _message_event_filter)
예제 #9
0
    def setup(self):
        ### Grab important shit
        self.commands = CommandManager()
        self.storage = StorageManager()

        ### Initial config load
        try:
            self._config = self.storage.get_file(self,
                                                 "config",
                                                 YAML,
                                                 "plugins/jargon.yml")
        except Exception:
            self.logger.exception("Error loading configuration!")
            self.logger.error("Disabling...")
            self._disable_self()
            return
        if not self._config.exists:
            self.logger.error("Unable to find config/plugins/jargon.yml")
            self.logger.error("Disabling...")
            self._disable_self()
            return

        ### Register commands
        self.commands.register_command("jargon",
                                       self.jargon_cmd,
                                       self,
                                       "jargon.jargon", default=True)
예제 #10
0
    def setup(self):
        self.commands = CommandManager()
        self.goslate = Goslate()

        self.commands.register_command("translate", self.translate_command,
                                       self, "translate.translate",
                                       ["tr", "t"], True)
예제 #11
0
파일: default.py 프로젝트: gsingh123/Ultros
    def __str__(self):
        manager = CommandManager()

        if manager.aliases:
            return "Aliases: %s" % ", ".join(
                ["%s: %s" % (x[0], x[1]) for x in manager.aliases.items()]
            )
        return "Aliases: None"
예제 #12
0
    def __init__(self):
        self.commands = CommandManager()
        self.event_manager = EventManager()
        self.logger = getLogger("Manager")
        self.plugman = PluginManager(self)
        self.yapsy_logger = getLogger("yapsy")

        self.metrics = None
예제 #13
0
    def setup(self):
        """
        Called when the plugin is loaded. Performs initial setup.
        """

        self.commands = CommandManager()
        self.commands.register_command("page", self.page_command, self,
                                       default=True)
예제 #14
0
 def setup(self):
     self.commands = CommandManager()
     self.commands.register_command("rroulette",
                                    self.play,
                                    self,
                                    "russianroulette.rroulette",
                                    aliases=["roulette"],
                                    default=True)
예제 #15
0
    def setup(self):
        self.commands = CommandManager()

        self.commands.register_command("hb",
                                       self.hb_command,
                                       self,
                                       "hb.hb",
                                       default=True)
예제 #16
0
    def setup(self):
        # Define this so we have instances of everything we need
        self.commands = CommandManager()
        self.events = EventManager()
        self.storage = StorageManager()
        self.plugman = PluginManager()

        # Now run the actual setup function
        self.wrapper(self.clj_plugin.setup)()
예제 #17
0
    def setup(self):
        self.commands = CommandManager()

        self.commands.register_command('armoury',
                                       self.armoury,
                                       self,
                                       'wow.armoury',
                                       aliases=['armory'],
                                       default=True)
예제 #18
0
    def setup(self):
        self.commands = CommandManager()

        self.commands.register_command("w3validate",
                                       self.w3validate,
                                       self,
                                       "w3.w3validate",
                                       aliases=["validate", "valid"],
                                       default=True)
예제 #19
0
    def setup(self):
        ### Grab important shit
        self.commands = CommandManager()

        ### Register commands
        self.commands.register_command("urbandictionary",
                                       self.urbandictionary_cmd,
                                       self,
                                       "urbandictionary.definition",
                                       aliases=["ud"], default=True)
예제 #20
0
    def setup(self):
        """
        Called when the plugin is loaded. Performs initial setup.
        """

        self.logger.trace(_("Entered setup method."))
        self.storage = StorageManager()
        try:
            self.config = self.storage.get_file(self, "config", YAML,
                                                "plugins/urls.yml")
        except Exception:
            self.logger.exception(_("Error loading configuration!"))
        else:
            if not self.config.exists:
                self.logger.warn(_("Unable to find config/plugins/urls.yml"))
            else:
                self.content_types = self.config["content_types"]
                self.spoofing = self.config["spoofing"]

        self.logger.debug(_("Spoofing: %s") % self.spoofing)

        self.channels = self.storage.get_file(self, "data", YAML,
                                              "plugins/urls/channels.yml")
        self.shortened = self.storage.get_file(
            self,
            "data",
            DBAPI,
            "sqlite3:data/plugins/urls/shortened.sqlite",
            "data/plugins/urls/shortened.sqlite",
            check_same_thread=False)

        self.commands = CommandManager()
        self.events = EventManager()

        self.reload()

        def message_event_filter(event=MessageReceived):
            target = event.target
            type_ = event.type

            return type_ == "message" \
                or isinstance(target, Channel) \
                or isinstance(target, User)

        self.add_shortener("tinyurl", self.tinyurl)

        self.events.add_callback("MessageReceived", self, self.message_handler,
                                 1, message_event_filter)
        self.commands.register_command("urls", self.urls_command, self,
                                       "urls.manage")
        self.commands.register_command("shorten",
                                       self.shorten_command,
                                       self,
                                       "urls.shorten",
                                       default=True)
예제 #21
0
    def setup(self):
        ### Grab important shit
        self.commands = CommandManager()
        self.storage = StorageManager()

        ### Initial config load
        try:
            self._config = self.storage.get_file(self,
                                                 "config",
                                                 YAML,
                                                 "plugins/aoshelper.yml")
        except Exception:
            self.logger.exception("Error loading configuration!")
            self.logger.error("Disabling...")
            self._disable_self()
            return
        if not self._config.exists:
            self.logger.error("Unable to find config/plugins/aoshelper.yml")
            self.logger.error("Disabling...")
            self._disable_self()
            return

        ### Load options from config
        self._load()

        self._config.add_callback(self._load)

        ### Register commands
        self.commands.register_command("aosplayercount",
                                       self.playercount_cmd,
                                       self,
                                       "aoshelper.playercount",
                                       [
                                           "playercount"
                                       ], default=True)
        self.commands.register_command("aostoip",
                                       self.aos_to_ip_command,
                                       self,
                                       "aoshelper.aostoip",
                                       [
                                           "aos2ip"
                                       ])
        self.commands.register_command("iptoaos",
                                       self.ip_to_aos_command,
                                       self,
                                       "aoshelper.iptoaos",
                                       [
                                           "ip2aos"
                                       ])

        ### Setup soem variables
        self._last_update_voxlap = 0
        self._last_update_steam = 0
        self._last_voxlap_player_count = -1
        self._last_steam_player_count = -1
예제 #22
0
    def __init__(self, name, factory, config):
        NoChannelsProtocol.__init__(self, name, factory, config)

        self.name = name
        self.log = getLogger(self.name)
        self.event_manager = EventManager()
        self.command_manager = CommandManager()

        reactor.connectTCP(self.config["connection"]["host"],
                           self.config["connection"]["port"], self.factory,
                           120)
예제 #23
0
    def setup(self):
        """
        The list of bridging rules
        """

        self.commands = CommandManager()
        self.reload()

        self.commands.register_command("debug",
                                       self.debug_cmd,
                                       self,
                                       "debug.debug",
                                       aliases=["dbg"])
예제 #24
0
    def setup(self):
        # ## Grab important shit
        self.commands = CommandManager()
        self.events = EventManager()
        self.storage = StorageManager()
        self.plugman = PluginManager()

        # ## Set up database
        self.database = self.storage.get_file(
            self,
            "data",
            DBAPI,
            "sqlite3:data/plugins/factoids.sqlite",
            "data/plugins/factoids.sqlite",
            check_same_thread=False
        )

        self.database.add_callback(self.reload)
        self.reload()

        # ## Register commands
        # We have multiple possible permissions per command, so we have to do
        # permission handling ourselves
        self.commands.register_command("addfactoid",
                                       self.factoid_add_command,
                                       self,
                                       None)
        self.commands.register_command("setfactoid",
                                       self.factoid_set_command,
                                       self,
                                       None)
        self.commands.register_command("deletefactoid",
                                       self.factoid_delete_command,
                                       self,
                                       None,
                                       ["delfactoid"])
        self.commands.register_command("getfactoid",
                                       self.factoid_get_command,
                                       self,
                                       None, default=True)

        # ## Register events
        self.events.add_callback("MessageReceived",
                                 self,
                                 self.message_handler,
                                 1)

        self.events.add_callback("Web/ServerStartedEvent",
                                 self,
                                 self.web_routes,
                                 1)
예제 #25
0
    def setup(self):
        ### Grab important shit
        self.commands = CommandManager()
        self.storage = StorageManager()

        ### Initial config load
        try:
            self._config = self.storage.get_file(self, "config", YAML,
                                                 "plugins/lastfm.yml")
        except Exception:
            self.logger.exception("Error loading configuration!")
            self.logger.error("Disabling...")
            self._disable_self()
            return
        if not self._config.exists:
            self.logger.error("Unable to find config/plugins/lastfm.yml")
            self.logger.error("Disabling...")
            self._disable_self()
            return
            ### Same for the data file (nickname=>lastfmusername map)
        try:
            self._nickmap = self.storage.get_file(
                self, "data", YAML, "plugins/lastfm-nickmap.yml")
        except Exception:
            self.logger.exception("Error loading nickmap!")
            self.logger.error("Disabling...")
            self._disable_self()

        ### Load options from config and nick map from data
        self._load()

        self._config.add_callback(self._load)

        ### Register commands
        self.commands.register_command("nowplaying",
                                       self.nowplaying_cmd,
                                       self,
                                       "lastfm.nowplaying",
                                       aliases=["np"],
                                       default=True)
        self.commands.register_command("lastfmnick",
                                       self.lastfmnick_cmd,
                                       self,
                                       "lastfm.lastfmnick",
                                       default=True)
        self.commands.register_command("lastfmcompare",
                                       self.compare_cmd,
                                       self,
                                       "lastfm.compare",
                                       aliases=["musiccompare", "compare"],
                                       default=True)
예제 #26
0
    def setup(self):
        ### Grab important shit
        self._commands = CommandManager()
        self._storage = StorageManager()

        ### Initial config load
        try:
            self._config = self._storage.get_file(self, "config", YAML,
                                                  "plugins/xkcd.yml")
        except:
            self.logger.exception("Error loading configuration!")
            self.logger.error("Disabling...")
            self._disable_self()
            return
        if not self._config.exists:
            self.logger.error("Unable to find config/plugins/xkcd.yml")
            self.logger.error("Disabling...")
            self._disable_self()
            return
        ### Same for the data files
        try:
            self._comic_cache = self._storage.get_file(
                self, "data", YAML, "plugins/xkcd/comic-cache.yml")
        except:
            self.logger.exception("Error loading comic-cache!")
            self.logger.error("Disabling...")
            self._disable_self()
        try:
            self._archive = self._storage.get_file(self, "data", YAML,
                                                   "plugins/xkcd/archive.yml")
        except:
            self.logger.exception("Error loading archive!")
            self.logger.error("Disabling...")
            self._disable_self()

        ### Initial data file setup and stuff
        self._load()

        self._config.add_callback(self._load)
        self._comic_cache.add_callback(self._load)
        self._archive.add_callback(self._load)

        ### Register commands
        self._commands.register_command("xkcd",
                                        self.xkcd_cmd,
                                        self,
                                        "xkcd.xkcd",
                                        default=True)
예제 #27
0
    def setup(self):
        self.commands = CommandManager()
        self.events = EventManager()
        self.storage = StorageManager()
        # self.data = self.storage.get_file(self, "data", SQLITE,
        #                                   "plugins/memos/memos.sqlite")

        # with self.data as c:
        #     # Multiline strings because of an IDE bug
        #     c.execute("""CREATE TABLE IF NOT EXISTS memos
        #               (to TEXT, from TEXT, memo TEXT)""")

        self.events.add_callback("PreMessageReceived", self,
                                 self.message_received, 0)
        self.commands.register_command("memo", self.memo_command, self,
                                       "memo.send", default=True)
예제 #28
0
    def setup(self):
        """The list of bridging rules"""

        self.commands = CommandManager()
        self.events = EventManager()
        self.storage = StorageManager()

        self.data = self.storage.get_file(self, "data", YAML,
                                          "plugins/dialectizer/settings.yml")

        self.events.add_callback("MessageSent", self, self.handle_msg_sent, 1)
        self.commands.register_command("dialectizer",
                                       self.dialectizer_command,
                                       self,
                                       "dialectizer.set",
                                       aliases=["dialectiser"])
예제 #29
0
    def setup(self):
        ### Grab important shit
        self.commands = CommandManager()
        self.storage = StorageManager()

        ### Initial config load
        try:
            self._file_config = self.storage.get_file(
                self,
                "config",
                YAML,
                "plugins/jargon.yml"
            )
        except Exception:
            self.logger.exception("Error loading configuration!")
            self.logger.error("Disabling...")
            self._disable_self()
            return
        if not self._file_config.exists:
            self.logger.error("Unable to find config/plugins/jargon.yml")
            self.logger.error("Disabling...")
            self._disable_self()
            return

        self._file_config.add_callback(self.load)
        self.load()

        ### Register commands
        self.commands.register_command(
            "jargon",
            self.jargon_cmd,
            self,
            JARGON_PERM,
            aliases=["generatesentence", "generate"],
            default=True
        )
        self.commands.register_command(
            "jargonlist",
            self.jargonlist_cmd,
            self,
            JARGON_LIST_PERM,
            aliases=["generatesentencelist", "generatelist"],
            default=True
        )
예제 #30
0
    def setup(self):
        """
        The list of bridging rules
        """

        self.commands = CommandManager()

        self.commands.register_command("join", self.join_command, self,
                                       "control.join")
        self.commands.register_command("leave", self.leave_command, self,
                                       "control.leave")
        self.commands.register_command("say", self.say_command, self,
                                       "control.say")
        self.commands.register_command("action", self.action_command, self,
                                       "control.action")
        self.commands.register_command("raw", self.raw_command, self,
                                       "control.raw")
        self.commands.register_command("func", self.func_command, self,
                                       "control.func")