server.post(routePath, (req, res) => { this.adapter.processActivity(req, res, async (context) => { if (context.activity.type === ActivityTypes.Message) { try { const input = { message: context.activity.text, channel: `msbf-${context.activity.channelId}`, app: this.container.name, msbfContext: context,
async handleTeamsMessagingExtensionSelectItem(context, obj) { const { title, text, images } = obj return { composeExtension: { type: 'result', attachmentLayout: 'list', attachments: [CardFactory.thumbnailCard(title, text, images)] } }; }
constructor() { super(); this.onMessage(async (context, next) => { TurnContext.removeRecipientMention(context.activity); const text = context.activity.text.trim().toLocaleLowerCase(); await context.sendActivity('You said ' + text); }); }
async interrupt(innerDc) { if (innerDc.context.activity.type === ActivityTypes.Message) { const text = innerDc.context.activity.text.toLowerCase(); if (text === 'logout') { // The bot adapter encapsulates the authentication processes. const botAdapter = innerDc.context.adapter; await botAdapter.signOutUser(innerDc.context, this.connectionName); await innerDc.context.sendActivity('You have been signed out.'); return await innerDc.cancelAllDialogs(); } } }
/** * * @param {ConversationState} conversationState * @param {UserState} userState * @param {Dialog} dialog */ constructor(conversationState, userState, dialog) { super(conversationState, userState, dialog); this.onMembersAdded(async (context, next) => { const membersAdded = context.activity.membersAdded; for (let cnt = 0; cnt < membersAdded.length; cnt++) { if (membersAdded[cnt].id !== context.activity.recipient.id) { await context.sendActivity('Welcome to TeamsBot. Type anything to get logged in. Type \'logout\' to sign-out.'); } } await next(); }); }
let text = faker.lorem.paragraph(); let images = [`${randomImageUrl}?random=${i}`] let thumbnailCard = CardFactory.thumbnailCard(title, text, images) let preview = CardFactory.thumbnailCard(title, text, images) preview.content.tap = { type: 'invoke', value: { title, text, images } }; var attachment = { ...thumbnailCard, preview } attachments.push(attachment);
if (turnContext.activity.type === ActivityTypes.Message) { turnContext.activity.type === ActivityTypes.ConversationUpdate ) {