How can I get my bot to ignore conversation until it is addressed directly?

前端 未结 4 643
遇见更好的自我
遇见更好的自我 2021-01-26 08:57

I want to add my bot to a Slack channel. But I want it to ignore conversation until it is addressed directly, e.g.:

me: hi!
me: hi!
me: @bot hi!
bot: why hello t         


        
4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-26 09:55

    The dumbest way would be to use MessageController.cs. The first thing you do in the Post method there would be to check that the Activity contains "@bot".

    if (activity.Text.Contains("@bot") {
        //do your normal stuff
    }
    else {
        return Request.CreateResponse(HttpStatusCode.OK); //ignore message
    }
    

提交回复
热议问题