Skip to content

Commit

Permalink
Мелоч
Browse files Browse the repository at this point in the history
  • Loading branch information
Spliterash committed Jan 29, 2024
1 parent 50264c7 commit 0f19fc0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ data class Attachment(
@JsonProperty("wall") val wall: SomethingWithAttachments?,
@JsonProperty("wall_reply") val wallReply: SomethingWithAttachments?,
@JsonProperty("story") val story: VkStory?,
@JsonProperty("type") val type: Type
@JsonProperty("type") val type: Type?
) {
enum class Type {
@JsonProperty("video")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ru.spliterash.vkVideoUnlocker.longpoll.message.Attachment

data class SomethingWithAttachments(
@JsonProperty("attachments")
val attachments: List<Attachment>
val attachments: List<Attachment> = listOf()
) : AttachmentContainer, AttachmentContent {
override fun containers(): List<AttachmentContainer> = listOf()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class TiktokChain(
private val tiktokService: TiktokService,
private val messageScanner: MessageScanner,
) : MessageHandler {
private val pattern = Pattern.compile("https?://(?:www|vt)?\\.tiktok.com/(?:@\\w+/video/(?:(?<id>\\d+))|\\w+)")
private val pattern = Pattern.compile("https?://(?:\\w+)?\\.tiktok.com/(?:@\\w+/video/(?:(?<id>\\d+))|\\w+)")
override suspend fun handle(message: RootMessage, editableMessage: EditableMessage): Boolean {
val videoUrl = messageScanner.scanForText(message) {
val matcher = pattern.matcher(it)
Expand Down

0 comments on commit 0f19fc0

Please sign in to comment.