diff --git a/BirthdayBot/BirthdayBot.vbproj b/BirthdayBot/BirthdayBot.vbproj
index e47746c..3738fc6 100644
--- a/BirthdayBot/BirthdayBot.vbproj
+++ b/BirthdayBot/BirthdayBot.vbproj
@@ -4,7 +4,7 @@
Exe
BirthdayBot
netcoreapp2.0
- 1.3.1
+ 1.3.2
Noiiko
Discord bot for birthday reminders.
diff --git a/BirthdayBot/UserInterface/HelpInfoCommands.vb b/BirthdayBot/UserInterface/HelpInfoCommands.vb
index c1e3a33..5b5fa0a 100644
--- a/BirthdayBot/UserInterface/HelpInfoCommands.vb
+++ b/BirthdayBot/UserInterface/HelpInfoCommands.vb
@@ -43,7 +43,9 @@ Friend Class HelpInfoCommands
$"{cpfx}zone (zone)`" + vbLf +
$" » Sets your local time zone. See `{CommandPrefix}help-tzdata`." + vbLf +
$"{cpfx}remove`" + vbLf +
- $" » Removes your birthday information from this bot."
+ $" » Removes your birthday information from this bot." + vbLf +
+ $"{cpfx}when (user)`" + vbLf +
+ $" » Displays birthday information of the given user."
}
Dim cmdModField As New EmbedFieldBuilder With {
.Name = "Moderator-only commands",
diff --git a/BirthdayBot/UserInterface/UserCommands.vb b/BirthdayBot/UserInterface/UserCommands.vb
index fb104b4..3eb3ca1 100644
--- a/BirthdayBot/UserInterface/UserCommands.vb
+++ b/BirthdayBot/UserInterface/UserCommands.vb
@@ -9,7 +9,8 @@ Class UserCommands
Return New List(Of (String, CommandHandler)) From {
("set", AddressOf CmdSet),
("zone", AddressOf CmdZone),
- ("remove", AddressOf CmdRemove)
+ ("remove", AddressOf CmdRemove),
+ ("when", AddressOf CmdWhen)
}
End Get
End Property
@@ -162,4 +163,50 @@ Class UserCommands
Await reqChannel.SendMessageAsync(":white_check_mark: Your information has been removed.")
End If
End Function
+
+ Private Async Function CmdWhen(param As String(), reqChannel As SocketTextChannel, reqUser As SocketGuildUser) As Task
+ ' Requires a parameter
+ If param.Count = 1 Then
+ Await reqChannel.SendMessageAsync(GenericError)
+ Return
+ End If
+
+ Dim search = param(1)
+ If param.Count = 3 Then
+ ' param maxes out at 3 values. param(2) might contain part of the search string (if name has a space)
+ search += " " + param(2)
+ End If
+
+ Dim searchTarget As SocketGuildUser = Nothing
+
+ Dim searchId As ULong = 0
+ If Not TryGetUserId(search, searchId) Then ' ID lookup
+ ' name lookup without discriminator
+ For Each searchuser In reqChannel.Guild.Users
+ If String.Equals(search, searchuser.Username, StringComparison.OrdinalIgnoreCase) Then
+ searchTarget = searchuser
+ Exit For
+ End If
+ Next
+ Else
+ searchTarget = reqChannel.Guild.GetUser(searchId)
+ End If
+ If searchTarget Is Nothing Then
+ Await reqChannel.SendMessageAsync(BadUserError)
+ Return
+ End If
+
+ Dim users = Instance.GuildCache(reqChannel.Guild.Id).Users
+ Dim searchTargetData = users.FirstOrDefault(Function(u) u.UserId = searchTarget.Id)
+ If searchTargetData Is Nothing Then
+ Await reqChannel.SendMessageAsync("The given user does not exist or has not set a birthday.")
+ Return
+ End If
+
+ With searchTargetData
+ Await reqChannel.SendMessageAsync(FormatName(searchTarget, False) + ": " +
+ $"`{ .BirthDay.ToString("00")}-{Common.MonthNames(.BirthMonth)}`" +
+ If(.TimeZone Is Nothing, "", $" - `{ .TimeZone}`"))
+ End With
+ End Function
End Class