[fix] Cleaned up and fixed DiscordNotifsCommand regex (#1814)

*it was the 2*
This commit is contained in:
Dewy 2021-01-09 18:10:28 +00:00
parent b6f9b19009
commit b6327e5dc4
No known key found for this signature in database
GPG Key ID: 7E581A0C01213971
1 changed files with 4 additions and 2 deletions

View File

@ -10,17 +10,18 @@ object DiscordNotifsCommand : ClientCommand(
name = "discordnotifs",
alias = arrayOf("webhook")
) {
private val urlRegex = Regex("^https://.*discord\\.com/api/webhooks/([0-9])+/.{68}$2")
private val urlRegex = Regex("^https://.*discord\\.com/api/webhooks/\\d+/.{68}")
init {
literal("id") {
long("discord user id") { idArg ->
execute("Set the ID of the user to be pinged") {
DiscordNotifs.pingID.value = idArg.value.toString()
MessageSendHelper.sendChatMessage(urlRegex.matches("https://ptb.discord.com/api/webhooks/791291547592687626/ZcYa1pdaOcgTMzimKePOyxieuVj8abDBMDBEtg30npXHryIa0NEGCwxTYXS9AOKUbggB").toString())
MessageSendHelper.sendChatMessage("Set Discord User ID to ${formatValue(idArg.value.toString())}!")
}
}
}
literal("avatar") {
@ -39,6 +40,7 @@ object DiscordNotifsCommand : ClientCommand(
formatValue(urlArg.value) +
" does not match the valid webhook format!"
)
return@execute
}