32 lines
954 B
C#
32 lines
954 B
C#
using DeukBot4.Utilities;
|
|
using Npgsql;
|
|
|
|
namespace DeukBot4.Database.ServerSettings
|
|
{
|
|
public class ServerSetting
|
|
{
|
|
public ServerSetting(ulong serverId, ulong mutedRoleId = 0)
|
|
{
|
|
ServerId = serverId;
|
|
MutedRoleId = mutedRoleId;
|
|
}
|
|
|
|
public ulong ServerId { get; }
|
|
public ulong MutedRoleId { get; }
|
|
|
|
public void SetMutedRoleId(ulong id)
|
|
{
|
|
using (var conn = new DatabaseConnection())
|
|
{
|
|
using (var cmd = new NpgsqlCommand())
|
|
{
|
|
cmd.Connection = conn;
|
|
cmd.CommandText = "UPDATE server_settings SET muted_role = @val WHERE server_id = @key";
|
|
cmd.Parameters.AddWithValue("val", id.ToLong());
|
|
cmd.Parameters.AddWithValue("key", ServerId.ToLong());
|
|
cmd.ExecuteNonQuery();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |