diff --git a/BirthdayBot/BirthdayBot.vbproj b/BirthdayBot/BirthdayBot.vbproj index 4dae6a0..338ac7c 100644 --- a/BirthdayBot/BirthdayBot.vbproj +++ b/BirthdayBot/BirthdayBot.vbproj @@ -4,7 +4,7 @@ Exe BirthdayBot netcoreapp2.0 - 1.1.1 + 1.1.2 Noiiko Discord bot for birthday reminders. @@ -26,10 +26,10 @@ - + - - + + diff --git a/BirthdayBot/Data/GuildStateInformation.vb b/BirthdayBot/Data/GuildStateInformation.vb index 0eeeb6a..48ae930 100644 --- a/BirthdayBot/Data/GuildStateInformation.vb +++ b/BirthdayBot/Data/GuildStateInformation.vb @@ -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 diff --git a/BirthdayBot/Data/GuildUserSettings.vb b/BirthdayBot/Data/GuildUserSettings.vb index d86d573..2b79ca3 100644 --- a/BirthdayBot/Data/GuildUserSettings.vb +++ b/BirthdayBot/Data/GuildUserSettings.vb @@ -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) diff --git a/BirthdayBot/Program.vb b/BirthdayBot/Program.vb index 60c341d..bdde3a6 100644 --- a/BirthdayBot/Program.vb +++ b/BirthdayBot/Program.vb @@ -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 diff --git a/BirthdayBot/UserInterface/ListingCommands.vb b/BirthdayBot/UserInterface/ListingCommands.vb index eb8c1c6..d0869f0 100644 --- a/BirthdayBot/UserInterface/ListingCommands.vb +++ b/BirthdayBot/UserInterface/ListingCommands.vb @@ -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)