Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Alexander
/
alex-hunter-sales-dev
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 70a787de
authored
Oct 30, 2022
by
softwhiskey8
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
внедрение отправки сообщений в телеграм канал
1 parent
ad25e636
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
0 deletions
app/main.dsl
index.js
app/main.dsl
View file @
70a787d
...
...
@@ -18,6 +18,8 @@ context {
output accepted_code: boolean = false;
output phone_suffix: string = "";
output conversation_end: number = 0;
output channel_type: string = "";
output mail: string = "";
}
external function numbers_from_text(text: string): string;
...
...
@@ -36,6 +38,7 @@ external function hours_now(): number;
external function check_mobile_code(phone: string): boolean;
external function countWords(message: string): number;
external function sendTelegram(): string;
external function sendTelegramChannel(channel_type: string, mail: string): string;
start node root
{
...
...
@@ -130,6 +133,14 @@ node tg
positive: goto yes_tg on #messageHasSentiment("positive");
negative: goto no_whatsapp on #messageHasSentiment("negative");
}
onexit
{
positive: do
{
set $channel_type = "Telegram";
external sendTelegramChannel($channel_type, "");
}
}
}
node yes_tg
...
...
@@ -161,6 +172,14 @@ node watsup
positive: goto yes_whatsapp on #messageHasSentiment("positive");
negative: goto no_whatsapp on #messageHasSentiment("negative") || #messageHasIntent("no_whatsapp");
}
onexit
{
positive: do
{
set $channel_type = "WhatsApp";
external sendTelegramChannel($channel_type, "");
}
}
}
node mail
...
...
@@ -177,6 +196,19 @@ node mail
positive: goto yes_whatsapp on #messageHasSentiment("positive");
negative: goto no_whatsapp on #messageHasSentiment("negative") || #messageHasIntent("no_whatsapp");
}
onexit
{
positive: do
{
//здесь будет определение мыла через mail recognizer
//var mail = external getMailByVoice();
//а здесь отправка
//external sendMail($mail, $promocode);
var mail = "temp@mail.ru";
set $channel_type = "почту";
external sendTelegramChannel($channel_type, mail);
}
}
}
node dont_use
...
...
index.js
View file @
70a787d
...
...
@@ -145,6 +145,28 @@ async function main() {
cmd
+=
`
${
events_owner
}
${
preset_template_id
}
${
process
.
argv
[
2
]}
empty empty empty
${
tmp_json
}
`
;
exec
(
cmd
);
});
//функция отправки сообщений в канал
app
.
setExternal
(
"sendTelegramChannel"
,
(
args
)
=>
{
//var cmd = `cd E:/work/projects2/telegram-channel-sender/; dotnet telegram-channel-sender.dll 3 79112349232 ${args['channel_type']}`;
//let cmd = String.raw`cd E:/work/projects2/telegram-channel-sender/
//dotnet telegram-channel-sender.dll 3 79112349232 ${args['channel_type']}`;
var
cmd
=
`cd /servers/constructor/htdocs/api/ && php telegram-channel-sender.dll 3
${
process
.
argv
[
2
]}
${
args
[
'channel_type'
]}
`
;
exec
(
cmd
,
(
error
,
stdout
,
stderr
)
=>
{
if
(
error
)
{
console
.
error
(
`error:
${
error
.
message
}
`
);
return
;
}
if
(
stderr
)
{
console
.
error
(
`stderr:
${
stderr
}
`
);
return
;
}
console
.
log
(
`stdout:\n
${
stdout
}
`
);
});
});
await
app
.
start
();
let
abonent_phone
=
process
.
argv
[
2
]
??
""
;
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment