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

View file

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

View file

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

View file

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

View file

@ -135,7 +135,7 @@ Class ListingCommands
Using c = db.CreateCommand() Using c = db.CreateCommand()
c.CommandText = "select user_id, birth_month, birth_day from " + GuildUserSettings.BackingTable + c.CommandText = "select user_id, birth_month, birth_day from " + GuildUserSettings.BackingTable +
" where guild_id = @Gid order by birth_month, birth_day" " 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() c.Prepare()
Using r = Await c.ExecuteReaderAsync() Using r = Await c.ExecuteReaderAsync()
Dim result As New List(Of ListItem) Dim result As New List(Of ListItem)