pymultibots 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,263 @@
1
+ Metadata-Version: 2.4
2
+ Name: pymultibots
3
+ Version: 0.0.1
4
+ Summary: Librairy to implement chatbot and broadcast bot on multiple platform (telegram, signal an whatsapp) at the same time
5
+ Author-email: Collective <pymultibot@systemli.org>
6
+ License: CC Attribution 4.0
7
+ Project-URL: Repository, https://gitlab.com/pymultibot/pymultibot
8
+ Keywords: chatbot,bot,telegram,signal,whatsapp
9
+ Requires-Python: >=3.8
10
+ Description-Content-Type: text/markdown
11
+
12
+ # Py multi-platform bot
13
+
14
+ ## 1 - Presentation
15
+
16
+ This API is meant to help create a simple _non-AI_ multi-platform chatbot and difusion bot. It is meant to be a tool that can be used by people who aren't particullarly technically minded.
17
+
18
+ It will hopefully support as platforms :
19
+ - The terminal (_for testing_)
20
+ - Telegram
21
+ - Signal (_will be implemented relatively quickly_)
22
+ - Whatsapp (_will be implemented relatively quickly_)
23
+ - A website (_no plan to implement yet_)
24
+
25
+ ### 1.a - Installation
26
+
27
+ This repository is packaged on Pypi under the name `pymultibots` (with an `s` at the end, as _pymultibot_ was already used), and can thus be installed using :
28
+
29
+ ```bash
30
+ pip install pymultibots
31
+ ```
32
+
33
+ ### 1.b - Example
34
+
35
+ An example is present at [src/example/](./src/example/), for now it can be run by using the command :
36
+
37
+ ```bash
38
+ python3 terminal_example.py
39
+ ```
40
+
41
+ while being located in the [src/example/](./src/example/) folder.
42
+
43
+ ## 2 - List of parameters
44
+
45
+ Parameters for the bot (dialogue, chat ID, etc...) are passed by `json` objects (or `dict` in the python code).
46
+
47
+ ### 2.a - _proposed_ definition of dialogue bot
48
+
49
+ For the dialogue part of the bot, the dialogue can be described by this structure :
50
+
51
+ ```json
52
+ {
53
+ "start" : {
54
+ "message" : "This bot is a simple bot asking you for your username and email",
55
+ "no_response" : true,
56
+ "next_state" : "username"
57
+ },
58
+ "username" : {
59
+ "message" : "Please enter your username :",
60
+ "store_key" : "uname",
61
+ "input_restriction" : "max_length:10",
62
+ "restriction_message" : "Your username can't be more than 10 characters long",
63
+ "next_state" : "has_email"
64
+ },
65
+ "has_email" : {
66
+ "message" : "Do you want to input an email ?",
67
+ "options" : ["[Y] yes I want to input an email !", "[n] no I'd rather not !"],
68
+ "option_key" : ["Y", "n"],
69
+ "allow_different_key" : true,
70
+ "next_state" : ["email", "end_state"],
71
+ "default_state" : "end_state"
72
+ },
73
+ "email" : {
74
+ "message" : "Please enter your email :",
75
+ "store_key" : "email",
76
+ "next_state" : "end_state"
77
+ },
78
+ "end_state" : {
79
+ "message" : "Thank you for answering !",
80
+ "end_state" : true,
81
+ "cooldown" : 2
82
+ }
83
+ }
84
+ ```
85
+
86
+ This is passed to the _`to_add`_ function as a `dict` so it can be read of a `json` or `yml` file.
87
+
88
+ Each state is an entry in the `dict`, with the first state when interogating the bot being named `start`.
89
+
90
+ Here is a list of keys to parameterize the dialogue bot :
91
+ - `"message"` (_`str`_) : The messages that will be sent.
92
+ - `"file_paths"` (_`list`_ or _`str`_) : List of path of files or images if you want to join one to the message
93
+ - `"no_response"` (_`bool`_) : If true, doesn't wait for a response to pass to the next state (thus `"next_state"` needs to be a state and not a list of states).
94
+ - `"write_values"` (_`dict`_) : `dict` of values and associated keys to be written to the entry.
95
+ - `"options"` (_`list`_ of _`str`_) : A list of options to be selected.
96
+ - `"option_key"` (_`list`_ of _`str`_) : List of keys that correspond to each entry (for backend that requiere the user to choose an option by typing).
97
+ - `"option_values"` (_`list`_) : Values associated to each option.
98
+ - `"allow_different_key"` : If options are to be selected, wether to allow a key not in the list or not. Requires `default_state` to be set if `"next_state"` is a `list`.
99
+ - `key_not_in_list_message` (_`str`_) : What message to send to the user if the key is not in the list and `"allow_different_key"` is set to false.
100
+ - `"store_key"` (_`str`_) : Name of key where the input given by the user will be stored.
101
+ - `"next_state"` (_`str`_ or _`list`_ of _`str`_) : Either the state that will come next, or a list of states that correspond to each option if `"options"` are passed.
102
+ - `"default_state"` (_`str`_) : Next state if the option given is not in the list of `"options"`.
103
+ - `"default_value"` : Default value to be store if the option given is not in the list of `"options"`.
104
+ - `"end_state"` (_`bool`_) : If true this command will end the conversation.
105
+ - `"input_restriction"` (_`str`_) : Restrictions to the user input : `int` to force the user to input an integer, `number` to force the user to input a number (floating point or not, separeted by `.` or `,`), `max_length:N` to prevent having more than `N` character. Multiple restriction can apply, separated by semicolons, like `int;max_length:10` to allow only an int with maximum of 10 characters. If `"options"` are passed, the restrictions onlly apply if the key given is not in `"option_key"` and `"allow_different_key"` is true.
106
+ - `"restriction_message"` (_`str`_) : Message to be sent to the user if the input is restricted by `"input_restriction"`
107
+ - `"cooldown"` (_`int`_) : Cooldown before being able to talk again to the bot.
108
+
109
+ There are some special keys that can be stored :
110
+ - `"save"` (_`bool`_) : Wether the values gather by the dialogue with the user needs to be saved or not.
111
+ - `"share"` (_`bool`_) : If `"share"` is set to anything but true, the state will be saved but not broadcasted if a broadcaster is running.
112
+ - `"debug"` (_`bool`_) : If `"debug"` is set to true it won't be broadcasted, and although states marked with the `debug` flag are saved, they are deleted if and when the state file is archived.
113
+
114
+ All special keys (`"share"`, `"debug"`, `"cooldown"` and `"save"`) can be written without using the normal `"write_values"` option.
115
+
116
+ Every entry also have a field named `time` which denote the starting time of the dialogue as an iso timestamp. `time_str` is a string version of the `time` field according to the `time_format` parameter if present.
117
+
118
+ #### 2.a.1 - Multilanguage bot
119
+
120
+ You can get a multilanguage dialogue from merging dialogue defined in different languages using the `dialogue_utils.make_multilanguage_dialogue()` function :
121
+
122
+ ```python
123
+ dialogue = dialogue_utils.make_multilanguage_dialogue({
124
+ "message" : "Welcome, please choose language !\n\n ¡Bienvenido! Elige el idioma.",
125
+ "languages" : {
126
+ "Francais" : french_language_dialogue,
127
+ "Español" : spanish_language_dialogue
128
+ }
129
+ })
130
+ ```
131
+
132
+ You simply need to pass to the function a `dict` containing a starting message before language choice, and a dict of languages names associated with their dialogue dict as described in the previous section.
133
+
134
+ Any other key will be added to the newely generated `"start"` state, thus for example if you want your languages to be choses using short keys you can use :
135
+
136
+ ```python
137
+ dialogue = dialogue_utils.make_multilanguage_dialogue({
138
+ "message" : "Welcome, please choose language !\n\n ¡Bienvenido! Elige el idioma.",
139
+ "languages" : {
140
+ "[fr] Francais" : french_language_dialogue,
141
+ "[es] Español" : spanish_language_dialogue
142
+ },
143
+ "option_key" : ["fr", "es"]
144
+ })
145
+ ```
146
+
147
+ ### 2.b - _proposed_ list of particular key
148
+
149
+ Some keys have particular meaning :
150
+ - `send` : If it is present and equal to anything but `true` (or `1`), the answer won't be sent (_if the bot has a broadcast component_).
151
+ - `debug` : If it is present and equal to `true` or `1` the answer won't be archived when the list of answers are archived.
152
+
153
+ ### 2.c - _proposed_ definition of broadcast bot
154
+
155
+ A dialogue bot can be joined with a broadcast bot which will format the broadcast text for each answer. Here is the typical structure of a broadcast definition :
156
+
157
+ ```json
158
+ {
159
+ "filename" : "json_state_folder/terminal_broadcast_state.json",
160
+ "sleep_interval" : 1,
161
+ "template" : [
162
+ "Time of day {time_str},\n",
163
+ {
164
+ "template" : "username : {uname},\n",
165
+ "default_template" : "No username given,\n"
166
+ }, {
167
+ "template" : "user email : {email}",
168
+ "requiered_keys" : ["email"],
169
+ "default_template" : "no email provided."
170
+ }
171
+ ]
172
+ }
173
+ ```
174
+
175
+ Here is a list of keys to parameterize the broadcaster bot :
176
+ - `"filename"` (_`str`_) : Where the broadcaster saves the list of entries already seen.
177
+ - `"sleep_interval"` (_`float`_) : How often in seconds to check whether new entries were added (default is 1 second).
178
+ - `"template"` (_`str`_ or _`list`_ of _`dict`_ or _`str`_) : Template to create the message to broadcast, either a single `str` that gets formated using the keys stored by the bot, using the python function `template.format(entry)`, or a `list` of `dict` describing sections of the message as described bellow.
179
+
180
+ If the template field is made of a `list` of `dict`, each entry in the list are formated one after the other and appened to each other to generate the message, using the following field for each `dict` :
181
+ - `"template"` (_`str`_) : Template to create the message to broadcast using the python function `template.format(entry)`
182
+ - `"requiered_keys"` (_`list`_ of _`str`_) : List of keys that **all** need to be in the entry for the `"template_text"` to be formated and appened to the message.
183
+ - `"default_template"` (_`str`_) : Template to create the message to broadcast using the python function `default_template.format(entry)` if the keys listed in `"requiered_keys"` are not **all** present in the entry.
184
+
185
+ ### 2.d - _proposed_ parameters
186
+
187
+ ```json
188
+ {
189
+ "filename" : "json_state_folder/entry_list.json",
190
+ "cancel_tag" : "cancel",
191
+ "cancel_message" : "canceling the dialogue...",
192
+ "timezone" : "utc",
193
+ "time_format" : "%H:%M:%S %d/%m/%Y",
194
+ "archive_dirpath" : "json_state_folder/archive/",
195
+ "max_filesize_kb" : 0.5,
196
+ "max_file_length" : 5,
197
+ "max_archive_size_gb" : 0.00001
198
+ }
199
+ ```
200
+
201
+ The bot can further be parameterized :
202
+ - `"filename"` (_`str`_) : Path of where entries will be saved.
203
+ - `"cancel_tag"` (_`str`_ or _`list`_ of _`str`_) : Tag or list of tag that if written in the answer to a question (case insensitive) will cancel the dialogue without cooldown.
204
+ - `"cancel_message` (_`str`_) : Message that will be sent when canceling the dialogue.
205
+ - `"timezone"` (_`str`_) : Timezone string (passed to `pytz.timezone`) forwhich the `time` field will be measured, default is `utc`.
206
+ - `"time_format"` (_`str`_) : String that describe the format of the `time_str` field, according to the `strftime()` function of the `datetime` python package.
207
+ - `"archive_dirpath"` (_`str`_) : Path of archive foler.
208
+ - `"max_filesize_kb"` (_`float`_) : Maximum size of a file before being archived in `Kb`
209
+ - `"max_file_length"` (_`int`_) : Maximum number of entry in a file before being archived.
210
+ - `"max_archive_size_gb"` (_`float`_) : Maximum total archive folder size before the oldest archive file being deleted in `Gb`
211
+
212
+ ### 2.e - _proposed_ connection to platforms
213
+
214
+ For each backend (except the terminal backend which doesn't use account) you can log in to the account that will be used by the bot and/or the broadcaster using the function `backend.log_in_account(account_params)` with `account_params` being a `dict` with the following fields (depending on each platform) :
215
+
216
+ #### 2.e.1 - _proposed_ connection to telegram
217
+
218
+ ```python
219
+ from pymultibot import telegram
220
+
221
+ backend = telegram.telegram_backend(backend_parameters)
222
+
223
+ backend.login_account({
224
+ "telegram_chat_id" : "chat_id",
225
+ "telegram_bot_token" : "bot_token",
226
+ "force_option_key" : False
227
+ })
228
+ ```
229
+
230
+ To connect to telegram you need to pass the following arguments :
231
+ - `"telegram_chat_id"` ( _`str`_) : Id of the chat to which the broadcaster will broadcast.
232
+ - `"telegram_bot_token"` (_`str`_) : Bot token.
233
+ - `"force_option_key"` (_`bool`_, default is `false`) : Since telegram allows you to click on options, unless you set `"force_option_key"` to `true` the `"option_key"` parameter will be ignored so that the user can simply click rather than write an input by hand.
234
+
235
+ #### 2.e.2 - _proposed_ connection to signal
236
+
237
+ ```python
238
+ from pymultibot import signal
239
+
240
+ backend = signal.signal_backend(backend_parameters)
241
+
242
+ backend.login_account({
243
+ "todo" : "todo"
244
+ })
245
+ ```
246
+
247
+ To connect to signal you need to pass the following arguments :
248
+ - _Todo_
249
+
250
+ #### 2.e.2 - _proposed_ connection to whatsapp
251
+
252
+ ```python
253
+ from pymultibot import whatsapp
254
+
255
+ backend = whatsapp.whatsapp_backend(backend_parameters)
256
+
257
+ backend.login_account({
258
+ "todo" : "todo"
259
+ })
260
+ ```
261
+
262
+ To connect to whatsapp you need to pass the following arguments :
263
+ - _Todo_
@@ -0,0 +1,252 @@
1
+ # Py multi-platform bot
2
+
3
+ ## 1 - Presentation
4
+
5
+ This API is meant to help create a simple _non-AI_ multi-platform chatbot and difusion bot. It is meant to be a tool that can be used by people who aren't particullarly technically minded.
6
+
7
+ It will hopefully support as platforms :
8
+ - The terminal (_for testing_)
9
+ - Telegram
10
+ - Signal (_will be implemented relatively quickly_)
11
+ - Whatsapp (_will be implemented relatively quickly_)
12
+ - A website (_no plan to implement yet_)
13
+
14
+ ### 1.a - Installation
15
+
16
+ This repository is packaged on Pypi under the name `pymultibots` (with an `s` at the end, as _pymultibot_ was already used), and can thus be installed using :
17
+
18
+ ```bash
19
+ pip install pymultibots
20
+ ```
21
+
22
+ ### 1.b - Example
23
+
24
+ An example is present at [src/example/](./src/example/), for now it can be run by using the command :
25
+
26
+ ```bash
27
+ python3 terminal_example.py
28
+ ```
29
+
30
+ while being located in the [src/example/](./src/example/) folder.
31
+
32
+ ## 2 - List of parameters
33
+
34
+ Parameters for the bot (dialogue, chat ID, etc...) are passed by `json` objects (or `dict` in the python code).
35
+
36
+ ### 2.a - _proposed_ definition of dialogue bot
37
+
38
+ For the dialogue part of the bot, the dialogue can be described by this structure :
39
+
40
+ ```json
41
+ {
42
+ "start" : {
43
+ "message" : "This bot is a simple bot asking you for your username and email",
44
+ "no_response" : true,
45
+ "next_state" : "username"
46
+ },
47
+ "username" : {
48
+ "message" : "Please enter your username :",
49
+ "store_key" : "uname",
50
+ "input_restriction" : "max_length:10",
51
+ "restriction_message" : "Your username can't be more than 10 characters long",
52
+ "next_state" : "has_email"
53
+ },
54
+ "has_email" : {
55
+ "message" : "Do you want to input an email ?",
56
+ "options" : ["[Y] yes I want to input an email !", "[n] no I'd rather not !"],
57
+ "option_key" : ["Y", "n"],
58
+ "allow_different_key" : true,
59
+ "next_state" : ["email", "end_state"],
60
+ "default_state" : "end_state"
61
+ },
62
+ "email" : {
63
+ "message" : "Please enter your email :",
64
+ "store_key" : "email",
65
+ "next_state" : "end_state"
66
+ },
67
+ "end_state" : {
68
+ "message" : "Thank you for answering !",
69
+ "end_state" : true,
70
+ "cooldown" : 2
71
+ }
72
+ }
73
+ ```
74
+
75
+ This is passed to the _`to_add`_ function as a `dict` so it can be read of a `json` or `yml` file.
76
+
77
+ Each state is an entry in the `dict`, with the first state when interogating the bot being named `start`.
78
+
79
+ Here is a list of keys to parameterize the dialogue bot :
80
+ - `"message"` (_`str`_) : The messages that will be sent.
81
+ - `"file_paths"` (_`list`_ or _`str`_) : List of path of files or images if you want to join one to the message
82
+ - `"no_response"` (_`bool`_) : If true, doesn't wait for a response to pass to the next state (thus `"next_state"` needs to be a state and not a list of states).
83
+ - `"write_values"` (_`dict`_) : `dict` of values and associated keys to be written to the entry.
84
+ - `"options"` (_`list`_ of _`str`_) : A list of options to be selected.
85
+ - `"option_key"` (_`list`_ of _`str`_) : List of keys that correspond to each entry (for backend that requiere the user to choose an option by typing).
86
+ - `"option_values"` (_`list`_) : Values associated to each option.
87
+ - `"allow_different_key"` : If options are to be selected, wether to allow a key not in the list or not. Requires `default_state` to be set if `"next_state"` is a `list`.
88
+ - `key_not_in_list_message` (_`str`_) : What message to send to the user if the key is not in the list and `"allow_different_key"` is set to false.
89
+ - `"store_key"` (_`str`_) : Name of key where the input given by the user will be stored.
90
+ - `"next_state"` (_`str`_ or _`list`_ of _`str`_) : Either the state that will come next, or a list of states that correspond to each option if `"options"` are passed.
91
+ - `"default_state"` (_`str`_) : Next state if the option given is not in the list of `"options"`.
92
+ - `"default_value"` : Default value to be store if the option given is not in the list of `"options"`.
93
+ - `"end_state"` (_`bool`_) : If true this command will end the conversation.
94
+ - `"input_restriction"` (_`str`_) : Restrictions to the user input : `int` to force the user to input an integer, `number` to force the user to input a number (floating point or not, separeted by `.` or `,`), `max_length:N` to prevent having more than `N` character. Multiple restriction can apply, separated by semicolons, like `int;max_length:10` to allow only an int with maximum of 10 characters. If `"options"` are passed, the restrictions onlly apply if the key given is not in `"option_key"` and `"allow_different_key"` is true.
95
+ - `"restriction_message"` (_`str`_) : Message to be sent to the user if the input is restricted by `"input_restriction"`
96
+ - `"cooldown"` (_`int`_) : Cooldown before being able to talk again to the bot.
97
+
98
+ There are some special keys that can be stored :
99
+ - `"save"` (_`bool`_) : Wether the values gather by the dialogue with the user needs to be saved or not.
100
+ - `"share"` (_`bool`_) : If `"share"` is set to anything but true, the state will be saved but not broadcasted if a broadcaster is running.
101
+ - `"debug"` (_`bool`_) : If `"debug"` is set to true it won't be broadcasted, and although states marked with the `debug` flag are saved, they are deleted if and when the state file is archived.
102
+
103
+ All special keys (`"share"`, `"debug"`, `"cooldown"` and `"save"`) can be written without using the normal `"write_values"` option.
104
+
105
+ Every entry also have a field named `time` which denote the starting time of the dialogue as an iso timestamp. `time_str` is a string version of the `time` field according to the `time_format` parameter if present.
106
+
107
+ #### 2.a.1 - Multilanguage bot
108
+
109
+ You can get a multilanguage dialogue from merging dialogue defined in different languages using the `dialogue_utils.make_multilanguage_dialogue()` function :
110
+
111
+ ```python
112
+ dialogue = dialogue_utils.make_multilanguage_dialogue({
113
+ "message" : "Welcome, please choose language !\n\n ¡Bienvenido! Elige el idioma.",
114
+ "languages" : {
115
+ "Francais" : french_language_dialogue,
116
+ "Español" : spanish_language_dialogue
117
+ }
118
+ })
119
+ ```
120
+
121
+ You simply need to pass to the function a `dict` containing a starting message before language choice, and a dict of languages names associated with their dialogue dict as described in the previous section.
122
+
123
+ Any other key will be added to the newely generated `"start"` state, thus for example if you want your languages to be choses using short keys you can use :
124
+
125
+ ```python
126
+ dialogue = dialogue_utils.make_multilanguage_dialogue({
127
+ "message" : "Welcome, please choose language !\n\n ¡Bienvenido! Elige el idioma.",
128
+ "languages" : {
129
+ "[fr] Francais" : french_language_dialogue,
130
+ "[es] Español" : spanish_language_dialogue
131
+ },
132
+ "option_key" : ["fr", "es"]
133
+ })
134
+ ```
135
+
136
+ ### 2.b - _proposed_ list of particular key
137
+
138
+ Some keys have particular meaning :
139
+ - `send` : If it is present and equal to anything but `true` (or `1`), the answer won't be sent (_if the bot has a broadcast component_).
140
+ - `debug` : If it is present and equal to `true` or `1` the answer won't be archived when the list of answers are archived.
141
+
142
+ ### 2.c - _proposed_ definition of broadcast bot
143
+
144
+ A dialogue bot can be joined with a broadcast bot which will format the broadcast text for each answer. Here is the typical structure of a broadcast definition :
145
+
146
+ ```json
147
+ {
148
+ "filename" : "json_state_folder/terminal_broadcast_state.json",
149
+ "sleep_interval" : 1,
150
+ "template" : [
151
+ "Time of day {time_str},\n",
152
+ {
153
+ "template" : "username : {uname},\n",
154
+ "default_template" : "No username given,\n"
155
+ }, {
156
+ "template" : "user email : {email}",
157
+ "requiered_keys" : ["email"],
158
+ "default_template" : "no email provided."
159
+ }
160
+ ]
161
+ }
162
+ ```
163
+
164
+ Here is a list of keys to parameterize the broadcaster bot :
165
+ - `"filename"` (_`str`_) : Where the broadcaster saves the list of entries already seen.
166
+ - `"sleep_interval"` (_`float`_) : How often in seconds to check whether new entries were added (default is 1 second).
167
+ - `"template"` (_`str`_ or _`list`_ of _`dict`_ or _`str`_) : Template to create the message to broadcast, either a single `str` that gets formated using the keys stored by the bot, using the python function `template.format(entry)`, or a `list` of `dict` describing sections of the message as described bellow.
168
+
169
+ If the template field is made of a `list` of `dict`, each entry in the list are formated one after the other and appened to each other to generate the message, using the following field for each `dict` :
170
+ - `"template"` (_`str`_) : Template to create the message to broadcast using the python function `template.format(entry)`
171
+ - `"requiered_keys"` (_`list`_ of _`str`_) : List of keys that **all** need to be in the entry for the `"template_text"` to be formated and appened to the message.
172
+ - `"default_template"` (_`str`_) : Template to create the message to broadcast using the python function `default_template.format(entry)` if the keys listed in `"requiered_keys"` are not **all** present in the entry.
173
+
174
+ ### 2.d - _proposed_ parameters
175
+
176
+ ```json
177
+ {
178
+ "filename" : "json_state_folder/entry_list.json",
179
+ "cancel_tag" : "cancel",
180
+ "cancel_message" : "canceling the dialogue...",
181
+ "timezone" : "utc",
182
+ "time_format" : "%H:%M:%S %d/%m/%Y",
183
+ "archive_dirpath" : "json_state_folder/archive/",
184
+ "max_filesize_kb" : 0.5,
185
+ "max_file_length" : 5,
186
+ "max_archive_size_gb" : 0.00001
187
+ }
188
+ ```
189
+
190
+ The bot can further be parameterized :
191
+ - `"filename"` (_`str`_) : Path of where entries will be saved.
192
+ - `"cancel_tag"` (_`str`_ or _`list`_ of _`str`_) : Tag or list of tag that if written in the answer to a question (case insensitive) will cancel the dialogue without cooldown.
193
+ - `"cancel_message` (_`str`_) : Message that will be sent when canceling the dialogue.
194
+ - `"timezone"` (_`str`_) : Timezone string (passed to `pytz.timezone`) forwhich the `time` field will be measured, default is `utc`.
195
+ - `"time_format"` (_`str`_) : String that describe the format of the `time_str` field, according to the `strftime()` function of the `datetime` python package.
196
+ - `"archive_dirpath"` (_`str`_) : Path of archive foler.
197
+ - `"max_filesize_kb"` (_`float`_) : Maximum size of a file before being archived in `Kb`
198
+ - `"max_file_length"` (_`int`_) : Maximum number of entry in a file before being archived.
199
+ - `"max_archive_size_gb"` (_`float`_) : Maximum total archive folder size before the oldest archive file being deleted in `Gb`
200
+
201
+ ### 2.e - _proposed_ connection to platforms
202
+
203
+ For each backend (except the terminal backend which doesn't use account) you can log in to the account that will be used by the bot and/or the broadcaster using the function `backend.log_in_account(account_params)` with `account_params` being a `dict` with the following fields (depending on each platform) :
204
+
205
+ #### 2.e.1 - _proposed_ connection to telegram
206
+
207
+ ```python
208
+ from pymultibot import telegram
209
+
210
+ backend = telegram.telegram_backend(backend_parameters)
211
+
212
+ backend.login_account({
213
+ "telegram_chat_id" : "chat_id",
214
+ "telegram_bot_token" : "bot_token",
215
+ "force_option_key" : False
216
+ })
217
+ ```
218
+
219
+ To connect to telegram you need to pass the following arguments :
220
+ - `"telegram_chat_id"` ( _`str`_) : Id of the chat to which the broadcaster will broadcast.
221
+ - `"telegram_bot_token"` (_`str`_) : Bot token.
222
+ - `"force_option_key"` (_`bool`_, default is `false`) : Since telegram allows you to click on options, unless you set `"force_option_key"` to `true` the `"option_key"` parameter will be ignored so that the user can simply click rather than write an input by hand.
223
+
224
+ #### 2.e.2 - _proposed_ connection to signal
225
+
226
+ ```python
227
+ from pymultibot import signal
228
+
229
+ backend = signal.signal_backend(backend_parameters)
230
+
231
+ backend.login_account({
232
+ "todo" : "todo"
233
+ })
234
+ ```
235
+
236
+ To connect to signal you need to pass the following arguments :
237
+ - _Todo_
238
+
239
+ #### 2.e.2 - _proposed_ connection to whatsapp
240
+
241
+ ```python
242
+ from pymultibot import whatsapp
243
+
244
+ backend = whatsapp.whatsapp_backend(backend_parameters)
245
+
246
+ backend.login_account({
247
+ "todo" : "todo"
248
+ })
249
+ ```
250
+
251
+ To connect to whatsapp you need to pass the following arguments :
252
+ - _Todo_
@@ -0,0 +1,22 @@
1
+ [build-system]
2
+ requires = [ "setuptools>=41", "wheel", "setuptools-git-versioning>=2.0,<3", ]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [tool.setuptools-git-versioning]
6
+ enabled = true
7
+
8
+ [project]
9
+ version = "0.0.1"
10
+ name = "pymultibots"
11
+ dependencies = []
12
+ requires-python = ">= 3.8"
13
+ authors = [
14
+ {name = "Collective", email = "pymultibot@systemli.org"}
15
+ ]
16
+ description = "Librairy to implement chatbot and broadcast bot on multiple platform (telegram, signal an whatsapp) at the same time"
17
+ keywords = ["chatbot", "bot", "telegram", "signal", "whatsapp"]
18
+ readme = "Readme.md"
19
+ license = { text = "CC Attribution 4.0" }
20
+
21
+ [project.urls]
22
+ Repository = "https://gitlab.com/pymultibot/pymultibot"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
File without changes