Skip to content

Commit

Permalink
Add Epic Games MEGA Sale 2024, increase line length, fix Ruff warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLovinator1 committed May 16, 2024
1 parent 4d957ba commit eb07da1
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 180 deletions.
192 changes: 29 additions & 163 deletions discord_free_game_notifier/epic_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,8 @@ def create_json_file() -> None:
"id": "the_sims_4_my_first_pet_stuff",
"game_name": "The Sims™ 4 My First Pet Stuff",
"game_url": "https://store.epicgames.com/en-US/p/the-sims-4--my-first-pet-stuff",
"start_date": datetime.datetime(
year=2023,
month=12,
day=1,
hour=11,
minute=0,
second=0,
tzinfo=datetime.UTC,
).isoformat(),
"end_date": datetime.datetime(
year=2024,
month=1,
day=9,
hour=18,
minute=0,
second=0,
tzinfo=datetime.UTC,
).isoformat(),
"start_date": datetime.datetime(year=2023, month=12, day=1, hour=11, minute=0, second=0, tzinfo=datetime.UTC).isoformat(),
"end_date": datetime.datetime(year=2024, month=1, day=9, hour=18, minute=0, second=0, tzinfo=datetime.UTC).isoformat(),
"image_link": "https://thelovinator1.github.io/discord-free-game-notifier/images/the_sims_4_my_first_pet_stuff.jpg",
"description": "Welcome home a new small animal and show love for Cats and Dogs with The Sims™ 4 My First Pet Stuff.\n\n[Instant Checkout](https://store.epicgames.com/purchase?offers=1-2a14cf8a83b149919a2399504e5686a6-7002cdb1eb2543da85ac8a3c4c6d71d5#/)", # noqa: E501
"developer": "Maxis",
Expand All @@ -59,24 +43,8 @@ def create_json_file() -> None:
"id": "fall_guys_giddy_gift",
"game_name": "Fall Guys - Giddy Gift",
"game_url": "https://store.epicgames.com/en-US/p/fall-guys--giddy-gift",
"start_date": datetime.datetime(
year=2023,
month=12,
day=13,
hour=16,
minute=0,
second=0,
tzinfo=datetime.UTC,
).isoformat(),
"end_date": datetime.datetime(
year=2024,
month=1,
day=10,
hour=0,
minute=0,
second=0,
tzinfo=datetime.UTC,
).isoformat(),
"start_date": datetime.datetime(year=2023, month=12, day=13, hour=16, minute=0, second=0, tzinfo=datetime.UTC).isoformat(),
"end_date": datetime.datetime(year=2024, month=1, day=10, hour=0, minute=0, second=0, tzinfo=datetime.UTC).isoformat(),
"image_link": "https://thelovinator1.github.io/discord-free-game-notifier/images/fall_guys_giddy_gift.jpg",
"description": "May we 'present' the free Giddy Gift costume! Wrap up this Winter & earn a crown or two in Fall Guys\n\nIncludes: Giddy Gift (Whole Costume)", # noqa: E501
"developer": "Mediatonic",
Expand All @@ -85,24 +53,8 @@ def create_json_file() -> None:
"id": "disney_speedstorm_monochromatic_pack",
"game_name": "Disney Speedstorm - Monochromatic Pack",
"game_url": "https://store.epicgames.com/en-US/p/disney-speedstorm--monochromatic-pack",
"start_date": datetime.datetime(
year=2023,
month=12,
day=13,
hour=16,
minute=0,
second=0,
tzinfo=datetime.UTC,
).isoformat(),
"end_date": datetime.datetime(
year=2024,
month=1,
day=10,
hour=0,
minute=0,
second=0,
tzinfo=datetime.UTC,
).isoformat(),
"start_date": datetime.datetime(year=2023, month=12, day=13, hour=16, minute=0, second=0, tzinfo=datetime.UTC).isoformat(),
"end_date": datetime.datetime(year=2024, month=1, day=10, hour=0, minute=0, second=0, tzinfo=datetime.UTC).isoformat(),
"image_link": "https://thelovinator1.github.io/discord-free-game-notifier/images/disney_speedstorm_monochromatic_pack.jpg",
"description": "This pack includes:\n• Racing Suit for Goofy: Monochromatic Classic\n• Kart livery for Goofy: Monochromatic Classic\n• Chip n' Dale Rare Crew Shards\n• 5 Universal Box Credits", # noqa: E501
"developer": "Gameloft",
Expand All @@ -111,24 +63,8 @@ def create_json_file() -> None:
"id": "dark_justiciar_shadowheart_party_pack",
"game_name": "Dark Justiciar Shadowheart Party Pack",
"game_url": "https://store.epicgames.com/en-US/p/idle-champions-of-the-forgotten-realms--dark-justiciar-shadow-heart-party-pack",
"start_date": datetime.datetime(
year=2023,
month=12,
day=13,
hour=16,
minute=0,
second=0,
tzinfo=datetime.UTC,
).isoformat(),
"end_date": datetime.datetime(
year=2024,
month=1,
day=10,
hour=0,
minute=0,
second=0,
tzinfo=datetime.UTC,
).isoformat(),
"start_date": datetime.datetime(year=2023, month=12, day=13, hour=16, minute=0, second=0, tzinfo=datetime.UTC).isoformat(),
"end_date": datetime.datetime(year=2024, month=1, day=10, hour=0, minute=0, second=0, tzinfo=datetime.UTC).isoformat(),
"image_link": "https://thelovinator1.github.io/discord-free-game-notifier/images/dark_justiciar_shadowheart_party_pack.jpg",
"description": "This pack unlocks the first 3 Baldur's Gate 3 Champions: Lae'zel, Shadowheart, and Astarion. Also included are 7 Gold Champion Chests for each and an exclusive Skin & Feat Shadowheart!", # noqa: E501
"developer": "Codename Entertainment",
Expand All @@ -137,24 +73,8 @@ def create_json_file() -> None:
"id": "warframe_holiday_sale_2023",
"game_name": "Warframe - Holiday Sale 2023",
"game_url": "https://store.epicgames.com/en-US/p/warframe",
"start_date": datetime.datetime(
year=2023,
month=12,
day=13,
hour=16,
minute=0,
second=0,
tzinfo=datetime.UTC,
).isoformat(),
"end_date": datetime.datetime(
year=2024,
month=1,
day=10,
hour=0,
minute=0,
second=0,
tzinfo=datetime.UTC,
).isoformat(),
"start_date": datetime.datetime(year=2023, month=12, day=13, hour=16, minute=0, second=0, tzinfo=datetime.UTC).isoformat(),
"end_date": datetime.datetime(year=2024, month=1, day=10, hour=0, minute=0, second=0, tzinfo=datetime.UTC).isoformat(),
"image_link": "https://thelovinator1.github.io/discord-free-game-notifier/images/warframe_holiday_sale_2023.jpg",
"description": "Come celebrate the Epic Games Holiday Sale with us and claim the Atterax Weapon, a 7-Day Credit Booster and 7-Day Affinity Booster for free!\nPlayers who launch and log in to WARFRAME on Epic Games Store during the promotional period will receive an inbox message with free content upon login into the game. ", # noqa: E501
"developer": "Digital Extremes",
Expand All @@ -163,24 +83,8 @@ def create_json_file() -> None:
"id": "honkai_impact_holiday_sale_2023",
"game_name": "Honkai Impact - Holiday Sale 2023",
"game_url": "https://store.epicgames.com/en-US/p/honkai-impact-3rd",
"start_date": datetime.datetime(
year=2023,
month=12,
day=13,
hour=16,
minute=0,
second=0,
tzinfo=datetime.UTC,
).isoformat(),
"end_date": datetime.datetime(
year=2024,
month=1,
day=10,
hour=0,
minute=0,
second=0,
tzinfo=datetime.UTC,
).isoformat(),
"start_date": datetime.datetime(year=2023, month=12, day=13, hour=16, minute=0, second=0, tzinfo=datetime.UTC).isoformat(),
"end_date": datetime.datetime(year=2024, month=1, day=10, hour=0, minute=0, second=0, tzinfo=datetime.UTC).isoformat(),
"image_link": "https://thelovinator1.github.io/discord-free-game-notifier/images/honkai_impact_holiday_sale_2023.jpg",
"description": "Celebrate the Epic Games Holiday Sale and get 500 Asterites and 100,000 Coins for free!\nPlayers who log in to Honkai Impact 3rd on Epic Games Store during the event period will receive the bundle via an in-game mail within one week.", # noqa: E501
"developer": "miHoYo Limited",
Expand All @@ -189,24 +93,8 @@ def create_json_file() -> None:
"id": "synced_holiday_sale_2023",
"game_name": "SYNCED: Winterfest Bundle",
"game_url": "https://store.epicgames.com/en-US/p/synced--winterfest-bundle",
"start_date": datetime.datetime(
year=2023,
month=12,
day=13,
hour=16,
minute=0,
second=0,
tzinfo=datetime.UTC,
).isoformat(),
"end_date": datetime.datetime(
year=2024,
month=1,
day=10,
hour=0,
minute=0,
second=0,
tzinfo=datetime.UTC,
).isoformat(),
"start_date": datetime.datetime(year=2023, month=12, day=13, hour=16, minute=0, second=0, tzinfo=datetime.UTC).isoformat(),
"end_date": datetime.datetime(year=2024, month=1, day=10, hour=0, minute=0, second=0, tzinfo=datetime.UTC).isoformat(),
"image_link": "https://thelovinator1.github.io/discord-free-game-notifier/images/synced_holiday_sale_2023.jpg",
"description": "Unlock this Bundle of SYNCED to obtain new Runner and weapon skins, and embrace fresh challenges in the new season - Lambent Dawn.", # noqa: E501
"developer": "NExT Studios",
Expand All @@ -215,24 +103,8 @@ def create_json_file() -> None:
"id": "world_of_warships_holiday_sale_2023",
"game_name": "World of Warships — Frosty Celebration Pack",
"game_url": "https://store.epicgames.com/en-US/p/world-of-warships--frosty-celebration-pack",
"start_date": datetime.datetime(
year=2023,
month=12,
day=13,
hour=16,
minute=0,
second=0,
tzinfo=datetime.UTC,
).isoformat(),
"end_date": datetime.datetime(
year=2024,
month=1,
day=10,
hour=0,
minute=0,
second=0,
tzinfo=datetime.UTC,
).isoformat(),
"start_date": datetime.datetime(year=2023, month=12, day=13, hour=16, minute=0, second=0, tzinfo=datetime.UTC).isoformat(),
"end_date": datetime.datetime(year=2024, month=1, day=10, hour=0, minute=0, second=0, tzinfo=datetime.UTC).isoformat(),
"image_link": "https://thelovinator1.github.io/discord-free-game-notifier/images/world_of_warships_holiday_sale_2023.jpg",
"description": "Embrace the magic of the winter holidays with this free DLC featuring cruiser Ning Hai and the enchanting allure of even more Premium ships that could drop from five festive Santa's Gift containers.", # noqa: E501
"developer": "Wargaming",
Expand All @@ -241,28 +113,22 @@ def create_json_file() -> None:
"id": "eve_online_superluminal_pack",
"game_name": "EVE Online - Superluminal Pack",
"game_url": "https://store.epicgames.com/en-US/p/eve-online--superluminal-pack",
"start_date": datetime.datetime(
year=2023,
month=12,
day=13,
hour=16,
minute=0,
second=0,
tzinfo=datetime.UTC,
).isoformat(),
"end_date": datetime.datetime(
year=2024,
month=1,
day=10,
hour=0,
minute=0,
second=0,
tzinfo=datetime.UTC,
).isoformat(),
"start_date": datetime.datetime(year=2023, month=12, day=13, hour=16, minute=0, second=0, tzinfo=datetime.UTC).isoformat(),
"end_date": datetime.datetime(year=2024, month=1, day=10, hour=0, minute=0, second=0, tzinfo=datetime.UTC).isoformat(),
"image_link": "https://thelovinator1.github.io/discord-free-game-notifier/images/eve_online_superluminal_pack.jpg",
"description": "The Superluminal Pack is a limited-time-only FREE giveaway exclusive to Epic! It contains Semiotique Superluminal SKINs for the Heron, Magnate, Imicus, and Probe as well as unique Superluminal clothing!", # noqa: E501
"developer": "CCP Games",
},
{
"id": "epic_mega_sale_2024",
"game_name": "Epic Games MEGA Sale 2024",
"game_url": "https://store.epicgames.com/en-US/free-games",
"start_date": datetime.datetime(year=2024, month=5, day=16, hour=18, minute=0, second=0, tzinfo=datetime.UTC).isoformat(),
"end_date": datetime.datetime(year=2024, month=6, day=12, hour=0, minute=0, second=0, tzinfo=datetime.UTC).isoformat(),
"image_link": "https://thelovinator1.github.io/discord-free-game-notifier/images/epic_mega_sale_2024.jpg",
"description": "Free Epic stuff:\n- [Disney Speedstorm Monochromatic Pack - Racer Stitch](https://store.epicgames.com/en-US/p/disney-speedstorm--racer-stitch)\n- [Genshin Impact MEGA Sale Bundle](https://store.epicgames.com/en-US/p/genshin-impact--mega-sale-bundle)\n- [Honkai: Star Rail MEGA Sale Bundle](https://store.epicgames.com/en-US/p/honkai-star-rail--epic-mega-sale-event-bundle)\n- [Fortnite Overclocked Combo Pack](https://store.epicgames.com/en-US/p/fortnite--overclocked-combo-pack)\n- [Fall Guys - Soda Crown](https://store.epicgames.com/en-US/p/fall-guys--soda-crown)\n- [1 Month of Discord Nitro](https://store.epicgames.com/en-US/p/discord--discord-nitro)\n- [Golden Drake's Eye Bundle](https://store.epicgames.com/en-US/p/dauntless--golden-drakes-eye-bundle)\n- [Warframe Pyra Syandana and Fire Color Picker](https://store.epicgames.com/en-US/p/warframe)\n- [Honkai Impact 3rd Bundle](https://store.epicgames.com/en-US/p/honkai-impact-3rd)", # noqa: E501
"developer": "Epic Games et al.",
},
],
}

Expand Down Expand Up @@ -362,5 +228,5 @@ def scrape_epic_json() -> Generator[DiscordEmbed, Any, list[Any] | None]:
response: requests.Response = send_embed_webhook(game)
if not response.ok:
logger.error(
f"Error when checking game for Epic (JSON):\n{response.status_code} - {response.reason}: {response.text}", # noqa: E501
f"Error when checking game for Epic (JSON):\n{response.status_code} - {response.reason}: {response.text}",
)
5 changes: 1 addition & 4 deletions discord_free_game_notifier/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ def send_games(game: DiscordEmbed | None, game_service: str = "Unknown") -> None
response: Response = send_embed_webhook(game, game_service)

if not response.ok:
msg: str = (
f"Error when checking game for {game_service}:\n"
f"{response.status_code} - {response.reason}: {response.text}"
)
msg: str = f"Error when checking game for {game_service}:\n{response.status_code} - {response.reason}: {response.text}"
logger.error(msg)
send_webhook(msg)
else:
Expand Down
4 changes: 1 addition & 3 deletions discord_free_game_notifier/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
)

config_location: Path = Path(app_dir) / "config.conf"
default_webhook_url: str = (
"https://discord.com/api/webhooks/1234/567890/ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"
)
default_webhook_url: str = "https://discord.com/api/webhooks/1234/567890/ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"

config_webhook_url = ""
config_log_level = "INFO"
Expand Down
2 changes: 1 addition & 1 deletion discord_free_game_notifier/steam_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,5 +215,5 @@ def scrape_steam_json() -> Generator[DiscordEmbed, Any, list[Any] | None]:
response: requests.Response = send_embed_webhook(game)
if not response.ok:
logger.error(
f"Error when checking game for Steam (JSON):\n{response.status_code} - {response.reason}: {response.text}", # noqa: E501
f"Error when checking game for Steam (JSON):\n{response.status_code} - {response.reason}: {response.text}",
)
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ build-backend = "poetry.core.masonry.api"
fix = true
unsafe-fixes = true
preview = true
line-length = 120
select = ["ALL"]
ignore = [
line-length = 140 # Because we have JSON in the code that is long
lint.select = ["ALL"]
lint.ignore = [
"D100",
"D104",
"CPY001",
Expand All @@ -45,8 +45,8 @@ ignore = [
"DJ001",
]

[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"tests/*" = ["S101", "SIM114"]
5 changes: 1 addition & 4 deletions tests/test_epic.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,7 @@ def test_promotion_end() -> None:
def test_game_image() -> None:
"""Test that the game image is returned correctly."""
result: str = game_image(game)
assert (
result
== "https://cdn1.epicgames.com/spt-assets/ef2777467a3c49059a076e42fd9b41f0/download-gloomhaven-offer-1ho2x.jpg"
)
assert result == "https://cdn1.epicgames.com/spt-assets/ef2777467a3c49059a076e42fd9b41f0/download-gloomhaven-offer-1ho2x.jpg"


def test_game_url() -> None:
Expand Down

0 comments on commit eb07da1

Please sign in to comment.