Update packages; fix Npgsql issues
This commit is contained in:
parent
fbd310ba35
commit
f16628a44e
6 changed files with 26 additions and 26 deletions
|
@ -65,8 +65,8 @@ namespace Noikoio.RegexBot.EntityCache
|
||||||
{
|
{
|
||||||
c.CommandText = $"SELECT {QueryColumns} from {SqlHelper.TableTextChannel} WHERE "
|
c.CommandText = $"SELECT {QueryColumns} from {SqlHelper.TableTextChannel} WHERE "
|
||||||
+ "channel_id = @Cid AND guild_id = @Gid";
|
+ "channel_id = @Cid AND guild_id = @Gid";
|
||||||
c.Parameters.Add("@Cid", NpgsqlTypes.NpgsqlDbType.Bigint).Value = channel;
|
c.Parameters.Add("@Cid", NpgsqlTypes.NpgsqlDbType.Bigint).Value = (long)channel;
|
||||||
c.Parameters.Add("@Gid", NpgsqlTypes.NpgsqlDbType.Bigint).Value = guild;
|
c.Parameters.Add("@Gid", NpgsqlTypes.NpgsqlDbType.Bigint).Value = (long)guild;
|
||||||
c.Prepare();
|
c.Prepare();
|
||||||
using (var r = await c.ExecuteReaderAsync())
|
using (var r = await c.ExecuteReaderAsync())
|
||||||
{
|
{
|
||||||
|
|
|
@ -125,8 +125,8 @@ namespace Noikoio.RegexBot.EntityCache
|
||||||
{
|
{
|
||||||
c.CommandText = $"SELECT {QueryColumns} FROM {SqlHelper.TableUser} WHERE "
|
c.CommandText = $"SELECT {QueryColumns} FROM {SqlHelper.TableUser} WHERE "
|
||||||
+ "user_id = @Uid AND guild_id = @Gid";
|
+ "user_id = @Uid AND guild_id = @Gid";
|
||||||
c.Parameters.Add("@Uid", NpgsqlTypes.NpgsqlDbType.Bigint).Value = user;
|
c.Parameters.Add("@Uid", NpgsqlTypes.NpgsqlDbType.Bigint).Value = (long)user;
|
||||||
c.Parameters.Add("@Gid", NpgsqlTypes.NpgsqlDbType.Bigint).Value = guild;
|
c.Parameters.Add("@Gid", NpgsqlTypes.NpgsqlDbType.Bigint).Value = (long)guild;
|
||||||
c.Prepare();
|
c.Prepare();
|
||||||
using (var r = await c.ExecuteReaderAsync())
|
using (var r = await c.ExecuteReaderAsync())
|
||||||
{
|
{
|
||||||
|
|
|
@ -102,7 +102,7 @@ namespace Noikoio.RegexBot.EntityCache
|
||||||
+ "VALUES (@GuildId, now(), @CurrentName) "
|
+ "VALUES (@GuildId, now(), @CurrentName) "
|
||||||
+ "ON CONFLICT (guild_id) DO UPDATE SET "
|
+ "ON CONFLICT (guild_id) DO UPDATE SET "
|
||||||
+ "current_name = EXCLUDED.current_name, cache_date = EXCLUDED.cache_date";
|
+ "current_name = EXCLUDED.current_name, cache_date = EXCLUDED.cache_date";
|
||||||
c.Parameters.Add("@GuildId", NpgsqlDbType.Bigint).Value = g.Id;
|
c.Parameters.Add("@GuildId", NpgsqlDbType.Bigint).Value = (long)g.Id;
|
||||||
c.Parameters.Add("@CurrentName", NpgsqlDbType.Text).Value = g.Name;
|
c.Parameters.Add("@CurrentName", NpgsqlDbType.Text).Value = g.Name;
|
||||||
c.Prepare();
|
c.Prepare();
|
||||||
await c.ExecuteNonQueryAsync();
|
await c.ExecuteNonQueryAsync();
|
||||||
|
@ -140,8 +140,8 @@ namespace Noikoio.RegexBot.EntityCache
|
||||||
{
|
{
|
||||||
if (item.IsWebhook) continue;
|
if (item.IsWebhook) continue;
|
||||||
|
|
||||||
uid.Value = item.Id;
|
uid.Value = (long)item.Id;
|
||||||
gid.Value = item.Guild.Id;
|
gid.Value = (long)item.Guild.Id;
|
||||||
uname.Value = item.Username;
|
uname.Value = item.Username;
|
||||||
disc.Value = item.Discriminator;
|
disc.Value = item.Discriminator;
|
||||||
nname.Value = item.Nickname;
|
nname.Value = item.Nickname;
|
||||||
|
@ -180,8 +180,8 @@ namespace Noikoio.RegexBot.EntityCache
|
||||||
{
|
{
|
||||||
if (!(item is ITextChannel ich)) continue;
|
if (!(item is ITextChannel ich)) continue;
|
||||||
|
|
||||||
cid.Value = item.Id;
|
cid.Value = (long)item.Id;
|
||||||
gid.Value = item.Guild.Id;
|
gid.Value = (long)item.Guild.Id;
|
||||||
cname.Value = item.Name;
|
cname.Value = item.Name;
|
||||||
await c.ExecuteNonQueryAsync();
|
await c.ExecuteNonQueryAsync();
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,8 +178,8 @@ namespace Noikoio.RegexBot.Module.ModLogs
|
||||||
{
|
{
|
||||||
c.CommandText = $"SELECT {QueryColumns} FROM {TblEntry} "
|
c.CommandText = $"SELECT {QueryColumns} FROM {TblEntry} "
|
||||||
+ "WHERE guild_id = @Guild and id = @Id";
|
+ "WHERE guild_id = @Guild and id = @Id";
|
||||||
c.Parameters.Add("@Guild", NpgsqlTypes.NpgsqlDbType.Bigint).Value = guild;
|
c.Parameters.Add("@Guild", NpgsqlTypes.NpgsqlDbType.Bigint).Value = (long)guild;
|
||||||
c.Parameters.Add("@Id", NpgsqlTypes.NpgsqlDbType.Numeric).Value = id;
|
c.Parameters.Add("@Id", NpgsqlTypes.NpgsqlDbType.Numeric).Value = (long)id;
|
||||||
c.Prepare();
|
c.Prepare();
|
||||||
using (var r = await c.ExecuteReaderAsync())
|
using (var r = await c.ExecuteReaderAsync())
|
||||||
{
|
{
|
||||||
|
@ -221,21 +221,21 @@ namespace Noikoio.RegexBot.Module.ModLogs
|
||||||
if (and) c.CommandText += " AND";
|
if (and) c.CommandText += " AND";
|
||||||
else and = true;
|
else and = true;
|
||||||
c.CommandText += " target_id = @TargetId";
|
c.CommandText += " target_id = @TargetId";
|
||||||
c.Parameters.Add("@TargetId", NpgsqlTypes.NpgsqlDbType.Bigint).Value = target.Value;
|
c.Parameters.Add("@TargetId", NpgsqlTypes.NpgsqlDbType.Bigint).Value = (long)target.Value;
|
||||||
}
|
}
|
||||||
if (invoker.HasValue)
|
if (invoker.HasValue)
|
||||||
{
|
{
|
||||||
if (and) c.CommandText += " AND";
|
if (and) c.CommandText += " AND";
|
||||||
else and = true;
|
else and = true;
|
||||||
c.CommandText += " invoke_id = @InvokeId";
|
c.CommandText += " invoke_id = @InvokeId";
|
||||||
c.Parameters.Add("@InvokeId", NpgsqlTypes.NpgsqlDbType.Bigint).Value = invoker.Value;
|
c.Parameters.Add("@InvokeId", NpgsqlTypes.NpgsqlDbType.Bigint).Value = (long)invoker.Value;
|
||||||
}
|
}
|
||||||
if (channel.HasValue)
|
if (channel.HasValue)
|
||||||
{
|
{
|
||||||
if (and) c.CommandText += " AND";
|
if (and) c.CommandText += " AND";
|
||||||
else and = true;
|
else and = true;
|
||||||
c.CommandText += " target_channel_id = @ChannelId";
|
c.CommandText += " target_channel_id = @ChannelId";
|
||||||
c.Parameters.Add("@ChannelId", NpgsqlTypes.NpgsqlDbType.Bigint).Value = channel.Value;
|
c.Parameters.Add("@ChannelId", NpgsqlTypes.NpgsqlDbType.Bigint).Value = (long)channel.Value;
|
||||||
}
|
}
|
||||||
if (category.HasValue)
|
if (category.HasValue)
|
||||||
{
|
{
|
||||||
|
|
|
@ -105,7 +105,7 @@ namespace Noikoio.RegexBot.Module.ModLogs
|
||||||
{
|
{
|
||||||
c.CommandText = "SELECT author_id, message, created_ts, edited_ts as msgtime FROM " + TableMessage
|
c.CommandText = "SELECT author_id, message, created_ts, edited_ts as msgtime FROM " + TableMessage
|
||||||
+ " WHERE message_id = @MessageId";
|
+ " WHERE message_id = @MessageId";
|
||||||
c.Parameters.Add("@MessageId", NpgsqlDbType.Bigint).Value = messageId;
|
c.Parameters.Add("@MessageId", NpgsqlDbType.Bigint).Value = (long)messageId;
|
||||||
c.Prepare();
|
c.Prepare();
|
||||||
using (var r = await c.ExecuteReaderAsync())
|
using (var r = await c.ExecuteReaderAsync())
|
||||||
{
|
{
|
||||||
|
@ -320,15 +320,15 @@ namespace Noikoio.RegexBot.Module.ModLogs
|
||||||
+ " (@MessageId, @UserId, @GuildId, @ChannelId, @Date, @Edit, @Message)"
|
+ " (@MessageId, @UserId, @GuildId, @ChannelId, @Date, @Edit, @Message)"
|
||||||
+ " ON CONFLICT (message_id) DO UPDATE"
|
+ " ON CONFLICT (message_id) DO UPDATE"
|
||||||
+ " SET message = EXCLUDED.message, edited_ts = EXCLUDED.edited_ts";
|
+ " SET message = EXCLUDED.message, edited_ts = EXCLUDED.edited_ts";
|
||||||
c.Parameters.Add("@MessageId", NpgsqlDbType.Bigint).Value = msg.Id;
|
c.Parameters.Add("@MessageId", NpgsqlDbType.Bigint).Value = (long)msg.Id;
|
||||||
c.Parameters.Add("@UserId", NpgsqlDbType.Bigint).Value = msg.Author.Id;
|
c.Parameters.Add("@UserId", NpgsqlDbType.Bigint).Value = (long)msg.Author.Id;
|
||||||
c.Parameters.Add("@GuildId", NpgsqlDbType.Bigint).Value = ((SocketGuildUser)msg.Author).Guild.Id;
|
c.Parameters.Add("@GuildId", NpgsqlDbType.Bigint).Value = (long)((SocketGuildUser)msg.Author).Guild.Id;
|
||||||
c.Parameters.Add("@ChannelId", NpgsqlDbType.Bigint).Value = msg.Channel.Id;
|
c.Parameters.Add("@ChannelId", NpgsqlDbType.Bigint).Value = (long)msg.Channel.Id;
|
||||||
c.Parameters.Add("@Date", NpgsqlDbType.TimestampTZ).Value = msg.Timestamp;
|
c.Parameters.Add("@Date", NpgsqlDbType.TimestampTz).Value = msg.Timestamp;
|
||||||
if (msg.EditedTimestamp.HasValue)
|
if (msg.EditedTimestamp.HasValue)
|
||||||
c.Parameters.Add("@Edit", NpgsqlDbType.TimestampTZ).Value = msg.EditedTimestamp.Value;
|
c.Parameters.Add("@Edit", NpgsqlDbType.TimestampTz).Value = msg.EditedTimestamp.Value;
|
||||||
else
|
else
|
||||||
c.Parameters.Add("@Edit", NpgsqlDbType.TimestampTZ).Value = DBNull.Value;
|
c.Parameters.Add("@Edit", NpgsqlDbType.TimestampTz).Value = DBNull.Value;
|
||||||
c.Parameters.Add("@Message", NpgsqlDbType.Text).Value = dbinsert.ToString();
|
c.Parameters.Add("@Message", NpgsqlDbType.Text).Value = dbinsert.ToString();
|
||||||
c.Prepare();
|
c.Prepare();
|
||||||
await c.ExecuteNonQueryAsync();
|
await c.ExecuteNonQueryAsync();
|
||||||
|
@ -351,7 +351,7 @@ namespace Noikoio.RegexBot.Module.ModLogs
|
||||||
{
|
{
|
||||||
c.CommandText = "SELECT message FROM " + TableMessage
|
c.CommandText = "SELECT message FROM " + TableMessage
|
||||||
+ " WHERE message_id = @MessageId";
|
+ " WHERE message_id = @MessageId";
|
||||||
c.Parameters.Add("@MessageId", NpgsqlDbType.Bigint).Value = messageId;
|
c.Parameters.Add("@MessageId", NpgsqlDbType.Bigint).Value = (long)messageId;
|
||||||
c.Prepare();
|
c.Prepare();
|
||||||
using (var r = await c.ExecuteReaderAsync())
|
using (var r = await c.ExecuteReaderAsync())
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,9 +15,9 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Discord.Net" Version="2.2.0" />
|
<PackageReference Include="Discord.Net" Version="2.4.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||||
<PackageReference Include="Npgsql" Version="3.2.7" />
|
<PackageReference Include="Npgsql" Version="5.0.10" />
|
||||||
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
|
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue