Update dependencies; fix resulting issues

This commit is contained in:
Noikoio 2019-08-29 23:47:38 -07:00
parent 5ad193c059
commit 92f4c42b5b
5 changed files with 27 additions and 22 deletions

View file

@ -4,7 +4,7 @@
<OutputType>Exe</OutputType>
<RootNamespace>BirthdayBot</RootNamespace>
<TargetFramework>netcoreapp2.0</TargetFramework>
<Version>1.1.1</Version>
<Version>1.1.2</Version>
<Authors>Noiiko</Authors>
<Company />
<Description>Discord bot for birthday reminders.</Description>
@ -26,10 +26,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Discord.Net" Version="2.0.1" />
<PackageReference Include="Discord.Net" Version="2.1.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="NodaTime" Version="2.4.5" />
<PackageReference Include="Npgsql" Version="3.2.7" />
<PackageReference Include="NodaTime" Version="2.4.6" />
<PackageReference Include="Npgsql" Version="4.0.9" />
</ItemGroup>
</Project>

View file

@ -212,8 +212,8 @@ Friend Class GuildStateInformation
Using c = db.CreateCommand()
c.CommandText = $"select * from {BackingTableBans} " +
"where guild_id = @Gid and user_id = @Uid"
c.Parameters.Add("@Gid", NpgsqlDbType.Bigint).Value = GuildId
c.Parameters.Add("@Uid", NpgsqlDbType.Bigint).Value = userId
c.Parameters.Add("@Gid", NpgsqlDbType.Bigint).Value = CLng(GuildId)
c.Parameters.Add("@Uid", NpgsqlDbType.Bigint).Value = CLng(userId)
c.Prepare()
Using r = Await c.ExecuteReaderAsync()
If Await r.ReadAsync() Then Return True
@ -245,8 +245,8 @@ Friend Class GuildStateInformation
c.CommandText = $"insert into {BackingTableBans} (guild_id, user_id) " +
"values (@Gid, @Uid) " +
"on conflict (guild_id, user_id) do nothing"
c.Parameters.Add("@Gid", NpgsqlDbType.Bigint).Value = GuildId
c.Parameters.Add("@Uid", NpgsqlDbType.Bigint).Value = userId
c.Parameters.Add("@Gid", NpgsqlDbType.Bigint).Value = CLng(GuildId)
c.Parameters.Add("@Uid", NpgsqlDbType.Bigint).Value = CLng(userId)
c.Prepare()
Await c.ExecuteNonQueryAsync()
End Using
@ -261,8 +261,8 @@ Friend Class GuildStateInformation
Using c = db.CreateCommand()
c.CommandText = $"delete from {BackingTableBans} where " +
"guild_id = @Gid and user_id = @Uid"
c.Parameters.Add("@Gid", NpgsqlDbType.Bigint).Value = GuildId
c.Parameters.Add("@Uid", NpgsqlDbType.Bigint).Value = userId
c.Parameters.Add("@Gid", NpgsqlDbType.Bigint).Value = CLng(GuildId)
c.Parameters.Add("@Uid", NpgsqlDbType.Bigint).Value = CLng(userId)
c.Prepare()
Await c.ExecuteNonQueryAsync()
End Using
@ -349,7 +349,7 @@ Friend Class GuildStateInformation
' Take note of ordinals for use in the constructor
c.CommandText = "select guild_id, role_id, channel_announce_id, time_zone, moderated, moderator_role, announce_message, announce_message_pl, announce_ping " +
$"from {BackingTable} where guild_id = @Gid"
c.Parameters.Add("@Gid", NpgsqlDbType.Bigint).Value = guild
c.Parameters.Add("@Gid", NpgsqlDbType.Bigint).Value = CLng(guild)
c.Prepare()
Using r = Await c.ExecuteReaderAsync()
If Await r.ReadAsync() Then
@ -361,7 +361,7 @@ Friend Class GuildStateInformation
' If we got here, no row exists. Create it.
Using c = db.CreateCommand()
c.CommandText = $"insert into {BackingTable} (guild_id) values (@Gid)"
c.Parameters.Add("@Gid", NpgsqlDbType.Bigint).Value = guild
c.Parameters.Add("@Gid", NpgsqlDbType.Bigint).Value = CLng(guild)
c.Prepare()
Await c.ExecuteNonQueryAsync()
End Using
@ -387,17 +387,17 @@ Friend Class GuildStateInformation
"announce_message_pl = @AnnounceMsgPl, " +
"announce_ping = @AnnouncePing " +
"where guild_id = @Gid"
c.Parameters.Add("@Gid", NpgsqlDbType.Bigint).Value = GuildId
c.Parameters.Add("@Gid", NpgsqlDbType.Bigint).Value = CLng(GuildId)
With c.Parameters.Add("@RoleId", NpgsqlDbType.Bigint)
If RoleId.HasValue Then
.Value = RoleId.Value
.Value = CLng(RoleId.Value)
Else
.Value = DBNull.Value
End If
End With
With c.Parameters.Add("@ChannelId", NpgsqlDbType.Bigint)
If _announceCh.HasValue Then
.Value = _announceCh.Value
.Value = CLng(_announceCh.Value)
Else
.Value = DBNull.Value
End If
@ -412,7 +412,7 @@ Friend Class GuildStateInformation
c.Parameters.Add("@Moderated", NpgsqlDbType.Boolean).Value = _moderated
With c.Parameters.Add("@ModRole", NpgsqlDbType.Bigint)
If ModeratorRole.HasValue Then
.Value = ModeratorRole.Value
.Value = CLng(ModeratorRole.Value)
Else
.Value = DBNull.Value
End If

View file

@ -73,8 +73,8 @@ Class GuildUserSettings
c.CommandText = $"insert into {BackingTable} " +
"(guild_id, user_id, birth_month, birth_day, time_zone) values " +
"(@Gid, @Uid, @Month, @Day, @Tz)"
c.Parameters.Add("@Gid", NpgsqlDbType.Bigint).Value = GuildId
c.Parameters.Add("@Uid", NpgsqlDbType.Bigint).Value = UserId
c.Parameters.Add("@Gid", NpgsqlDbType.Bigint).Value = CLng(GuildId)
c.Parameters.Add("@Uid", NpgsqlDbType.Bigint).Value = CLng(UserId)
c.Parameters.Add("@Month", NpgsqlDbType.Numeric).Value = month
c.Parameters.Add("@Day", NpgsqlDbType.Numeric).Value = day
With c.Parameters.Add("@Tz", NpgsqlDbType.Text)
@ -112,8 +112,8 @@ Class GuildUserSettings
Using c = dbconn.CreateCommand()
c.CommandText = $"delete from {BackingTable}" +
" where guild_id = @Gid and user_id = @Uid"
c.Parameters.Add("@Gid", NpgsqlDbType.Bigint).Value = GuildId
c.Parameters.Add("@Uid", NpgsqlDbType.Bigint).Value = UserId
c.Parameters.Add("@Gid", NpgsqlDbType.Bigint).Value = CLng(GuildId)
c.Parameters.Add("@Uid", NpgsqlDbType.Bigint).Value = CLng(UserId)
c.Prepare()
Await c.ExecuteNonQueryAsync()
End Using
@ -145,7 +145,7 @@ Class GuildUserSettings
' Take note of ordinals for use in the constructor
c.CommandText = "select guild_id, user_id, birth_month, birth_day, time_zone " +
$"from {BackingTable} where guild_id = @Gid"
c.Parameters.Add("@Gid", NpgsqlDbType.Bigint).Value = guildId
c.Parameters.Add("@Gid", NpgsqlDbType.Bigint).Value = CLng(guildId)
c.Prepare()
Using r = c.ExecuteReader()
Dim result As New List(Of GuildUserSettings)

View file

@ -53,6 +53,11 @@ Module Program
If arg.Severity <= LogSeverity.Info Then
Log("Discord.Net", $"{arg.Severity}: {arg.Message}")
End If
If arg.Exception IsNot Nothing Then
Log("Discord.Net", arg.Exception.ToString())
End If
Return Task.CompletedTask
End Function

View file

@ -135,7 +135,7 @@ Class ListingCommands
Using c = db.CreateCommand()
c.CommandText = "select user_id, birth_month, birth_day from " + GuildUserSettings.BackingTable +
" where guild_id = @Gid order by birth_month, birth_day"
c.Parameters.Add("@Gid", NpgsqlTypes.NpgsqlDbType.Bigint).Value = guild.Id
c.Parameters.Add("@Gid", NpgsqlTypes.NpgsqlDbType.Bigint).Value = CLng(guild.Id)
c.Prepare()
Using r = Await c.ExecuteReaderAsync()
Dim result As New List(Of ListItem)