简体   繁体   English

我的使用Slack的BotFramework机器人如何忽略除直接渠道以外的所有渠道上的消息?

[英]How can my Slack-using BotFramework bot ignore messages on all channels except direct?

I know this seems like it's been asked before - but I understand that you can figure out that someone's talking on a Slack channel by inspecting activity.Conversation.IsGroup - I'm using this successfully. 我知道这似乎是以前被问过的-但我知道您可以通过检查activity.Conversation.IsGroup来确定有人在Slack频道上聊天-我正在成功使用它。

This is fine as long as the channel has more than two members! 只要该频道有两个以上的会员,就可以了! But there's an annoying edge case where newly-created channels, say, or channels just containing two members, have to experience the bot trying to respond to all messages there, until at least 3 members are added to the channel. 但是,在一个令人烦恼的极端情况下,例如,新创建的通道或仅包含两个成员的通道必须体验自动程序试图对那里的所有消息进行响应,直到将至少3个成员添加到该通道。

Has anyone figured out a handy way to detect this? 有没有人找到方便的方法来检测到这一点? I inspected the Activity JSON for both a message to the app/bot user directly and a message to a channel, but there's no obvious way of being able to distinguish a channel message from a direct-to-bot-user message. 我检查了Activity JSON中是否既有直接发送给应用程序/机器人用户的消息,也有针对通道的消息,但是没有明显的方法可以区分通道消息和直接向机器人用户的消息。

If I remember well, there is a difference in Slack in the naming between a channel and a direct messaging: this difference can be seen in the Conversation.Id field: 如果我没记错的话,通道和直接消息传递之间的Slack命名方式有所不同:这种差异可以在Conversation.Id字段中看到:

Examples: 例子:

  • for a channel: il will look like Bxxxxxxxx:Tyyyyyyyy:Czzzzzzzz 频道:il看起来像Bxxxxxxxx:Tyyyyyyyy:Czzzzzzzz
  • for a direct messaging between you and people A: Bxxxxxxxx:Tyyyyyyyy:Daaaaaaaa 您和别人之间的直接通讯A: Bxxxxxxxx:Tyyyyyyyy:Daaaaaaaa
  • for a direct messaging with several people: Bxxxxxxxx:Tyyyyyyyy:Gbbbbbbbb 与几个人的直接通讯: Bxxxxxxxx:Tyyyyyyyy:Gbbbbbbbb

Where: 哪里:

  • Bxxxxxxxx is your bot Slack's ID Bxxxxxxxx是您的机器人Slack的ID
  • Tyyyyyyyy is your Slack's workspace ID Tyyyyyyyy是您的Slack的工作区ID
  • Czzzzzzzz is the current channel Slack's ID (visible in the url when using web version of Slack) Czzzzzzzz是当前频道的Slack的ID(使用Web版本的Slack在URL中可见)

You will be able to detect your case by checking the conversation ID 您可以通过查看对话ID来发现您的情况

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何获取Bot Connector服务对从注册通道发送到我的终端的消息所做的详细信息? - How can I get detailed info on what Bot Connector Service does to messages sent from registered channels to my endpoint? 如何防止我的机器人回复Slack中的每条消息? - How can I prevent my bot replying to every message in Slack? Windows中的C#RawInputDevice:如何为除我以外的所有应用程序禁用消息? - C# RawInputDevice in Windows: How I can disable messages for all applications except my? 您可以使用 Directline 连接到 Unity 中的 BotFramework 机器人吗? - Can you connect to a BotFramework bot in Unity using Directline? 使用Telegram bot API接收来自群组或渠道的消息 - Receive messages from groups or channels using Telegram bot API 机器人如何在Slack中启动一个线程 - How can a bot start a thread in Slack 如何使用OpenPop获取所有电子邮件,还如何在progressBar上显示检索邮件的进度? - How can I get all my email messages using OpenPop and also show progress of messages retrieving on a progressBar? 使用Rx,当我的Subscribe方法运行时,如何忽略除最新值以外的所有值 - With Rx, how do I ignore all-except-the-latest value when my Subscribe method is running Botframework:如何使用机器人处理长时间运行的任务? - Botframework: how to handle long running tasks with a bot? 机器人不响应命令,除非直接提及 - Bot not responding to command, except a direct mention
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM