示例#1
0
        public void postBotlist(Dictionary <string, object> dictData, Botlist botlist)
        {
            byte[] resByte;
            string resString;

            byte[] reqString;

            try
            {
                WebClient webClient = new WebClient();

                webClient.Headers.Add("content-type", "application/json");
                webClient.Headers.Add("Authorization", _lib.GetListToken(botlist));
                reqString = Encoding.Default.GetBytes(JsonConvert.SerializeObject(dictData, Formatting.Indented));
                resByte   = webClient.UploadData(urlInput, "post", reqString);
                resString = Encoding.Default.GetString(resByte);
                webClient.Dispose();

                LogMessage log = new LogMessage(LogSeverity.Info, $"{botlist.ToString()} API", "Success");
                _lib.Log(log);
            } catch (Exception e)
            {
                LogMessage msg = new LogMessage(LogSeverity.Error, $"{botlist.ToString()} POST", e.Message);
                new LibEdgyBot().Log(msg);
            }
        }
示例#2
0
        public string GetListToken(Botlist botlist)
        {
            switch (botlist)
            {
            case Botlist.BFD:
                return(EdgyBot.Credentials.bfdToken);

            case Botlist.DISCORDBOTS:
                return(EdgyBot.Credentials.dbToken);

            case Botlist.LISTSPACE:
                return(EdgyBot.Credentials.blsToken);

            case Botlist.DBLCOM:
                return("Bot " + EdgyBot.Credentials.dblComToken);
            }
            return(null);
        }