mirror of
https://github.com/NoiTheCat/BirthdayBot.git
synced 2024-11-21 21:54:36 +00:00
Escape formatting strings when building announcement name list
This commit is contained in:
parent
9d1a7e11f6
commit
2206c3a399
1 changed files with 14 additions and 2 deletions
|
@ -203,10 +203,22 @@ Class BackgroundWorker
|
|||
|
||||
Private Function BirthdayAnnounceFormatName(member As SocketGuildUser) As String
|
||||
' TODO add option for using pings instead, add handling for it here
|
||||
Dim escapeFormattingCharacters = Function(input As String) As String
|
||||
Dim result As New StringBuilder
|
||||
For Each c As Char In input
|
||||
If c = "\" Or c = "_" Or c = "~" Or c = "*" Then
|
||||
result.Append("\")
|
||||
End If
|
||||
result.Append(c)
|
||||
Next
|
||||
Return result.ToString()
|
||||
End Function
|
||||
|
||||
Dim username = escapeFormattingCharacters(member.Username)
|
||||
If member.Nickname IsNot Nothing Then
|
||||
Return $"**{member.Nickname}** ({member.Username}#{member.Discriminator})"
|
||||
Return $"**{escapeFormattingCharacters(member.Nickname)}** ({username}#{member.Discriminator})"
|
||||
End If
|
||||
Return $"**{member.Username}**#{member.Discriminator}"
|
||||
Return $"**{username}**#{member.Discriminator}"
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
|
|
Loading…
Reference in a new issue