async def on_conversation_update_activity(self, turn_context: TurnContext): if turn_context.activity.channel_id == Channels.ms_teams: channel_data = TeamsChannelData().deserialize( turn_context.activity.channel_data) if turn_context.activity.members_added: return await self.on_teams_members_added_dispatch( turn_context.activity.members_added, channel_data.team, turn_context) if turn_context.activity.members_removed: return await self.on_teams_members_removed_dispatch( turn_context.activity.members_removed, channel_data.team, turn_context, ) if channel_data: if channel_data.event_type == "channelCreated": return await self.on_teams_channel_created( ChannelInfo().deserialize(channel_data.channel), channel_data.team, turn_context, ) if channel_data.event_type == "channelDeleted": return await self.on_teams_channel_deleted( channel_data.channel, channel_data.team, turn_context) if channel_data.event_type == "channelRenamed": return await self.on_teams_channel_renamed( channel_data.channel, channel_data.team, turn_context) if channel_data.event_type == "teamRenamed": return await self.on_teams_team_renamed_activity( channel_data.team, turn_context) return await super().on_conversation_update_activity(turn_context)
async def on_conversation_update_activity(self, turn_context: TurnContext): """ Invoked when a conversation update activity is received from the channel. Conversation update activities are useful when it comes to responding to users being added to or removed from the channel. For example, a bot could respond to a user being added by greeting the user. :param turn_context: A context object for this turn. :returns: A task that represents the work queued to execute. .. remarks:: In a derived class, override this method to add logic that applies to all conversation update activities. """ if turn_context.activity.channel_id == Channels.ms_teams: channel_data = TeamsChannelData().deserialize( turn_context.activity.channel_data) if turn_context.activity.members_added: return await self.on_teams_members_added_dispatch( turn_context.activity.members_added, channel_data.team, turn_context) if turn_context.activity.members_removed: return await self.on_teams_members_removed_dispatch( turn_context.activity.members_removed, channel_data.team, turn_context, ) if channel_data: if channel_data.event_type == "channelCreated": return await self.on_teams_channel_created( ChannelInfo().deserialize(channel_data.channel), channel_data.team, turn_context, ) if channel_data.event_type == "channelDeleted": return await self.on_teams_channel_deleted( channel_data.channel, channel_data.team, turn_context) if channel_data.event_type == "channelRenamed": return await self.on_teams_channel_renamed( channel_data.channel, channel_data.team, turn_context) if channel_data.event_type == "teamArchived": return await self.on_teams_team_archived( channel_data.team, turn_context) if channel_data.event_type == "teamDeleted": return await self.on_teams_team_deleted( channel_data.team, turn_context) if channel_data.event_type == "teamHardDeleted": return await self.on_teams_team_hard_deleted( channel_data.team, turn_context) if channel_data.event_type == "channelRestored": return await self.on_teams_channel_restored( channel_data.channel, channel_data.team, turn_context) if channel_data.event_type == "teamRenamed": return await self.on_teams_team_renamed( channel_data.team, turn_context) if channel_data.event_type == "teamRestored": return await self.on_teams_team_restored( channel_data.team, turn_context) if channel_data.event_type == "teamUnarchived": return await self.on_teams_team_unarchived( channel_data.team, turn_context) return await super().on_conversation_update_activity(turn_context)