public static bool kaiden_discord_event_publish(string magicParam)
        {
            try
            {
                PgUnicorn unicorn          = new PgUnicorn();
                DataTable eventsToAnnounce = unicorn.DataTableOfSql("select id, name from events where published_discord = false AND published = true");
                foreach (DataRow ev in eventsToAnnounce.Rows)
                {
                    // ex. https://my.bendrocorp.com/events#!/op-sunday-76
                    // Send WebHook to general chat
                    WebHookPayload webHookPayload = new WebHookPayload()
                    {
                        content = $"@everyone A new operation has been posted to the Employee Portal! You can get more information here: https://my.bendrocorp.com/events/{ev["id"].ToString()}"
                    };
                    WebhookSender.Send(generalDiscordChannel, webHookPayload).Wait();
                    unicorn.ExecuteNonQueryOfSql($"update events set published_discord = true where id = {ev["id"].ToString()}");
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public static bool dead_users(string MagicParam)
        {
            try
            {
                PgUnicorn pg = new PgUnicorn();

                DataTable users = pg.DataTableOfSql("select * from users where id NOT IN (0, 1)");

                foreach (DataRow user in users.Rows)
                {
                    DateTime created = DateTime.Parse(user["created_at"].ToString());
                    if (created.AddDays(5) < DateTime.Now)
                    {
                        if (Convert.ToInt32(pg.ScalerOfSql("select count(*) from characters where user_id = " + user["id"].ToString())) == 0)
                        {
                            Console.WriteLine(user["username"] + " has no character and is more than 5 days old!");
                            // then the user should be culled
                            pg.ExecuteNonQueryOfSql(String.Format("delete from users where id = {0}", user["id"]));
                        }
                    }
                }

                //the op was completed
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error Occured while trying to execute dead_users: " + ex.Message);
                return(false);
            }
        }
        public void Run()
        {
            while (true)
            {
                // get a list of the task managers
                PgUnicorn pg = new PgUnicorn();

                DataTable taskManagers = pg.DataTableOfSql("select * from task_managers where enabled = true");

                foreach (DataRow manager in taskManagers.Rows)
                {
                    DateTime lastRun = DateTime.Parse(manager["next_run"].ToString());
                    if (lastRun < DateTime.Now)
                    {
                        try
                        {
                            // get the task name from the manager object
                            string taskName = manager["task_name"].ToString();
                            // get the Tasks object
                            Type thisType = typeof(Tasks);
                            // see if we can find the method
                            MethodInfo theMethod = thisType.GetMethod(taskName);
                            if (theMethod != null)
                            {
                                theMethod.Invoke(null, new object[] { "Har har" });
                                string updateTask = $"update task_managers set last_run = now(), next_run = displace_date(now()::timestamp, {manager["every"].ToString()}, {manager["recur"].ToString()}) where id = {manager["id"].ToString()}";
                                pg.ExecuteNonQueryOfSql(updateTask);
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine("Error Occured while trying to process task: " + ex.Message);
                        }
                    }
                }
                Thread.Sleep(10000); // sleep for 10 seconds
            }
        }