禁用用户键入文本框 c#
Disable user typing text box c#
是否可以在任何频道中禁用 V4 bot 框架中的用户输入文本区域?我有这个作为客户要求的一部分有人可以帮助我吗
您所指的邮箱称为发件箱。如果您使用 BotFramework-Web Chat,您可以通过 styleOptions
传递值来禁用它,如下所示:
<script>
(async function () {
const styleOptions = {
hideSendBox = true
}
[...]
window.ReactDOM.render(
<ReactWebChat
directLine={directLine},
styleOptions={styleOptions}
/>,
document.getElementById( 'webchat' )
);
})
</script>
如果您使用的是 iFrame 嵌入版本的网络聊天,则不可配置。
希望得到帮助!
编辑
如果您希望发送框根据从机器人接收到的 activity 类型进行响应,那么您将需要结合使用 activityMiddleware()
函数和事件 emitter/listener。在下面的示例中,当 suggestedActions
是 activity 属性.
时,我是 hiding/showing 发送框
请注意,数据值应为“none”和“flex”。特别是后面的值不是suggestedActions
时为了保持当前的代码。
<script>
(async function () {
[...]
const activityMiddleware = () => next => card => {
const { activity: { suggestedActions } } = card;
const toggleSendBoxEvent = new Event('ToggleSendBoxEvent')
if (suggestedActions) {
toggleSendBoxEvent.data = "none";
window.dispatchEvent(toggleSendBoxEvent);
} else {
toggleSendBoxEvent.data = "flex";
window.dispatchEvent(toggleSendBoxEvent);
}
return next(card);
)
[...]
window.ReactDOM.render(
<ReactWebChat
directLine={ window.WebChat.createDirectLine({ token }) }
activityMiddleware={ activityMiddleware }
/>,
document.getElementById( 'webchat' )
);
window.addEventListener('ToggleSendBoxEvent', ( { data } ) => {
const sendBoxes = document.getElementsByClassName("main");
let send_Box;
for (let sendBox of sendBoxes) {
send_Box = sendBox;
}
send_Box.setAttribute('style', `display:${ data }`)
})
});
</script>
希望得到帮助!
是否可以在任何频道中禁用 V4 bot 框架中的用户输入文本区域?我有这个作为客户要求的一部分有人可以帮助我吗
您所指的邮箱称为发件箱。如果您使用 BotFramework-Web Chat,您可以通过 styleOptions
传递值来禁用它,如下所示:
<script>
(async function () {
const styleOptions = {
hideSendBox = true
}
[...]
window.ReactDOM.render(
<ReactWebChat
directLine={directLine},
styleOptions={styleOptions}
/>,
document.getElementById( 'webchat' )
);
})
</script>
如果您使用的是 iFrame 嵌入版本的网络聊天,则不可配置。
希望得到帮助!
编辑
如果您希望发送框根据从机器人接收到的 activity 类型进行响应,那么您将需要结合使用 activityMiddleware()
函数和事件 emitter/listener。在下面的示例中,当 suggestedActions
是 activity 属性.
请注意,数据值应为“none”和“flex”。特别是后面的值不是suggestedActions
时为了保持当前的代码。
<script>
(async function () {
[...]
const activityMiddleware = () => next => card => {
const { activity: { suggestedActions } } = card;
const toggleSendBoxEvent = new Event('ToggleSendBoxEvent')
if (suggestedActions) {
toggleSendBoxEvent.data = "none";
window.dispatchEvent(toggleSendBoxEvent);
} else {
toggleSendBoxEvent.data = "flex";
window.dispatchEvent(toggleSendBoxEvent);
}
return next(card);
)
[...]
window.ReactDOM.render(
<ReactWebChat
directLine={ window.WebChat.createDirectLine({ token }) }
activityMiddleware={ activityMiddleware }
/>,
document.getElementById( 'webchat' )
);
window.addEventListener('ToggleSendBoxEvent', ( { data } ) => {
const sendBoxes = document.getElementsByClassName("main");
let send_Box;
for (let sendBox of sendBoxes) {
send_Box = sendBox;
}
send_Box.setAttribute('style', `display:${ data }`)
})
});
</script>
希望得到帮助!