slack-machine icon indicating copy to clipboard operation
slack-machine copied to clipboard

Added init_final() as an alternative to init()

Open BerglundDaniel opened this issue 3 years ago • 2 comments

init() in the MachineBaseplugin is called before Slack is initialized, which can be annoying if you wan to initialize something that needs some info from Slack, for instance channel names. This adds init_final() to MachineBasePlugin which is called after the initialization of Slack after the channels, users etc are loaded.

I'm not sure if init_final() is the best name so any suggestions for a better name would be welcome, and ofc any other feedback too. Also let me know if any tests or docs need to be updated too.

BerglundDaniel avatar Mar 27 '21 00:03 BerglundDaniel

Codecov Report

Merging #444 (4b5c698) into master (62ac791) will decrease coverage by 0.36%. The diff coverage is 53.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #444      +/-   ##
==========================================
- Coverage   76.16%   75.80%   -0.37%     
==========================================
  Files          24       24              
  Lines         919      930      +11     
==========================================
+ Hits          700      705       +5     
- Misses        219      225       +6     
Impacted Files Coverage Δ
machine/clients/singletons/slack.py 42.05% <37.50%> (-0.95%) :arrow_down:
machine/dispatch.py 90.00% <50.00%> (ø)
machine/core.py 71.24% <66.66%> (+0.38%) :arrow_up:
machine/plugins/base.py 57.89% <100.00%> (-0.15%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 62ac791...4b5c698. Read the comment docs.

codecov[bot] avatar Mar 27 '21 00:03 codecov[bot]

Using @process('hello') seems to be an alternative too. Is that better? Will the hello event happen at the correct times?

BerglundDaniel avatar Apr 04 '21 17:04 BerglundDaniel