コード例 #1
0
ファイル: SlackHandler.cs プロジェクト: jaimerosales/Slackit
        public void GetChannels(UIApplication uiapp)
        {
            var slackClient = new SlackClient(Variables.slackToken);

            string ch_response = slackClient.GetChannelsList(true).Content;

            var ch = JsonConvert.DeserializeObject<ChannelsListResponse>(ch_response);

            foreach (var item in ch.channels)
            {
                Variables.slackChannelNameId.Add(item.name, item.id);
            }

            foreach (var item in ch.channels)
            {
                Variables.slackChannelName.Add(item.name);
            }
        }
コード例 #2
0
        private void appDocClosing(object sender, Autodesk.Revit.DB.Events.DocumentClosingEventArgs e)
        {
            Autodesk.Revit.ApplicationServices.Application app = sender as Autodesk.Revit.ApplicationServices.Application;
            Document doc = e.Document;

            string path = doc.PathName;

            BasicFileInfo fileInfo = BasicFileInfo.Extract(path);
            FileInfo f = new FileInfo(path);

            #region Slack Post: Close without saving

            if (Variables.slackOn)
            {
                if (fileInfo.AllLocalChangesSavedToCentral == false)//Variables.logChangesSaved == false)
                {
                    var giphyClient = new GiphyClient();
                    string gif_msg = giphyClient.GetRandomGif("Disappointed").Content;
                    var gif_resp = JsonConvert.DeserializeObject<Giphy.Response>(gif_msg);
                    string gif_url = gif_resp.data.image_url;

                    var slackClient = new SlackClient(Variables.slackToken);

                    string text = "";
                    string channel = Variables.slackChId;
                    string botname = "Worksharing Warning";
                    string icon_url = Variables.icon_revit;
                    var attachments = new Attachments
                    {
                        fallback = Variables.logUsername + "did not save to central before closing",
                        color = "danger",
                        fields =
                            new Fields[]
                            {
                                new Fields
                                {
                                    title = "Description",
                                    value = "The user has closed the model without saving their changes back to the central model. Open the model and save changes back to the central model.",
                                    @short = false
                                },
                                new Fields
                                {
                                    title = "User",
                                    value = Variables.logUsername,
                                    @short = true
                                },
                                new Fields
                                {
                                    title = "File",
                                    value = Variables.logFileCentralName,
                                    @short = true
                                }
                            },
                        image_url = gif_url
                    };
                    string msg_response = slackClient.PostMessage(text, channel: channel, botName: botname, attachments: attachments, icon_url: icon_url).Content;
                    var resp = JsonConvert.DeserializeObject<ChatPostMessageResponse>(msg_response);
                    msgts_ws.Add(resp.ts);
                }
            }
            #endregion
        }
コード例 #3
0
        private void appDocSynching(object sender, Autodesk.Revit.DB.Events.DocumentSynchronizingWithCentralEventArgs e)
        {
            Variables.logSyncStart = DateTime.Now;
            Variables.logSyncComments = e.Comments;

            #region Slack Post: Synchronizing to Central

            if (Variables.slackOn)
            {
                var slackClient = new SlackClient(Variables.slackToken);

                string text = "";
                string channel = Variables.slackChId;
                string botname = "Synching Info";
                string icon_url = Variables.icon_revit;

                var attachments = new Attachments
                {
                    fallback = Variables.logUsername + " is synching",
                    color = "warning",
                    fields =
                        new Fields[]
                        {
                            new Fields
                            {
                                title = "Status",
                                value = Variables.logUsername + " is synching to central [" + Variables.logFileCentralName + "]\nAvoid synching until this is complete.",
                                @short = true
                            },
                        }
                };

                string msg_response = slackClient.PostMessage(text, channel: channel, botName: botname, attachments: attachments, icon_url: icon_url).Content;
                var resp = JsonConvert.DeserializeObject<ChatPostMessageResponse>(msg_response);

                msgts_synch.Add(resp.ts);
            }
            #endregion
        }
コード例 #4
0
        private void appDocSynched(object sender, Autodesk.Revit.DB.Events.DocumentSynchronizedWithCentralEventArgs e)
        {
            Variables.logSyncEnd = DateTime.Now;
            Variables.logSyncDuration = Variables.logSyncEnd - Variables.logSyncStart;

            #region Slack Post: Synchronized to Central

            if (Variables.slackOn)
            {
                var giphyClient = new GiphyClient();
                string gif_msg = giphyClient.GetRandomGif("ThumbsUp").Content;
                var gif_resp = JsonConvert.DeserializeObject<Giphy.Response>(gif_msg);
                string gif_url = gif_resp.data.image_url;

                var slackClient = new SlackClient(Variables.slackToken);

                //Delete previous synching message
                slackClient.DeleteMessage(msgts_synch, Variables.slackCh);
                msgts_synch.Clear();

                //Post synched message
                string text = "";
                string channel = Variables.slackChId;
                string botname = "Synching Info";
                //string parse = null;
                //bool linkNames = false;
                //bool unfurl_links = false;
                string icon_url = Variables.icon_revit;
                //string icon_emoji = null;

                var attachments = new Attachments
                {
                    fallback = Variables.logUsername + "has synched",
                    color = "good",
                    fields =
                        new Fields[]
                        {
                            new Fields
                            {
                                title = "Status",
                                value = Variables.logUsername + " has synched to central.\n[" + Variables.logFileCentralName + "]",
                                @short = true
                            },
                            new Fields
                            {
                                title = "Duration",
                                value = string.Format("{0:hh\\:mm\\:ss}", Variables.logSyncDuration),
                                @short = true
                            }
                        },
                    image_url = gif_url
                };

                string msg_response = slackClient.PostMessage(text, channel: channel, botName: botname, attachments: attachments, icon_url: icon_url).Content;
                var resp = JsonConvert.DeserializeObject<ChatPostMessageResponse>(msg_response);

            }
            #endregion
        }
コード例 #5
0
        private void appDocOpened(object sender, Autodesk.Revit.DB.Events.DocumentOpenedEventArgs e)
        {
            Variables.logOpenEnd = DateTime.Now;
            Variables.logOpenDuration = Variables.logOpenEnd - Variables.logOpenStart;

            Autodesk.Revit.ApplicationServices.Application app = sender as Autodesk.Revit.ApplicationServices.Application;
            Document doc = e.Document;

            #region Log document & application variables
            string path = doc.PathName;

            BasicFileInfo fileInfo = BasicFileInfo.Extract(path);
            FileInfo f = new FileInfo(path);

            Variables.logComputerName = System.Environment.MachineName;
            Variables.logChangesSaved = fileInfo.AllLocalChangesSavedToCentral;
            Variables.logFileCentral = fileInfo.CentralPath;
            Variables.logFileCentralName = Path.GetFileName(Variables.logFileCentral);
            Variables.logIsCentral = fileInfo.IsCentral;
            Variables.logIsWorkshared = fileInfo.IsWorkshared;
            Variables.logCreatedLocal = fileInfo.IsCreatedLocal;

            Variables.logFileName = doc.Title;
            Variables.logFilePath = doc.PathName;
            Variables.logFileSize = f.Length;

            Variables.logUsername = app.Username;
            Variables.logVersionBuild = app.VersionBuild;
            Variables.logVersionName = app.VersionName;
            Variables.logVersionNumber = app.VersionNumber;
            #endregion

            #region Load settings if they exist
            Element el = Collectors.GetProjectInfoElem(doc);

            try
            {
                string st = el.LookupParameter(Variables.defNameSettings).AsString();
                SlackSettings ds = JsonConvert.DeserializeObject<SlackSettings>(st);

                Variables.slackCh = ds.slackCh;
                Variables.slackChId = ds.slackChId;
                Variables.slackOn = ds.slackOn;
                Variables.slackToken = ds.slackToken;
            }

            catch
            {
                Variables.slackCh = null;
                Variables.slackChId = null;
                Variables.slackOn = false;
                Variables.slackToken = null;
            }

            #endregion

            #region Slack Post: Opened central model
            bool patheq = string.Equals(Variables.logFileCentral, Variables.logFilePath);

            if (Variables.slackOn)
            {

                if (patheq && Variables.logIsWorkshared)
                {
                    var giphyClient = new GiphyClient();
                    string gif_msg = giphyClient.GetRandomGif("Alarm").Content;
                    var gif_resp = JsonConvert.DeserializeObject<Giphy.Response>(gif_msg);
                    string gif_url = gif_resp.data.image_url;

                    var slackClient = new SlackClient(Variables.slackToken);

                    string text = "";
                    string channel = Variables.slackChId;
                    string botname = "Worksharing Warning";
                    string icon_url = Variables.icon_revit;

                    var attachments = new Attachments
                    {
                        fallback = Variables.logUsername + "has opened the central model",
                        color = "danger",
                        fields =
                            new Fields[]
                            {
                                new Fields
                                {
                                    title = "Description",
                                    value = "The user has opened the central model. Close the central model and create a new local file> to work from.",
                                    @short = false
                                },
                                new Fields
                                {
                                    title = "User",
                                    value = Variables.logUsername,
                                    @short = true
                                },
                                new Fields
                                {
                                    title = "File",
                                    value = Variables.logFileCentralName,
                                    @short = true
                                }
                            },
                            image_url = gif_url
                        //image_url = Slack.Constants.image_url_warning
                        //thumb_url = Slack.Constants.thumb_url_warning
                    };

                    string msg_response = slackClient.PostMessage(text, channel: channel, botName: botname, attachments: attachments, icon_url: icon_url).Content;
                    var resp = JsonConvert.DeserializeObject<ChatPostMessageResponse>(msg_response);
                    msgts_ws.Add(resp.ts);
                }
            }
            #endregion
        }
コード例 #6
0
ファイル: SlackForm.cs プロジェクト: pix3lot/Slackit
        private void loadChannels()
        {
            Variables.slackToken = token;

            var ch_name = new List<string>();
            var ch_name_id = new Dictionary<string, string>();

            combobox_channels.DataSource = null;
            bList.Clear();
            combobox_channels.DataSource = bs;

            var slackClient = new SlackClient(Variables.slackToken);
            string ch_response = slackClient.GetChannelsList(true).Content;
            var ch = JsonConvert.DeserializeObject<ChannelsListResponse>(ch_response);

            foreach (var item in ch.channels)
            {
                ch_name_id.Add(item.name, item.id);
            }

            foreach (var item in ch.channels)
            {
                ch_name.Add(item.name);
            }

            foreach (string name in ch_name)
            {
                bList.Add(name);
            }

            ch_list = ch_name;
            ch_dict = ch_name_id;
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: zachary-kaelan/CSharp
        /*
         * /// <summary>
         * /// The main entry point for the application.
         * /// </summary>
         * [STAThread]
         * static void Main()
         * {
         *  Application.EnableVisualStyles();
         *  Application.SetCompatibleTextRenderingDefault(false);
         *  Application.Run(new Form1());
         * }
         */

        /*const string OAuthToken = "xoxp-16172464452-184906848646-221143767396-b4ffa3d8deaa0d1386daa178932f1b62";
         * const string ClientID = "16172464452.222180667527";
         * const string ClientSecret = "9bdacab3a43293f41e6956728d8eb8fe";
         * const string VerifToken = "uiyaTwqgWrutFZRJdHrprjoQ";*/

        static void Main()
        {
            SlackClient slack = new SlackClient("16172464452.222180667527", "9bdacab3a43293f41e6956728d8eb8fe", "xoxp-16172464452-184906848646-221143767396-b4ffa3d8deaa0d1386daa178932f1b62", "uiyaTwqgWrutFZRJdHrprjoQ");

            /*var files = client.GetAllSlackFiles(
             *  (DateTime.Now.Subtract(new TimeSpan(30, 0, 0, 0)) - client.UnixTime)
             *  .TotalSeconds.ToString()
             * ).OrderBy(f => f.created).ToList();
             *
             * Console.WriteLine("{0} total files.", files.Count);
             * Console.WriteLine("{0} files do not qualify.", files.RemoveAll(f => f.channels.Contains("C0N6F9YVB") || f.channels.Contains("C0P2X8C2K")));
             */

            /*
             * System.IO.SlackFile.WriteAllLines(SlackClient.filesPath + "SlackFileNames0.txt", files.OrderBy(f => f.name).Select(f => "    " + f.name + "    "));
             * SortSlackFileNames(
             *  files.Distinct(
             *      new SlackFileComparer()
             *  ).Select(f => "    " + f.name + "    ").ToList()
             * );
             */

            /*
             * System.IO.SlackFile.AppendAllLines(
             *  SlackClient.filesPath, client.DownloadSlackFiles(files)
             *      .Select(f => f.id + "\t~ " + f.name + "\t~ " + f.size.ToString())
             * );
             */

            /*
             * List<string> filesList = Directory.GetFiles(SlackClient.filesPath).Select(f => new FileInfo(f).Name).ToList();
             * foreach (var key in sortedSlackFiles.Keys)
             * {
             *  foreach (var file in filesList)
             *  {
             *      if (file.StartsWith(key.Key))
             *          File.Move(SlackClient.filesPath + file, SlackClient.filesPath + file.Insert(key.Key.Length, @"\"));
             *  }
             * }
             *
             * var groups = filesList.GroupBy(file =>
             *  file.LastIndexOf('.') == file.Length - 4 ?
             *      file.Substring(file.Length - 4).ToLower() :
             *      "noExt"
             * ).OrderBy(g => g.Key);
             *
             * foreach(var grp in groups)
             * {
             *  foreach(var file in grp)
             *  {
             *      if (!System.IO.Directory.Exists(SlackClient.filesPath + grp.Key))
             *          System.IO.Directory.CreateDirectory(SlackClient.filesPath + grp.Key);
             *      if (file.StartsWith(grp.Key))
             *          File.Move(SlackClient.filesPath + file, SlackClient.filesPath + file.Insert(grp.Key.Length, @"\"));
             *      else if (file.EndsWith(grp.Key))
             *          File.Move(SlackClient.filesPath + file, SlackClient.filesPath + grp.Key + @"\" + file);
             *  }
             * }
             */

            //SortSlackFileNames(System.IO.Directory.GetSlackFiles(SlackClient.filesPath).Select(f => new System.IO.SlackFileInfo(f).Name).ToList());

            //client.DeleteSlackFiles(files);

            //long totalSize = files.Sum(f => f.size);
            //Console.WriteLine("Total Size: {0}", totalSize);

            /*
             * foreach (var file in files)
             * {
             *  Console.WriteLine(file.name);
             *  Console.WriteLine("   Created: \t" + client.UnixTime.AddSeconds(Convert.ToDouble(file.created)).ToString("d"));
             *  Console.WriteLine("   SlackFileType: \t" + file.filetype);
             *  Console.WriteLine("   Size: \t{0}", file.size);
             *  Console.WriteLine("   URL: \t{0}", file.url_private);
             *  Console.WriteLine();
             * }
             */

            //DriveClient.AuthorizeSerivceAcc();
            //DriveClient.SimpleUpload("client_secret.json");

            RTMClient client = new RTMClient(slack, "xoxp-16172464452-184906848646-223197167812-30a94f5a19859a0f878bfadfb8f3c0ad", "xoxb-222616323777-JnDu9W5JrboDNaL5MVFS1g5T", "16172464452.224228723319", "fc4e1e1e4b8323accc3d9a63b2a03708", "75FWQKAKncF5KJD9Sy0XkdeZ");

            client.Start();

            Console.ReadLine();
        }
コード例 #8
0
ファイル: EventsApplication.cs プロジェクト: pix3lot/Slackit
        private void appDocSynching(object sender, Autodesk.Revit.DB.Events.DocumentSynchronizingWithCentralEventArgs e)
        {
            Variables.logSyncStart = DateTime.Now;
            Variables.logSyncComments = e.Comments;
            Document doc = e.Document;

            #region Extra: Tracking-Report Differences after Sync
            IEnumerable<Element> a = TrackChanges.Command.GetTrackedElements(doc);
            Dictionary<int, string> end_state = TrackChanges.Command.GetSnapshot(a);
            var first = end_state.First();
            string results = TrackChanges.Command.ReportDifferences(doc, _start_state, end_state);
            _start_state = TrackChanges.Command.GetSnapshot(a);
            Fields trackPinSomething = new Fields
            {
                title = "Pinned Elements",
                value = results,
                @short = true
            };

            #endregion

            #region Post: Worksharing Info-Synchronizing to Central

            if (Variables.slackOn && Variables.slackWSWarn)
            {
                var slackClient = new SlackClient(Variables.slackToken);
                if (!Variables.slackExtraTrackPin)
                {
                    trackPinSomething = null;
                }

                string text = "";
                string channel = Variables.slackChId;
                string botname = "Synching Info";
                string icon_url = Variables.icon_revit;

                var attachments = new Attachments
                {
                    fallback = Variables.logUsername + " is synching",
                    color = "warning",
                    fields =
                            new Fields[]
                        {
                            new Fields
                            {
                                title = "Status",
                                value = Variables.logUsername + " is synching to central [" + Variables.logFileCentralName + "]\nAvoid synching until this is complete.",
                                @short = true
                            },
                            trackPinSomething
                        }
                };

                string msg_response = slackClient.PostMessage(text, channel: channel, botName: botname, attachments: attachments, icon_url: icon_url).Content;
                var resp = JsonConvert.DeserializeObject<ChatPostMessageResponse>(msg_response);
                msgts_synching.Add(resp.ts);

            }
            #endregion
        }
コード例 #9
0
ファイル: EventsApplication.cs プロジェクト: pix3lot/Slackit
        private void appDocSynched(object sender, Autodesk.Revit.DB.Events.DocumentSynchronizedWithCentralEventArgs e)
        {
            Variables.logSyncEnd = DateTime.Now;
            Variables.logSyncDuration = Variables.logSyncEnd - Variables.logSyncStart;
            Document doc = e.Document;

            #region Settings: Reload from Extensible Storage
            ParameterCommands.Load(doc);
            #endregion

            #region Extra: Tracking-Report Differences after Sync
            IEnumerable<Element> a = TrackChanges.Command.GetTrackedElements(doc);
            Dictionary<int, string> end_state = TrackChanges.Command.GetSnapshot(a);
            var first = end_state.First();
            string results = TrackChanges.Command.ReportDifferences(doc, _start_state, end_state);
            _start_state = TrackChanges.Command.GetSnapshot(a);

            #endregion

            #region Post: Worksharing Info-Synchronized to Central

            if (Variables.slackOn && Variables.slackWSInfo)
            {
                string gif_lg_url = null;
                string gif_sm_url = null;

                if (Variables.giphySet > 0)
                {
                    var giphyClient = new GiphyClient();
                    string gif_msg = giphyClient.GetRandomGif("ThumbsUp").Content;
                    var gif_resp = JsonConvert.DeserializeObject<Giphy.Response>(gif_msg);

                    if (Variables.giphySet == 1)
                    {
                        gif_sm_url = gif_resp.data.fixed_height_small_url;
                    }
                    if (Variables.giphySet == 2)
                    {
                        gif_lg_url = gif_resp.data.image_url;
                    }

                }
                var slackClient = new SlackClient(Variables.slackToken);

                //Delete previous synching message, if enabled
                if (Variables.tidySet > 0)
                {
                    slackClient.DeleteMessage(msgts_synching, Variables.slackChId);
                    msgts_synching.Clear();
                }

                //Post synched message
                string text = "";
                string channel = Variables.slackChId;
                string botname = "Synching Info";
                string icon_url = Variables.icon_revit;

                var attachments = new Attachments
                {
                    fallback = Variables.logUsername + "has synched",
                    color = "good",
                    fields =
                        new Fields[]
                        {
                            new Fields
                            {
                                title = "Status",
                                value = Variables.logUsername + " has synched to central.\n[" + Variables.logFileCentralName + " (Size: "+ Variables.logFileSize.ToString() + "MB) ]",
                                @short = true
                            },
                            new Fields
                            {
                                title = "Duration",
                                value = string.Format("{0:hh\\:mm\\:ss}", Variables.logSyncDuration),
                                @short = true
                            }
                        },
                    image_url = gif_lg_url,
                    thumb_url = gif_sm_url

                };

                string msg_response = slackClient.PostMessage(text, channel: channel, botName: botname, attachments: attachments, icon_url: icon_url).Content;
                var resp = JsonConvert.DeserializeObject<ChatPostMessageResponse>(msg_response);
                msgts_synching.Add(resp.ts);
            }
            #endregion
        }
コード例 #10
0
ファイル: EventsApplication.cs プロジェクト: pix3lot/Slackit
        private void appDocOpened(object sender, Autodesk.Revit.DB.Events.DocumentOpenedEventArgs e)
        {
            Variables.logOpenEnd = DateTime.Now;
            Variables.logOpenDuration = Variables.logOpenEnd - Variables.logOpenStart;

            Autodesk.Revit.ApplicationServices.Application app = sender as Autodesk.Revit.ApplicationServices.Application;
            Document doc = e.Document;

            #region Variables: Document & Application Variables
            string path = GetUNCPath(doc.PathName);

            BasicFileInfo fileInfo = BasicFileInfo.Extract(path);
            FileInfo f = new FileInfo(path);

            Variables.logComputerName = Environment.MachineName;
            Variables.logChangesSaved = fileInfo.AllLocalChangesSavedToCentral;
            Variables.logFileCentral = GetUNCPath(fileInfo.CentralPath);
            Variables.logFileCentralName = Path.GetFileName(Variables.logFileCentral);
            Variables.logIsCentral = fileInfo.IsCentral;
            Variables.logIsWorkshared = fileInfo.IsWorkshared;
            Variables.logCreatedLocal = fileInfo.IsCreatedLocal;

            Variables.logFileName = doc.Title;
            Variables.logFilePath = GetUNCPath(doc.PathName);
            Variables.logFileSize = Convert.ToInt32(f.Length / 1000000);

            Variables.logUsername = app.Username;
            Variables.logVersionBuild = app.VersionBuild;
            Variables.logVersionName = app.VersionName;
            Variables.logVersionNumber = app.VersionNumber;
            #endregion

            #region Settings: Load settings if they exist (Extensible Storage)
            ParameterCommands.Load(doc);
            #endregion

            #region Post: Worksharing Warning-Opened Central Model
            bool patheq = string.Equals(Variables.logFileCentral, Variables.logFilePath);

            if (Variables.slackOn && Variables.slackWSWarn)
            {
                if (patheq && Variables.logIsWorkshared)
                {
                    string gif_lg_url = null;
                    string gif_sm_url = null;

                    if (Variables.giphySet > 0)
                    {
                        var giphyClient = new GiphyClient();
                        string gif_msg = giphyClient.GetRandomGif("Alarm").Content;
                        var gif_resp = JsonConvert.DeserializeObject<Giphy.Response>(gif_msg);

                        if (Variables.giphySet == 1)
                        {
                            gif_sm_url = gif_resp.data.fixed_height_small_url;
                        }

                        if (Variables.giphySet == 2)
                        {
                            gif_lg_url = gif_resp.data.image_url;
                        }

                    }

                    var slackClient = new SlackClient(Variables.slackToken);

                    string text = "";
                    string channel = Variables.slackChId;
                    string botname = "Worksharing Warning";
                    string icon_url = Variables.icon_revit;

                    var attachments = new Attachments
                    {
                        fallback = Variables.logUsername + "has opened the central model",
                        color = "danger",
                        fields =
                            new Fields[]
                            {
                                new Fields
                                {
                                    title = "Description",
                                    value = "The user has opened the central model. Close the central model and create a new local file> to work from.",
                                    @short = false
                                },
                                new Fields
                                {
                                    title = "User",
                                    value = Variables.logUsername,
                                    @short = true
                                },
                                new Fields
                                {
                                    title = "File",
                                    value = Variables.logFileCentralName,
                                    @short = true
                                }
                            },
                        image_url = gif_lg_url,
                        thumb_url = gif_sm_url
                    };

                    string msg_response = slackClient.PostMessage(text, channel: channel, botName: botname, attachments: attachments, icon_url: icon_url).Content;
                    var resp = JsonConvert.DeserializeObject<ChatPostMessageResponse>(msg_response);
                    msgts_ws.Add(resp.ts);
                }
            }
            #endregion

            #region Post: Model Warning-File Size > 300MB
            if (Variables.slackOn && Variables.slackModelWarn)
            {
                string gif_lg_url = null;
                string gif_sm_url = null;

                if (Variables.logFileSize > 300)
                {
                    if (Variables.giphySet > 0)
                    {
                        var giphyClient = new GiphyClient();
                        string gif_msg = giphyClient.GetRandomGif("Gasp").Content;
                        var gif_resp = JsonConvert.DeserializeObject<Giphy.Response>(gif_msg);

                        if (Variables.giphySet == 1)
                        {
                            gif_sm_url = gif_resp.data.fixed_height_small_url;
                        }

                        if (Variables.giphySet == 2)
                        {
                            gif_lg_url = gif_resp.data.image_url;
                        }

                        var slackClient = new SlackClient(Variables.slackToken);

                        string text = "";
                        string channel = Variables.slackChId;
                        string botname = "Model Warning";
                        string icon_url = Variables.icon_revit;

                        var attachments = new Attachments
                        {
                            fallback = "The file size has gone above 300MB, time to do some model file size management.",
                            color = "danger",
                            fields =
                                new Fields[]
                                {
                                    new Fields
                                    {
                                        title = "Description",
                                        value = "The file size is above 300MB, time to do some model maintenance",
                                        @short = false
                                    },
                                    new Fields
                                    {
                                        title = "File Size",
                                        value = Variables.logFileSize.ToString() + "MB",
                                        @short = true
                                    },
                                    new Fields
                                    {
                                        title = "File",
                                        value = Variables.logFileCentralName,
                                        @short = true
                                    }
                                },
                            image_url = gif_lg_url,
                            thumb_url = gif_sm_url
                        };

                        string msg_response = slackClient.PostMessage(text, channel: channel, botName: botname, attachments: attachments, icon_url: icon_url).Content;
                        var resp = JsonConvert.DeserializeObject<ChatPostMessageResponse>(msg_response);

                        msgts_model.Add(resp.ts);
                    }
                }
                #endregion

                #region Tracking: Start Logging Pinned Elements
                IEnumerable<Element> a = TrackChanges.Command.GetTrackedElements(doc);
                _start_state = TrackChanges.Command.GetSnapshot(a);

                #endregion

                #region Post: Tracking-Pinned Element-Started

                if (Variables.slackOn && Variables.slackExtraTrackPin)
                {

                    var slackClient = new SlackClient(Variables.slackToken);

                    //Post pinned elements message
                    string text = "";
                    string channel = Variables.slackChId;
                    string botname = "Pinning Info";
                    string icon_url = Variables.icon_revit;

                    var attachments = new Attachments
                    {
                        fallback = Variables.logUsername + "has started tracking pinned elements.",
                        color = "good",
                        fields =
                            new Fields[]
                        {
                            new Fields
                            {
                                title = "Status",
                                value = Variables.logUsername + " has started tracking pinned elements.\n[" + Variables.logFileCentralName + "]",
                                @short = true
                            }
                        }
                    };

                    string msg_response = slackClient.PostMessage(text, channel: channel, botName: botname, attachments: attachments, icon_url: icon_url).Content;
                    var resp = JsonConvert.DeserializeObject<ChatPostMessageResponse>(msg_response);
                    msgts_extra.Add(resp.ts);
                }
                #endregion

            }
        }