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
576ad270
Commit
576ad270
authored
Feb 20, 2023
by
Oleksandr Barabash
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
member removed fixed
parent
551c8d29
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
26 deletions
+28
-26
messaging_extension_action_preview_bot.py
bots/messaging_extension_action_preview_bot.py
+28
-26
No files found.
bots/messaging_extension_action_preview_bot.py
View file @
576ad270
...
...
@@ -5,16 +5,14 @@ import sys
import
time
import
uuid
from
asyncio
import
Future
from
datetime
import
datetime
from
typing
import
Optional
,
Dict
,
Union
,
List
from
urllib.parse
import
urlparse
,
parse_qsl
,
urlencode
,
unquote
from
typing
import
Optional
from
urllib.parse
import
urlparse
,
parse_qsl
,
urlencode
import
aiohttp
from
aiohttp.web_app
import
Application
from
botbuilder.core
import
(
TurnContext
,
CardFactory
,
BotFrameworkAdapter
,
BotFrameworkAdapterSettings
,
MessageFactory
)
from
botbuilder.schema
import
Activity
,
ActivityTypes
,
ResourceResponse
,
\
AttachmentLayoutTypes
BotFrameworkAdapterSettings
)
from
botbuilder.schema
import
Activity
,
ActivityTypes
,
ResourceResponse
from
botbuilder.schema.teams
import
(
TaskModuleContinueResponse
,
TaskModuleTaskInfo
,
TaskModuleResponse
,
TaskModuleRequest
)
...
...
@@ -235,26 +233,30 @@ class TeamsMessagingExtensionsActionPreviewBot(TeamsActivityHandler):
i18n
=
get_i18n
(
turn_context
)
await
self
.
cosmos_client
.
create_conversation_reference
(
turn_context
)
if
turn_context
.
activity
.
channel_id
==
Channels
.
ms_teams
:
members
=
[]
for
member
in
turn_context
.
activity
.
members_added
:
if
member
.
id
!=
turn_context
.
activity
.
recipient
.
id
:
members
.
append
(
member
)
if
len
(
members
)
==
1
and
turn_context
.
activity
.
members_added
:
member
=
members
[
0
]
name
=
member
.
name
or
''
bot_name
=
AppConfig
.
BOT_NAME
cmd_help
=
i18n
.
t
(
"cmd_help"
)
greetings
=
i18n
.
t
(
"hi_message"
,
name
=
name
,
bot_name
=
bot_name
,
cmd_help
=
cmd_help
)
await
turn_context
.
send_activity
(
greetings
)
return
if
len
(
members
)
>
1
and
turn_context
.
activity
.
members_added
:
bot_name
=
AppConfig
.
BOT_NAME
cmd_help
=
i18n
.
t
(
"cmd_help"
)
greetings
=
i18n
.
t
(
"greetings_message"
,
bot_name
=
bot_name
,
cmd_help
=
cmd_help
)
await
turn_context
.
send_activity
(
greetings
)
return
if
turn_context
.
activity
.
members_removed
:
# members were removed!
pass
if
turn_context
.
activity
.
members_added
:
members
=
[]
for
member
in
turn_context
.
activity
.
members_added
:
if
member
.
id
!=
turn_context
.
activity
.
recipient
.
id
:
members
.
append
(
member
)
if
len
(
members
)
==
1
and
turn_context
.
activity
.
members_added
:
member
=
members
[
0
]
name
=
member
.
name
or
member
.
id
bot_name
=
AppConfig
.
BOT_NAME
cmd_help
=
i18n
.
t
(
"cmd_help"
)
greetings
=
i18n
.
t
(
"hi_message"
,
name
=
name
,
bot_name
=
bot_name
,
cmd_help
=
cmd_help
)
await
turn_context
.
send_activity
(
greetings
)
return
if
len
(
members
)
>
1
and
turn_context
.
activity
.
members_added
:
bot_name
=
AppConfig
.
BOT_NAME
cmd_help
=
i18n
.
t
(
"cmd_help"
)
greetings
=
i18n
.
t
(
"greetings_message"
,
bot_name
=
bot_name
,
cmd_help
=
cmd_help
)
await
turn_context
.
send_activity
(
greetings
)
return
async
def
handle_submit_action
(
self
,
turn_context
:
TurnContext
)
->
None
:
""" Handle card submit action """
...
...
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