/*
         * SendSpyOpToChannel
         *
         * Purpose:
         * This method handles incomming SpyOps as well as !cty.op bot command to send Countries Spy Op Data to the Channel requested
         *
         */
        public async void SendSpyOpToChannel(SpyOpInfo op, Channel chan)
        {
            try
            {
                if (chan == null)
                {
                    await frmDiscordBot.Bot.channels.chanSpyops.SendMessage(op.GetSpyOpMessage());
                }
                else
                {
                    await chan.SendMessage(op.GetSpyOpMessage());
                }

                // TO DO:
                // Later we can add relation detection, if relation is detected display a warnign message to user.
            }
            catch (Exception c)
            {
                ErrorLogs.SaveErrorToXML(new BotError(c));
            }
        }
        /*
         * Check Online Users
         *
         * Purpose:
         * Checks to see if users are online, if they are sends an automated message(Max 1 message/day) to keep them up to date with clan affairs.
         * If Users are not online for 3 days, bot sends them a message anyway
         *
         */
        public async void CheckForOnlineUsers(object sender, DoWorkEventArgs e)
        {
            try
            {
                foreach (var user in LoCServer.Users)
                {
                    if (!user.Name.Contains("MadBot"))
                    {
                        if (user.Status.Value == UserStatus.Online || user.Status.Value == UserStatus.Idle)
                        {
                            if (LastJoins.Any(c => c.userName == user.Name))
                            {
                                if (LastJoins.Where(c => c.userName == user.Name).OrderByDescending(c => c.timestamp).FirstOrDefault().timestamp < DateTime.UtcNow.AddDays(-1))
                                {
                                    await user.SendMessage(BuildRelationGreetingMessage());

                                    await user.SendMessage(BuildKillListGreetingMessage());
                                }
                                LastJoins.RemoveAll(c => c.userName == user.Name);
                                LastJoins.Add(new UserJoin
                                {
                                    userName  = user.Name,
                                    timestamp = DateTime.UtcNow
                                });
                            }
                            else
                            {
                                LastJoins.Add(new UserJoin
                                {
                                    userName  = user.Name,
                                    timestamp = DateTime.UtcNow
                                });
                                await user.SendMessage(BuildRelationGreetingMessage());

                                await user.SendMessage(BuildKillListGreetingMessage());
                            }
                        }
                        else
                        {
                            if (LastJoins.Any(c => c.userName == user.Name))
                            {
                                if (LastJoins.FirstOrDefault(C => C.userName == user.Name).timestamp < DateTime.UtcNow.AddDays(-3))
                                {
                                    await user.SendMessage(BuildRelationGreetingMessage());

                                    await user.SendMessage(BuildKillListGreetingMessage());
                                }
                                LastJoins.RemoveAll(c => c.userName == user.Name);
                                LastJoins.Add(new UserJoin
                                {
                                    userName  = user.Name,
                                    timestamp = DateTime.UtcNow
                                });
                            }
                            else
                            {
                                LastJoins.Add(new UserJoin
                                {
                                    userName  = user.Name,
                                    timestamp = DateTime.UtcNow
                                });
                            }
                        }
                    }
                }
            }
            catch (Exception c)
            {
                ErrorLogs.SaveErrorToXML(new BotError(c));
            }
        }