Commit 576ad270 by Oleksandr Barabash

member removed fixed

parent 551c8d29
...@@ -5,16 +5,14 @@ import sys ...@@ -5,16 +5,14 @@ import sys
import time import time
import uuid import uuid
from asyncio import Future from asyncio import Future
from datetime import datetime from typing import Optional
from typing import Optional, Dict, Union, List from urllib.parse import urlparse, parse_qsl, urlencode
from urllib.parse import urlparse, parse_qsl, urlencode, unquote
import aiohttp import aiohttp
from aiohttp.web_app import Application from aiohttp.web_app import Application
from botbuilder.core import (TurnContext, CardFactory, BotFrameworkAdapter, from botbuilder.core import (TurnContext, CardFactory, BotFrameworkAdapter,
BotFrameworkAdapterSettings, MessageFactory) BotFrameworkAdapterSettings)
from botbuilder.schema import Activity, ActivityTypes, ResourceResponse, \ from botbuilder.schema import Activity, ActivityTypes, ResourceResponse
AttachmentLayoutTypes
from botbuilder.schema.teams import (TaskModuleContinueResponse, from botbuilder.schema.teams import (TaskModuleContinueResponse,
TaskModuleTaskInfo, TaskModuleResponse, TaskModuleTaskInfo, TaskModuleResponse,
TaskModuleRequest) TaskModuleRequest)
...@@ -235,26 +233,30 @@ class TeamsMessagingExtensionsActionPreviewBot(TeamsActivityHandler): ...@@ -235,26 +233,30 @@ class TeamsMessagingExtensionsActionPreviewBot(TeamsActivityHandler):
i18n = get_i18n(turn_context) i18n = get_i18n(turn_context)
await self.cosmos_client.create_conversation_reference(turn_context) await self.cosmos_client.create_conversation_reference(turn_context)
if turn_context.activity.channel_id == Channels.ms_teams: if turn_context.activity.channel_id == Channels.ms_teams:
members = [] if turn_context.activity.members_removed:
for member in turn_context.activity.members_added: # members were removed!
if member.id != turn_context.activity.recipient.id: pass
members.append(member) if turn_context.activity.members_added:
if len(members) == 1 and turn_context.activity.members_added: members = []
member = members[0] for member in turn_context.activity.members_added:
name = member.name or '' if member.id != turn_context.activity.recipient.id:
bot_name = AppConfig.BOT_NAME members.append(member)
cmd_help = i18n.t("cmd_help") if len(members) == 1 and turn_context.activity.members_added:
greetings = i18n.t("hi_message", name=name, bot_name=bot_name, member = members[0]
cmd_help=cmd_help) name = member.name or member.id
await turn_context.send_activity(greetings) bot_name = AppConfig.BOT_NAME
return cmd_help = i18n.t("cmd_help")
if len(members) > 1 and turn_context.activity.members_added: greetings = i18n.t("hi_message", name=name,
bot_name = AppConfig.BOT_NAME bot_name=bot_name, cmd_help=cmd_help)
cmd_help = i18n.t("cmd_help") await turn_context.send_activity(greetings)
greetings = i18n.t("greetings_message", bot_name=bot_name, return
cmd_help=cmd_help) if len(members) > 1 and turn_context.activity.members_added:
await turn_context.send_activity(greetings) bot_name = AppConfig.BOT_NAME
return 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: async def handle_submit_action(self, turn_context: TurnContext) -> None:
""" Handle card submit action """ """ Handle card submit action """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment