Пример #1
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)
Пример #2
0
                access_token_key=self.twitterAccessToken,
                access_token_secret=self.twitterAccessSecret,
            )

            twitterAPI.VerifyCredentials()
        except Exception as e:
            Log.Error(self, f"Failed to authenticate with Twitter, {e}")

            return

        body = f"#Fortnite Item Shop for {date}"

        if self.supportACreator is not None:
            body = f"{body}\n\nSupport-a-Creator Code: {self.supportACreator}"

        try:
            with open("itemshop.png", "rb") as shopImage:
                twitterAPI.PostUpdate(body, media=shopImage)

            Log.Success(self, "Tweeted Item Shop")
        except Exception as e:
            Log.Error(self, f"Failed to Tweet Item Shop, {e}")


if __name__ == "__main__":
    try:
        Athena.main(Athena)
    except KeyboardInterrupt:
        Log.Info(Athena, "Exiting...")
        exit()