Akulij
adad94ad43
update mainbot.js logic
2025-05-31 13:47:46 +05:00
Akulij
714853730a
create /cancel command for users
2025-05-31 13:47:14 +05:00
Akulij
b980a653cb
attach user_application to runner
2025-05-31 13:46:54 +05:00
Akulij
b8d07d0ad5
create MessageForward.store_db to store by DB type
...
reason: easier to use with RwLock
2025-05-31 13:45:45 +05:00
Akulij
2e447e87fd
create Application.store_db to store by DB type
2025-05-31 13:45:02 +05:00
Akulij
d749b57811
call js function handler if set in script_handler
2025-05-31 13:43:41 +05:00
Akulij
a106891050
create call_attacher for Runner to attach global objects on initialization
2025-05-31 13:42:54 +05:00
Akulij
9cd0765030
create BotMessage js function handler getter
2025-05-31 13:42:10 +05:00
Akulij
bc46e0fda4
create BotFunction context getter
2025-05-31 13:41:42 +05:00
Akulij
845071c800
create botscript application module for js's runtime user_application function
2025-05-31 13:39:17 +05:00
Akulij
c936ea38a9
update mainbot.js
2025-05-31 11:04:35 +05:00
Akulij
bee93b32d1
use BotController
2025-05-31 10:48:52 +05:00
Akulij
0265942449
enable Send for BotController
2025-05-31 10:48:15 +05:00
Akulij
e993a6c941
derive Clone on Config
2025-05-31 10:47:49 +05:00
Akulij
6dfe9b839d
fix logic: move bot insertion to db to /deploy command, instead of function in bot_manager
2025-05-31 10:45:34 +05:00
Akulij
f27fb670bd
create BotManager
2025-05-31 10:43:05 +05:00
Akulij
22025cde11
handle callbacks in script_handler
2025-05-31 10:35:52 +05:00
Akulij
3bd16a58cd
add replace flag to BotMessage
2025-05-31 10:34:29 +05:00
Akulij
474795bd99
create RunnerConfig.get_callback_message
2025-05-31 10:34:06 +05:00
Akulij
fdf1e352a6
add buttons field to BotDialog
2025-05-31 10:33:26 +05:00
Akulij
39e376195c
create BotInstance::update_script
2025-05-31 10:31:09 +05:00
Akulij
308b15ed69
create BotInstance::restart_one and restart_all
2025-05-31 10:30:39 +05:00
Akulij
102fae25c7
create BotInstance::get_by_name
2025-05-31 10:30:03 +05:00
Akulij
bc2397a32c
derive Clone for BotInstance
2025-05-31 10:29:03 +05:00
Akulij
fde7087172
create /newscript command handler
2025-05-31 10:28:22 +05:00
Akulij
67ad3c2acd
plug provided handlers in start_bot
2025-05-28 11:11:25 +05:00
Akulij
866a028de1
move out bot handlers to separate module
2025-05-28 11:10:32 +05:00
Akulij
e63187dcd3
rename botscript_command_handler to more correct handle_botmessage
2025-05-28 10:15:30 +05:00
Akulij
098cff72bd
delete inspector in botscript handler
2025-05-28 10:14:14 +05:00
Akulij
d428c8798d
make script_handler return a public type
2025-05-27 15:35:40 +05:00
Akulij
6eb6f2f454
fix: start bot with it's db name
2025-05-27 15:34:50 +05:00
Akulij
2fdd8a346d
fix: instead of actually starting bot on /deploy, just put info in DB
...
reason: it's not a responsibility of /deploy command to store bot info
AND starting bot thread, isntead it is responsible only for storing info
in DB, as every other command does, and then bot will lazily start by
bot manager
2025-05-27 15:12:14 +05:00
Akulij
d10acc992a
start bot instances in main
2025-05-27 14:21:36 +05:00
Akulij
8e3c647727
fix: handle io and RwLock error for bot manager
2025-05-27 14:20:02 +05:00
Akulij
8fed0daf4c
extend BotController creation implementation
2025-05-27 14:17:29 +05:00
Akulij
e1b6b5aa10
derive Clone for BotController
2025-05-27 14:14:23 +05:00
Akulij
4a35243a4c
store RunnerConfig in BotController as atomic rw lock for thread safety
2025-05-27 14:13:28 +05:00
Akulij
1757571f35
create bot_name field in Config
2025-05-27 14:11:33 +05:00
Akulij
77ba6dcfc5
define const MAIN_BOT_SCRIPT
2025-05-27 14:10:48 +05:00
Akulij
6ac3665dee
fix: add bot_handler to compile tree
2025-05-27 04:17:26 +05:00
Akulij
ef5d74cf1c
create bot_manager module to handle background bot start
2025-05-27 04:17:05 +05:00
Akulij
593316d541
cargo add lazy_static
2025-05-27 04:15:39 +05:00
Akulij
a136558681
create MongodbStorage::from_db initializer
2025-05-27 04:09:47 +05:00
Akulij
9e99064bc5
create DB.with_name method
2025-05-27 04:09:05 +05:00
Akulij
3acd168155
make Runner thread safe
2025-05-27 04:08:27 +05:00
Akulij
4be9c034c9
use variable db name instead of hardcoded one
2025-05-26 20:50:25 +05:00
Akulij
9bbf481002
derive Clone on bot and runner config
2025-05-26 20:48:11 +05:00
Akulij
4384431696
create RunnerConfig::init_with_db
2025-05-26 20:47:35 +05:00
Akulij
13a861e74b
cargo add serde_json
2025-05-26 20:45:59 +05:00
Akulij
ff7f317ae5
create attach_db_obj for botscript
2025-05-26 20:44:34 +05:00
Akulij
aac968e408
add RawCallError to ScriptError
2025-05-26 20:43:04 +05:00
Akulij
cb7c888028
create RawCall trait, that will contain DB methods to call from script runtime
2025-05-26 20:22:46 +05:00
Akulij
a33d4b393c
impl GetCollection for CallDB
2025-05-26 20:16:12 +05:00
Akulij
9c15b0a375
create DbCollection and GetCollection traits
2025-05-26 20:15:27 +05:00
Akulij
4c149b6922
create BotInstance collection
2025-05-26 20:12:46 +05:00
Akulij
a7433cd8cc
create /deploy admin command
2025-05-26 20:10:12 +05:00
Akulij
bdb30c8d98
create default script for new bots
2025-05-26 20:08:55 +05:00
Akulij
d1c1b7500d
create script_handler function that creates teloxide's handler for botscript dispatch
2025-05-26 20:06:07 +05:00
Akulij
d5dbaa0b75
refactor message answer and replace
2025-05-25 09:40:41 +05:00
Akulij
4548419946
implement botscript_command_handler
2025-05-23 16:36:34 +05:00
Akulij
e8dbf3db76
access RunnerConfig instead of manually using commands hash map
2025-05-23 16:29:54 +05:00
Akulij
1ff86f641f
impl RunnerConfig::get_command_message
2025-05-23 16:27:06 +05:00
Akulij
31e78be68f
change interface for ResolveValue
2025-05-23 16:26:35 +05:00
Akulij
217a074c95
create ResolveError
2025-05-23 16:24:17 +05:00
Akulij
1c17639c0e
handle DbError in ScriptError
2025-05-23 16:23:54 +05:00
Akulij
9e35f4168e
use DB and join_all
2025-05-23 16:23:12 +05:00
Akulij
178f2a2399
create ButtonRaw name, callback_name and literal getters
2025-05-23 16:21:26 +05:00
Akulij
1730107e9a
create BotMessage.literal getter
2025-05-23 16:20:21 +05:00
Akulij
506fdcb260
create BotMessage.resolve_buttons
2025-05-23 16:19:37 +05:00
Akulij
6d5f748ab8
create ButtonLayout::resolve_raw
2025-05-23 16:15:44 +05:00
Akulij
cbb9c0c335
botscript: create ButtonLayout enum
2025-05-23 16:13:56 +05:00
Akulij
f8c63e5315
create BotMessage.fill_literal method
2025-05-23 16:04:03 +05:00
Akulij
66180e0cfb
add optional literal string in BotMessage
2025-05-23 16:03:12 +05:00
Akulij
1117af0724
impl ButtonName.resolve_name
2025-05-23 15:49:30 +05:00
Akulij
99758500b3
fix mainbot.js: start_buttons: return actual buttons
2025-05-23 15:29:22 +05:00
Akulij
d174ee7bc7
fix: handle Runner in BotController
...
reason: earlier, Runner and js runtime in it were freed after init of
BotController, which potentially was able to lead into hanging function
in config without runtime, BUT, there is check in in JS_FreeRuntime to
have zero objects, so bug found without hesitation ;)
2025-05-21 14:07:02 +05:00
Akulij
ca2e661a0e
fix: in Runner's init_config use deserialize_js instead of js_into
2025-05-21 14:06:09 +05:00
Akulij
c33c67044a
delete test test_deserialization_main, since it isnot actual anymore
2025-05-21 13:04:08 +05:00
Akulij
d1b6d153d4
create call and call_args methods for BotFunction
2025-05-21 12:53:26 +05:00
Akulij
0dc71fda08
fix BotFunction's call_context method
...
previously called by stored template string instead of actual function
2025-05-21 12:46:46 +05:00
Akulij
970ce07280
fix name of stateful_msg_handlers in Parcelable field getter
2025-05-21 12:41:04 +05:00
Akulij
940a832561
mainbot.js: use function in handler instead of string function name
2025-05-21 12:33:03 +05:00
Akulij
a15cdeadf9
mainbot.js: create example function enter_name
2025-05-21 12:32:45 +05:00
Akulij
f5a894fe37
mainbot.js: change comment style for handler example
2025-05-21 12:31:43 +05:00
Akulij
a4e8ea0390
mainbot.js: use function in buttons field instead of function name
2025-05-21 12:29:47 +05:00
Akulij
6fa398401d
restore functions in deserialize_js
2025-05-21 12:28:24 +05:00
Akulij
6ea26c0618
change injectable template in DeserializeJS to correct one
2025-05-21 12:27:27 +05:00
Akulij
b76392d597
impl Parcelable for all RunnerConfig types
2025-05-21 12:26:09 +05:00
Akulij
ad58587160
fix test: use BotFunction's method by_name
2025-05-21 12:24:16 +05:00
Akulij
1aed17fa30
specify ResolveValue in recursive resolve call
2025-05-21 12:23:32 +05:00
Akulij
684895a554
change BotFunction implementation to be compatible with js function
...
injection
2025-05-21 12:19:39 +05:00
Akulij
d5f39e4e60
create Parcelable trait with default implementations
2025-05-21 12:16:34 +05:00
Akulij
2a4ed51824
limit CD workflow to triger only on main branch push
2025-05-20 08:52:53 +05:00
Akulij
d1b25b52c1
fix: use KeyboardDefinition in BotMessage
2025-05-20 08:49:52 +05:00
Akulij
2c5802eaeb
delete unnecessary literal field in ButtonRaw
2025-05-20 08:49:23 +05:00
Akulij
bd800e88eb
create predefined buttons layout example in mainbot.js
2025-05-20 08:48:34 +05:00
Akulij
a2e1354bee
fix missing #[serde(untagged)] on keyboard layout structs
2025-05-20 08:47:23 +05:00
Akulij
55d53bd140
create keyboard struct definition with resolvement trait
2025-05-20 08:32:28 +05:00
Akulij
ea007127ff
test for DeserializerJS::deserialize_js
2025-05-20 08:32:09 +05:00
Akulij
0a60b0469f
create DeserializerJS::inject_templates
2025-05-20 08:29:40 +05:00
Akulij
40eec7d38d
fix js_into: self is already a reference
2025-05-20 04:36:19 +05:00
Akulij
2ccfc19a6c
create filter to handle botscript-defined commands
2025-05-20 02:47:00 +05:00
Akulij
e0c00d68f9
derive Clone on BotCommand
...
reason: everything passed in teloxide's filter_map asks Clone (or Copy) implementation
2025-05-20 01:16:52 +05:00
Akulij
0e10cdbdf0
create command module
...
defines BotCommand struct
2025-05-20 01:07:11 +05:00
Akulij
29cd73e98f
create basic handler to answer BotMessage
2025-05-20 00:44:08 +05:00
Akulij
3d9a1c31b4
use RunnerConfig in BotController
2025-05-20 00:42:32 +05:00
Akulij
5c8cadf7a0
create test for deserealization of result of js function
2025-05-20 00:40:25 +05:00
Akulij
534a0e6090
create init_config method for Runner
2025-05-20 00:39:39 +05:00
Akulij
135139514b
update btoscript struct definitions
2025-05-20 00:39:15 +05:00
Akulij
f6b18af5dd
derive clone on BoMessage
2025-05-20 00:38:29 +05:00
Akulij
22ab941ed8
create buttons definition example in mainbot.js
2025-05-20 00:33:51 +05:00
Akulij
cddf5986ba
use from_js
2025-05-19 23:58:53 +05:00
Akulij
3f8f25fff9
create SerdeError for ScriptError
...
reason: to handle errors from call of from_js
2025-05-19 23:57:22 +05:00
Akulij
eb63743714
create js_into for JsValue
...
reason: wil be way less boilerplate for deserialization of JsValue to defined structs
2025-05-19 23:55:44 +05:00
Akulij
c2e02efc47
create call_context method for BotFunction
2025-05-19 23:54:39 +05:00
Akulij
c8c67b54e3
make botFunction a struct
2025-05-19 23:54:08 +05:00
Akulij
7dbad400cc
mainbot.js: fix missing comma
2025-05-18 22:19:27 +03:00
Akulij
3d6bf15806
add somecomplicatedcmd as an example in mainbot.js
2025-05-18 22:19:09 +03:00
Akulij
6299f6d815
add comment about default value of buttons in mainbot.js
2025-05-18 22:18:37 +03:00
Akulij
8e9d5b4f1d
add stateful_msg_handlers example to mainbot.js
2025-05-18 16:30:46 +03:00
Akulij
05b298e61c
add more command example to mainbot.js
2025-05-18 16:30:25 +03:00
Akulij
48cbd4c7d0
fix missing commas in mainbot.js
2025-05-18 16:15:29 +03:00
Akulij
a643a707ed
new specification of bot commands definition
2025-05-18 16:13:17 +03:00
Akulij
e7d43adc40
create structs for bot's configuration definition
2025-05-18 16:10:03 +03:00
Akulij
a6206d3d6f
use quickjs_rusty's from_js in tests
2025-05-18 16:09:34 +03:00
Akulij
96996fd33d
update mainbot.js with new specification
2025-05-18 16:08:34 +03:00
Akulij
bf032e6ce4
create test for deserealization of mainbot.js
2025-05-18 16:07:40 +03:00
Akulij
9d5bf86289
create recursive_format function just for tests
2025-05-18 16:05:10 +03:00
Akulij
0c927448d2
create mainbot.js where main bot's logic will be contained
2025-05-10 03:28:00 +03:00
Akulij
08c1b67f02
create botscript runner
2025-05-10 03:27:35 +03:00
Akulij
d39d2c8144
cargo add quickjs-rusty
2025-05-10 03:25:53 +03:00