Skip to content

Port sidebar updater bot to lemmy#15

Open
benja810 wants to merge 2 commits intolemmyfrom
lemmy-sidebar-bot
Open

Port sidebar updater bot to lemmy#15
benja810 wants to merge 2 commits intolemmyfrom
lemmy-sidebar-bot

Conversation

@benja810
Copy link
Copy Markdown
Owner

Context

The redball bot knows how to update subreddits' sidebars with a certain division's standings. This PR brings that functionality to lemmy.

Notes

  • Used plemmy instead of plaw
  • We'll need to update the auth and teamSubs with this PR to be compatible with the new lemmy auth and customizable teamSubs config when those PRs are ready.

@benja810
Copy link
Copy Markdown
Owner Author

resolves #8

Copy link
Copy Markdown
Collaborator

@jspayne jspayne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, looks like a pretty straightforward port. I added some notes about making use of the changes I made for redditAuth and URL config.

I feel like this could be a combined reddit/lemmy script. Given that it already supports two different formats (old and new reddit), adding lemmy could (in most cases) just be a matter of adding a third. The fact that it doesn't have the complexity of the MLB bot is a case for just changing the existing bot (it should't be too hard) as well as a case for keeping it separate (re-use just isn't that beneficial). I'm fine with it either way.

self.shutdown()

def bot_state(self):
community_url = self.community['actor_id']
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll double check this, but I don't see where self.community is initialized.

Comment on lines +212 to +215
instance_name = self.settings.get("Lemmy", {}).get("INSTANCE_NAME", "")
username = self.settings.get("Lemmy", {}).get("USERNAME", "")
password = self.settings.get("Lemmy", {}).get("PASSWORD", "")
community = self.settings.get("Bot", {}).get("COMMUNITY_NAME")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd move COMMUNITY_NAME to the Lemmy configuration group for consistency with the MLB bot. Then you can use the same code for grabbing the login info as in that bot, using the redditAuth changes in redball:

Suggested change
instance_name = self.settings.get("Lemmy", {}).get("INSTANCE_NAME", "")
username = self.settings.get("Lemmy", {}).get("USERNAME", "")
password = self.settings.get("Lemmy", {}).get("PASSWORD", "")
community = self.settings.get("Bot", {}).get("COMMUNITY_NAME")
# Check for Lemmy
instance_name = self.settings.get("Lemmy Auth", {}).get("lemmy_instance", "")
username = self.settings.get("Lemmy Auth", {}).get("lemmy_username", "")
password = self.settings.get("Lemmy Auth", {}).get("lemmy_password", "")
community = self.settings.get("Lemmy", {}).get("COMMUNITY_NAME")

current_week,
)

mlb_team_subs = {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can alter my URL config to move the json file(s) to a directory under bots where the urls can be shared across all the bots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants