Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cake-bot
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Oleksandr Barabash
cake-bot
Commits
405c9b69
Commit
405c9b69
authored
Feb 14, 2023
by
Oleksandr Barabash
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bot mention removed
parent
ca440e27
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
11 deletions
+14
-11
messaging_extension_action_preview_bot.py
bots/messaging_extension_action_preview_bot.py
+14
-11
No files found.
bots/messaging_extension_action_preview_bot.py
View file @
405c9b69
...
...
@@ -376,12 +376,14 @@ class TeamsMessagingExtensionsActionPreviewBot(TeamsActivityHandler):
await
turn_context
.
send_activity
(
i18n
.
t
(
"tenant_forbidden"
))
return
message
=
turn_context
.
activity
.
text
.
strip
()
.
lower
()
message
=
turn_context
.
remove_recipient_mention
(
turn_context
.
activity
)
\
.
strip
()
message_lower
=
message
.
strip
()
.
lower
()
cmd_help
=
i18n
.
t
(
"cmd_help"
)
cmd_portal
=
i18n
.
t
(
"cmd_portal"
)
if
message
==
cmd_help
.
lower
():
if
message
_lower
==
cmd_help
.
lower
():
tenant_id
=
turn_context
.
activity
.
conversation
.
tenant_id
conversation_id
=
turn_context
.
activity
.
conversation
.
id
response
=
await
turn_context
.
send_activity
(
...
...
@@ -394,18 +396,18 @@ class TeamsMessagingExtensionsActionPreviewBot(TeamsActivityHandler):
Log
.
d
(
TAG
,
"on_message_activity::help_resp: {}"
.
format
(
response
))
return
if
message
==
cmd_portal
.
lower
():
if
message
_lower
==
cmd_portal
.
lower
():
card
=
CardHelper
.
load_assets_card
(
"default_card"
)
attachments
=
[
CardFactory
.
adaptive_card
(
card
)]
message
=
Activity
(
type
=
ActivityTypes
.
message
,
attachments
=
attachments
)
await
turn_context
.
send_activity
(
message
)
await
turn_context
.
send_activity
(
Activity
(
type
=
ActivityTypes
.
message
,
attachments
=
attachments
)
)
return
# TODO(s1z): Remove me when it's prod
if
message
.
find
(
"flow"
)
==
0
:
if
message
_lower
.
find
(
"flow"
)
==
0
:
# Strip data again cause 'message' data is lower case
params
=
turn_context
.
activity
.
text
.
strip
()
.
split
(
' '
)
params
=
message
.
split
(
' '
)
if
len
(
params
)
!=
3
:
response
=
await
turn_context
.
send_activity
(
"Incorrect syntax. Please the syntax below:<br/>"
...
...
@@ -420,7 +422,7 @@ class TeamsMessagingExtensionsActionPreviewBot(TeamsActivityHandler):
_
,
cmd
,
url
=
params
# noinspection PyBroadException
try
:
_
=
await
self
.
cosmos_client
.
create_flow
(
cmd
,
url
)
_
=
await
self
.
cosmos_client
.
create_flow
(
cmd
.
lower
()
,
url
)
await
turn_context
.
send_activity
(
"Flow cmd saved"
)
return
except
Exception
:
...
...
@@ -432,8 +434,9 @@ class TeamsMessagingExtensionsActionPreviewBot(TeamsActivityHandler):
# try get flow link
async
def
request
():
""" request """
# noinspection PyBroadException
try
:
flow
=
await
self
.
cosmos_client
.
get_flow
(
message
)
flow
=
await
self
.
cosmos_client
.
get_flow
(
message
_lower
)
Log
.
e
(
TAG
,
f
"on_message_activity::flow.url:{flow.url}"
)
async
with
aiohttp
.
ClientSession
()
as
session
:
# TODO(s1z): string bot's @mention if needed.
...
...
@@ -446,7 +449,7 @@ class TeamsMessagingExtensionsActionPreviewBot(TeamsActivityHandler):
f
"response.text: {rest_text}"
)
return
True
except
Exception
:
Log
.
e
(
TAG
,
f
"on_message_activity::get_flow:error"
,
sys
.
exc_info
())
log
.
error
(
"Flow exec error"
,
exc_info
=
sys
.
exc_info
())
return
False
response
=
await
request
()
if
response
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment