Esempio n. 1
0
            /*
             * example & other members:
             *  {
             *          "id":"C0521HWP0",
             *          "name":"banken_schnittstellen",
             *          "is_channel":true,
             *          "created":1432711733,
             *          "creator":"U04P5GAF0",
             *          "is_archived":false,
             *          "is_general":false,
             *          "is_member":false,
             *          "members":["U03GRCMKF","U04P5AP72","U04P5GAF0","U04V3M8N9","U050ABFFP"],
             *          "topic":{"value":"","creator":"","last_set":0},
             *          "purpose":{"value":"Erkundung und Definition m\u00f6glicher Banken-Schnittstelle","creator":"U04P5GAF0","last_set":1432711733},
             *          "num_members":5
             *  }
             */

            public static Slack_Channel FindByName(string name)
            {
                if (name == null)
                {
                    return(null);
                }

                // load channel list & find exact name
                var lsc    = Slack_API.ChannelList();
                var result = lsc.FirstOrDefault(sc => sc.name == name);

                if (result != null)
                {
                    return(result);
                }

                // check for a unique 'contains' match..
                var matches = lsc.FindAll(sc => sc.name.Contains(name.ToLower()));

                if (matches.Count() == 1)
                {
                    return(matches[0]);
                }

                return(null);
            }
Esempio n. 2
0
 public PostMessage_Rsp PostMessage(string message, string username = null, bool link_names = false)
 {
     return(Slack_API.PostMessage(id, message, username, link_names));
 }