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
d00fc2a3
Commit
d00fc2a3
authored
Sep 22, 2023
by
Oleksandr Barabash
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bot.handle_mars_report updated
parent
0c18917c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
11 deletions
+23
-11
messaging_extension_action_preview_bot.py
bots/messaging_extension_action_preview_bot.py
+23
-11
No files found.
bots/messaging_extension_action_preview_bot.py
View file @
d00fc2a3
...
@@ -3,6 +3,7 @@ import asyncio
...
@@ -3,6 +3,7 @@ import asyncio
import
logging
import
logging
import
sys
import
sys
import
time
import
time
import
traceback
import
uuid
import
uuid
from
asyncio
import
Future
from
asyncio
import
Future
from
typing
import
Optional
from
typing
import
Optional
...
@@ -113,23 +114,34 @@ class TeamsMessagingExtensionsActionPreviewBot(TeamsActivityHandler):
...
@@ -113,23 +114,34 @@ class TeamsMessagingExtensionsActionPreviewBot(TeamsActivityHandler):
# 2. Add permissions for the recipients
# 2. Add permissions for the recipients
# 3. Send info into the flow
# 3. Send info into the flow
logger
.
info
(
"handle_mars_report"
)
logger
.
info
(
"handle_mars_report"
)
# todo(s1z): Make this secure and not such ugly
stripped_channel_id
=
channel_id
.
split
(
";"
)[
0
]
reference
=
await
self
.
cosmos_client
.
get_conversation
(
reference
=
await
self
.
cosmos_client
.
get_conversation
(
channel_id
,
AppConfig
.
TENANT_ID
stripped_
channel_id
,
AppConfig
.
TENANT_ID
)
)
async
def
callback
(
turn_context
:
TurnContext
)
->
None
:
async
def
callback
(
turn_context
:
TurnContext
)
->
None
:
""" Turn Context callback. Kinda awful syntax, I know """
""" Turn Context callback. Kinda awful syntax, I know """
team_details
=
await
TeamsInfo
.
get_team_details
(
turn_context
)
# noinspection PyBroadException
group_id
=
team_details
.
aad_group_id
try
:
credential
=
ClientSecretCredential
(
AppConfig
.
TENANT_ID
,
team_details
=
await
TeamsInfo
.
get_team_details
(
turn_context
)
AppConfig
.
APP_ID
,
group_id
=
team_details
.
aad_group_id
AppConfig
.
APP_PASSWORD
)
credential
=
ClientSecretCredential
(
AppConfig
.
TENANT_ID
,
scopes
=
[
'https://graph.microsoft.com/.default'
]
AppConfig
.
APP_ID
,
client
=
GraphServiceClient
(
credentials
=
credential
,
scopes
=
scopes
)
AppConfig
.
APP_PASSWORD
)
scopes
=
[
'https://graph.microsoft.com/.default'
]
result
=
await
client
.
groups
.
by_group_id
(
group_id
)
.
members
.
get
()
client
=
GraphServiceClient
(
credentials
=
credential
,
# send mail notifications!
scopes
=
scopes
)
result
=
await
client
.
groups
.
by_group_id
(
group_id
)
.
members
.
get
()
except
Exception
:
result
=
traceback
.
format_exc
()
# send mail notifications!
await
turn_context
.
send_activity
(
await
turn_context
.
send_activity
(
f
"the team aad_object_id: {result}"
f
"the team aad_object_id: {result}"
)
)
...
...
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