Separate run into a load and run function, to allow for the use of utility methods. #5

Merged
CSDUMMI merged 3 commits from feat-separate-run-load into main 2023-04-03 16:16:24 +00:00
CSDUMMI commented 2023-03-29 17:57:26 +00:00 (Migrated from gitlab.com)

Previously, the run method both connected to the mastodon instance, initialized Mastodon.py and started listening on streams (from which it would never return).

This MR moves initializing Mastodon.py and connecting to the mastodon instance into a separate load method, that makes Mastobot usable as a library for interacting with Mastodon, without listening for events.

from mastobot import Bot

bot = Bot(..)

bot.load()

bot.post("Hello, World")

This example would previously have been impossible. This MR also adds the post method to the Bot, allowing developers to post stand-alone statuses to Mastodon (instead of only as reply as was previously the case).

Previously, the `run` method both connected to the mastodon instance, initialized Mastodon.py and started listening on streams (from which it would never return). This MR moves initializing Mastodon.py and connecting to the mastodon instance into a separate `load` method, that makes Mastobot usable as a library for interacting with Mastodon, without listening for events. ```python from mastobot import Bot bot = Bot(..) bot.load() bot.post("Hello, World") ``` This example would previously have been impossible. This MR also adds the `post` method to the Bot, allowing developers to post stand-alone statuses to Mastodon (instead of only as reply as was previously the case).
CSDUMMI commented 2023-03-29 17:57:26 +00:00 (Migrated from gitlab.com)

requested review from @emacsen

requested review from @emacsen
CSDUMMI commented 2023-03-29 17:57:26 +00:00 (Migrated from gitlab.com)

assigned to @CSDUMMI

assigned to @CSDUMMI
CSDUMMI commented 2023-03-29 17:58:03 +00:00 (Migrated from gitlab.com)

added 4 commits

  • b4dff1a6...cbf650c5 - 3 commits from branch main
  • 7aba53e6 - Merge branch 'main' into 'feat-separate-run-load'

Compare with previous version

added 4 commits <ul><li>b4dff1a6...cbf650c5 - 3 commits from branch <code>main</code></li><li>7aba53e6 - Merge branch &#39;main&#39; into &#39;feat-separate-run-load&#39;</li></ul> [Compare with previous version](/babka_net/mastobot/-/merge_requests/3/diffs?diff_id=642226595&start_sha=b4dff1a6528bdf0f778d9f21b70bbd363f03b16c)
CSDUMMI commented 2023-04-03 15:53:07 +00:00 (Migrated from gitlab.com)

added 1 commit

  • a149046b - Wrap returned Status from .post into a status to remove exposure to the underlying dicts

Compare with previous version

added 1 commit <ul><li>a149046b - Wrap returned Status from .post into a status to remove exposure to the underlying dicts</li></ul> [Compare with previous version](/babka_net/mastobot/-/merge_requests/3/diffs?diff_id=646071800&start_sha=7aba53e65b2257fe7116cd4d4320890a0978fa56)
CSDUMMI commented 2023-04-03 16:15:49 +00:00 (Migrated from gitlab.com)

added 1 commit

  • b69a62b4 - Wrap returned Status from .post into a status to remove exposure to the underlying dicts

Compare with previous version

added 1 commit <ul><li>b69a62b4 - Wrap returned Status from .post into a status to remove exposure to the underlying dicts</li></ul> [Compare with previous version](/babka_net/mastobot/-/merge_requests/3/diffs?diff_id=646097944&start_sha=a149046b8522c835d9eec3e4b2ee4505e6fe45e3)
CSDUMMI commented 2023-04-03 16:16:24 +00:00 (Migrated from gitlab.com)

mentioned in commit 8ef2f37f67

mentioned in commit 8ef2f37f676d6efc5c474ec672f354ce30480fff
CSDUMMI (Migrated from gitlab.com) merged commit 8ef2f37f67 into main 2023-04-03 16:16:24 +00:00
Sign in to join this conversation.
No reviewers
No labels
bug
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
babka/matzobot!5
No description provided.