|
| 1 | +from eventhandlers.action_runners.base.ActionRunner import ActionRunner |
| 2 | +from eventhandlers.action_runners.base.ActionTrigger import ActionTrigger |
| 3 | +from eventhandlers.action_runners.base.ActionCondition import ActionCondition |
| 4 | +from eventhandlers.action_runners.base.ActionCompleteCondition import ActionCompleteCondition |
| 5 | + |
| 6 | + |
| 7 | +class NewNameAction(ActionRunner): |
| 8 | + public_name = 'NewName' |
| 9 | + icon = 'https://www.svgrepo.com/show/46774/export.svg' |
| 10 | + kind = 'NewName' # The kind has to be unique to all actions |
| 11 | + category = 'some_category' # Optional |
| 12 | + |
| 13 | + # What events can this action listen to? |
| 14 | + trigger = ActionTrigger(default_event = 'some_diffgram_event', |
| 15 | + event_list = ['some_diffgram_event']) |
| 16 | + |
| 17 | + # What pre-conditions can this action have? |
| 18 | + condition_data = ActionCondition(default_event = 'some_diffgram_event', |
| 19 | + event_list = ['some_diffgram_event']) |
| 20 | + |
| 21 | + # How to declare the actions as completed? |
| 22 | + completion_condition_data = ActionCompleteCondition(default_event = 'some_diffgram_event', |
| 23 | + event_list = ['some_diffgram_event']) |
| 24 | + |
| 25 | + def execute_pre_conditions(self, session) -> bool: |
| 26 | + # Return true if no pre-conditions are needed. |
| 27 | + return True |
| 28 | + |
| 29 | + def execute_action(self, session): |
| 30 | + # Your core Action logic will go here. |
| 31 | + pass |
0 commit comments