Skip to content

Commit

Permalink
yeah lets remove this lmao
Browse files Browse the repository at this point in the history
  • Loading branch information
SylveonDeko committed Oct 11, 2024
1 parent 8a440b0 commit 1cea622
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/Mewdeko/Services/Impl/BotCredentials.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,6 @@ public BotCredentials()
}

UpdateCredentials(null, null);

if (!MigrateToPsql)
{
var watcher = new FileSystemWatcher(Directory.GetCurrentDirectory())
{
NotifyFilter = NotifyFilters.LastWrite, Filter = "*.json", EnableRaisingEvents = true
};
watcher.Changed += UpdateCredentials;
}
}

// Properties (same as before)
Expand All @@ -91,6 +82,11 @@ public BotCredentials()
/// </summary>
public string PsqlConnectionString { get; set; }

// /// <summary>
// /// Gets or sets whether this is the master mewdeko instance
// /// </summary>
// public bool IsMasterInstance { get; set; } = false;

/// <summary>
/// Gets or sets a value indicating whether to use global currency.
/// </summary>
Expand Down Expand Up @@ -373,9 +369,10 @@ private void UpdateCredentials(object sender, FileSystemEventArgs e)
var data = configBuilder.Build();

Token = data[nameof(Token)];
OwnerIds = data.GetSection(nameof(OwnerIds)).GetChildren()
.Select(c => ulong.Parse(c.Value))
.ToImmutableArray();
OwnerIds = [
..data.GetSection(nameof(OwnerIds)).GetChildren()
.Select(c => ulong.Parse(c.Value))
];
TurnstileKey = data[nameof(TurnstileKey)];
GiveawayEntryUrl = data[nameof(GiveawayEntryUrl)];
GoogleApiKey = data[nameof(GoogleApiKey)];
Expand All @@ -398,6 +395,7 @@ private void UpdateCredentials(object sender, FileSystemEventArgs e)
ShardRunCommand = data[nameof(ShardRunCommand)];
ShardRunArguments = data[nameof(ShardRunArguments)];
CleverbotApiKey = data[nameof(CleverbotApiKey)];
// IsMasterInstance = Convert.ToBoolean(data[nameof(IsMasterInstance)]);
LocationIqApiKey = data[nameof(LocationIqApiKey)];
SpotifyClientId = data[nameof(SpotifyClientId)];
SpotifyClientSecret = data[nameof(SpotifyClientSecret)];
Expand Down Expand Up @@ -469,7 +467,6 @@ private void UpdateCredentials(object sender, FileSystemEventArgs e)
using var conn = new NpgsqlConnection(PsqlConnectionString);
conn.Open();
conn.Close();
Log.Information("Successfully connected to PostgreSQL database.");
}
catch (Exception ex)
{
Expand All @@ -491,7 +488,6 @@ private void UpdateCredentials(object sender, FileSystemEventArgs e)
{
var connect = ConnectionMultiplexer.Connect(RedisConnections.Split(";")[0]);
connect.Close();
Log.Information("Successfully connected to Redis.");
}
catch
{
Expand Down Expand Up @@ -544,6 +540,7 @@ private class CredentialsModel : IBotCredentials
public string RedisOptions { get; set; } = "127.0.0.1,syncTimeout=3000";
public int ApiPort { get; set; } = 5001;
public bool SkipApiKey { get; set; } = false;
// public bool IsMasterInstance { get; set; } = false;
public RestartConfig RestartCommand { get; } = null;
public string RedisConnections { get; } = "127.0.0.1:6379";
public string LastFmApiKey { get; } = "";
Expand Down

0 comments on commit 1cea622

Please sign in to comment.