Skip to content

Commit a07bf65

Browse files
committed
added sub readmes
1 parent f632575 commit a07bf65

File tree

6 files changed

+72
-3
lines changed

6 files changed

+72
-3
lines changed

Readme.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ issue the actions will result in some output and actions following it.
4444

4545
![Actions flow example](images/bot_action_flow.png)
4646

47+
made using [draw.io](draw.io)
48+
49+
4750
#### Tech Stack:
4851
The bot is designed to work asynchronously.
4952

@@ -57,4 +60,17 @@ code using that framework only.
5760

5861
The complete architecture can be represented as:
5962

60-
![Bot Architecture](images/bot_architecture.png)
63+
![Bot Architecture](images/bot_architecture.png)
64+
65+
made using [draw.io](draw.io)
66+
67+
**Storage Manager Base Class** shown in the diagram is the class that will
68+
manage the database interaction. It will provide methods for storing and
69+
retrieving data from database.
70+
71+
72+
### TODO
73+
74+
- Add database methods for Async database interaction
75+
- Add Sub-modules in Interaction layer for reusing the architecture
76+
for multiple messenger services

actions_framework/readme.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Actions
2+
3+
Fundamental unit of User-Bot interaction (commands/data sent by user to
4+
the bot).
5+
6+
There can be three `kinds` of such interactions:
7+
- `Command`: Slash commands that specify specific action eg `/start`.
8+
- `Message`: Fixed message that need not be represented as slash command.
9+
- `Input`: Request random keyboard input from the user.
10+
11+
12+
Each `Action` has following basic attributes:
13+
- `Trigger`: Keyword that can activate the command. (Doesn't contain
14+
preceding `/` in case of slash commands
15+
- `Kind`:
16+
- `C`: for slash command
17+
- `M`: for some fixed message
18+
- `I`: for input action
19+
- `callback function`: function to be called when this action is invoked.

managers/Readme.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Managers
2+
3+
This module consists of manager classes that perform various functions.
4+
5+
- **ActionManager**: Defined in [actions.py](actions.py). Responsible for
6+
managing and resolving actions for services.
7+
- **Interaction Manager**: Defined in [interaction.py](interaction.py).
8+
Responsible for the interaction and services via Interaction layer.
9+
10+
`ActionManager` can be considered a part of `InteractionManager`. Later
11+
uses the former for resolution of actions and handles all other operations
12+
by itself.
13+
14+
- **BaseServiceManager**: Defined in [service_manager.py](service_manager.py).
15+
Base class for manager of a Bot service. Derive a new class from this class
16+
and override the `incoming_action_callback()` to define what to do when
17+
an action from this service was chosen. All the Children of this class, i.e.
18+
the managers of different services should be `Singleton Classes`.
19+
20+
- **StorageManager**: Defined in [storage.py](storage.py). Class that defines
21+
methods for storing and retrieving data from database.

managers/actions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def register_service(self, name, callback):
2727
def service_register_message(self, *args, **kwargs):
2828
return "Choose from the options"
2929

30-
async def resolve_action(self, session, message):
30+
def resolve_action(self, session, message):
3131
"""
3232
This session will use the context in session['action'] to get the next publisher callback. For action, if there
3333
"""

publish_framework/Readme.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Publisher Framework
2+
The publisher framework that is responsible for Spamming the user with
3+
new content :stuck_out_tongue:.
4+
5+
This module
6+
7+
This Module, currently, consists of 4 parts.
8+
- **manager**: Manager for the Publisher Framework. A singleton class.
9+
- publishers: various publishers that will send the periodic data to the
10+
users
11+
- Filters
12+
- News Poller

publish_framework/filters/base.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ async def filter(self, content, to):
3535
:to: filtered list of recipients who can receive this content
3636
"""
3737

38-
return True, content, to
38+
# return True, content, to
39+
raise NotImplementedError("filter() not implemented")

0 commit comments

Comments
 (0)