Skip to content

Commit

Permalink
Merge pull request #16 from phi1997/main
Browse files Browse the repository at this point in the history
Allow title of game in alt text to be set in configuration/Adds variable time limit to polls
  • Loading branch information
TomCasavant authored May 5, 2024
2 parents 4a6b817 + eab258d commit efbe0d0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 9 additions & 6 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,13 @@ def run(self):
self.gameboy.empty_directory(gif_dir)

image = self.gameboy.screenshot()
alt_text = 'Screenshot of ' + self.gameboy_config.get('title', 'a Game Boy game.')
media = self.retry_mastodon_call(
self.mastodon.media_post,
retries=5,
interval=10,
media_file=image,
description="Screenshot of Pokemon Gold",
self.mastodon.media_post,
retries=5,
interval=10,
media_file=image,
description=alt_text
)
media_ids = []
# Probably add a check here if generating a gif is enabled (so we don't
Expand Down Expand Up @@ -229,6 +230,8 @@ def run(self):
media_ids=[media_ids],
)

poll_duration = self.mastodon_config.get('poll_duration', 60)

poll = self.retry_mastodon_call(
self.post_poll,
retries=5,
Expand All @@ -244,6 +247,7 @@ def run(self):
"Start",
"Select",
],
expires_in=poll_duration*60,
reply_id=post["id"],
)

Expand All @@ -254,7 +258,6 @@ def run(self):
post_id=post["id"],
poll_id=poll["id"],
)

result = False
if result:
gif = self.retry_mastodon_call(
Expand Down
2 changes: 2 additions & 0 deletions config.toml.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[mastodon]
server = "https://tomkahe.com"
access_token = ""
poll_duration = 60

[gameboy]
rom = "Pokemon - Gold Version.gbc"
title = "Pokémon Gold"

0 comments on commit efbe0d0

Please sign in to comment.