示例#1
0
    def main(self: Any):
        print("Sleuth - Fortnite News Feed watcher")
        print("https://github.com/EthanC/Sleuth\n")

        initialized: Optional[bool] = Sleuth.LoadConfiguration(self)

        if initialized is True:
            news: Optional[dict] = Utility.GET(
                self,
                "https://fortnite-api.com/news",
                {"x-api-key": self.apiKey},
                {"language": self.language},
            )

            if news is not None:
                log.info("Retrieved the current news feed")

                # Save The World still uses the messages key, which is
                # not supported in Sleuth at this time.
                # if self.saveTheWorld is True:
                #     Sleuth.Diff(self, "saveTheWorld", news["data"]["stw"]["motds"])

                if self.battleRoyale is True:
                    Sleuth.Diff(self, "battleRoyale",
                                news["data"]["br"]["motds"])

                if self.creative is True:
                    Sleuth.Diff(self, "creative",
                                news["data"]["creative"]["motds"])
    def main(self):
        print("Generador de Tienda de Objetos")
        print("Creado por: https://github.com/EthanC/Athena\n")
        print(
            "Modificado y Traducido por: https://github.com/PokeSantiTW/Spanish-Twitter-Item-Shop-Bot\n"
        )

        initialized = Athena.LoadConfiguration(self)

        if initialized is True:
            if self.delay > 0:
                log.info(f"Retrasando ejecución por {self.delay}s...")
                sleep(self.delay)

            itemShop = Utility.GET(
                self,
                "https://fortnite-api.com/v2/shop/br/combined",
                {"x-api-key": self.apiKey},
                {"language": self.language},
            )

            if itemShop is not None:
                itemShop = json.loads(itemShop)["data"]

                # Strip time from the timestamp, we only need the date
                date = Utility.ISOtoHuman(self, itemShop["date"].split("T")[0],
                                          self.language)
                log.info(f"Encontrado Tienda de Objetos del {date}")

                shopImage = Athena.GenerateImage(self, date, itemShop)

                if shopImage is True:
                    if self.twitterEnabled is True:
                        Athena.Tweet(self, date)
示例#3
0
    def main(self):
        Log.Intro(self, "Athena - Fortnite Item Shop Generator")

        initialized = Athena.LoadConfiguration(self)

        if initialized is True:
            if self.delay > 0:
                Log.Info(self, f"Delaying process start for {self.delay}s...")
                sleep(self.delay)

            itemShop = Utility.GET(self,
                                   "https://fortnite-api.com/shop/br",
                                   parameters={'language': self.language})

            if itemShop is not None:
                itemShop = json.loads(itemShop)['data']

                # Strip time from the timestamp, we only need the date
                date = Utility.ISOtoHuman(self, itemShop["date"].split("T")[0])
                Log.Success(
                    self, f"Retrieved Item Shop for {date} in {self.language}")

                shopImage = Athena.GenerateImage(self, date, itemShop)

                if shopImage is True:
                    if self.twitterEnabled is True:
                        Athena.Tweet(self, date)
示例#4
0
    def main(self):
        print("Athena - Fortnite Item Shop Generator")
        print("https://github.com/Liimiitz/Athena-FNAPI.io\n")

        initialized = Athena.LoadConfiguration(self)

        if initialized is True:
            if self.delay > 0:
                log.info(f"Delaying process start for {self.delay}s...")
                sleep(self.delay)

            itemShop = Utility.GET(
                self,
                "https://fortniteapi.io/v1/shop",
                {"Authorization": self.apiKey},
                {"lang": self.language},
            )

            if itemShop is not None:
                itemShop = json.loads(itemShop)

                # Strip time from the timestamp, we only need the date
                date = Utility.ISOtoHuman(self, today, self.language)
                log.info(f"Retrieved Item Shop for {date}")

                shopImage = Athena.GenerateImage(self, date, itemShop)

                if shopImage is True:
                    if self.twitterEnabled is True:
                        Athena.Tweet(self, date)
示例#5
0
    def main(self):
        print("Athena - Fortnite Item Shop Generator")
        print("https://github.com/EthanC/Athena\n")

        initialized = Athena.LoadConfiguration(self)

        if initialized is True:
            if self.delay > 0:
                log.info(f"Delaying process start for {self.delay}s...")
                sleep(self.delay)

            itemShop = Utility.GET(
                self,
                "https://fortnite-api.com/v2/shop/br",
                {"x-api-key": self.apiKey},
                {"language": self.language},
            )

            if itemShop is not None:
                itemShop = json.loads(itemShop)["data"]

                # Strip time from the timestamp, we only need the date
                date = Utility.ISOtoHuman(self, itemShop["date"].split("T")[0],
                                          self.language)
                log.info(f"Retrieved Item Shop for {date}")

                shopImage = Athena.GenerateImage(self, date, itemShop)

                if shopImage is True:
                    if self.twitterEnabled is True:
                        Athena.Tweet(self, date)
示例#6
0
    def main(self):
        initialized = Athena.LoadConfiguration(self)

        if initialized is True:
            itemShop = Utility.GET(
                self,
                "https://fortnite-api.com/shop/br",
                # {"x-api-key": self.apiKey},
                {"language": LANGUAGE},
            )

            global date, item_shop_id
            itemShop = json.loads(itemShop)["data"]
            current_item_shop_id = itemShop["hash"]

            # Strip time from the timestamp, we only need the date
            current_date = Utility.ISOtoHuman(self,
                                              itemShop["date"].split("T")[0],
                                              LANGUAGE)

            date = current_date
            log.info(f"Retrieved Item Shop for {current_date}")

            if current_item_shop_id != item_shop_id:
                item_shop_id = current_item_shop_id
                self.sendImageToChannel(self, current_date, itemShop)
                # manda immagine
            else:
                log.info("Image not generated on this loop (same as previous)")

            log.info(
                f"End loop, waiting {config_utils.TIMER_TIME_SECONDS} seconds ------"
            )
            log.info("<---->")

            time.sleep(config_utils.TIMER_TIME_SECONDS)
            Athena.main(Athena)
示例#7
0
 def GET_ItemShop(self, api_key: str, language: str = "en") -> str:
     return Utility.GET(self,
                        url="https://fortnite-api.com/shop/br",
                        headers={"x-api-key": api_key},
                        params={"language": language},
                        timeout=(6.0, 15.0))