public static DiscordConfiguration GetDiscordConfiguration(string configFile) { string _json; using (var sr = new StreamReader(File.OpenRead(configFile), new UTF8Encoding(false))) _json = sr.ReadToEnd(); _ConfigModel cfg = JsonConvert.DeserializeObject <_ConfigModel>(_json); Token = cfg.token; Prefix = cfg.prefix; ShikimoriClientSecret = cfg.ShikimoriClientSecret; ShikimoriClientId = cfg.ShikimoriClientId; SearchLimit = cfg.search_limit; AuthURL = $"https://shikimori.org/oauth/authorize?client_id={cfg.ShikimoriClientId}&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=user_rates"; return(new DiscordConfiguration { Token = cfg.token, TokenType = TokenType.Bot, AutoReconnect = true, LogLevel = LogLevel.Debug, UseInternalLogHandler = true }); }
public void Post([FromUri] _ConfigModel value) { _Config(value.tokenId, value._Type, value.refID); }