private (string, Queue <string>) GetUrl(DiscordWebhookURLs url)
        {
            switch (url)
            {
            case DiscordWebhookURLs.DiscordWebhookOOCURL:
                return(ServerData.ServerConfig?.DiscordWebhookOOCURL, OOCMessageQueue);

            case DiscordWebhookURLs.DiscordWebhookAdminURL:
                return(ServerData.ServerConfig?.DiscordWebhookAdminURL, AdminAhelpMessageQueue);

            case DiscordWebhookURLs.DiscordWebhookAnnouncementURL:
                return(ServerData.ServerConfig?.DiscordWebhookAnnouncementURL, AnnouncementMessageQueue);

            case DiscordWebhookURLs.DiscordWebhookAllChatURL:
                return(ServerData.ServerConfig?.DiscordWebhookAllChatURL, AllChatMessageQueue);

            case DiscordWebhookURLs.DiscordWebhookAdminLogURL:
                return(ServerData.ServerConfig?.DiscordWebhookAdminLogURL, AdminLogMessageQueue);

            case DiscordWebhookURLs.DiscordWebhookErrorLogURL:
                return(ServerData.ServerConfig?.DiscordWebhookErrorLogURL, ErrorLogMessageQueue);

            default:
                return(null, null);
            }
        }
Exemple #2
0
        public void AddWebHookMessageToQueue(DiscordWebhookURLs urlToUse, string msg, string username, string mentionID = null)
        {
            var urlAndQueue = GetUrl(urlToUse);

            if (string.IsNullOrEmpty(urlAndQueue.Item1))
            {
                return;
            }

            msg = MsgMentionProcess(msg, mentionID);

            if (username == null)
            {
                username = "******";
            }

            if (username != "")
            {
                msg = $"{username}:  " + msg;
            }

            urlAndQueue.Item2.Enqueue(msg);
        }