-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: processorの分割 (WIP) * feat: add reply, sticker test * feat: add inline voice, markdown format test * feat: add more markdown format test * chore: add todo * feat: add mention to channel, user, role test * chore: うまくいかない attachment download test * chore: remove attachment test * test: add replaceMessageUrl, replaceChannelUrl, replaceEventDirectUrl * test: add replaceTweetUrl * test: add replaceEmoji, replaceInviteUrl, replaceSteamAppUrl, replaceYouTubeUrl, replaceYouTubePlaylistUrl, replaceGoogleSearchUrl, replaceUrl * chore: コメントとか追加 * test: テストケース名の変更。関数のみ記載だった箇所は明確化し、文とするため末尾にピリオドを追加 * fix: Narrator.process内の処理をforからfold文に変更 * fix: isImmediatelyをisImmediatelyReadに変更 * fix: isImmediateReadに変更 * fix: shouldIgnoreOnをまとめた * Update src/test/kotlin/SteamTest.kt Co-authored-by: yuuaHP <[email protected]> * Update src/test/kotlin/TwitterTest.kt Co-authored-by: yuuaHP <[email protected]> * Update src/test/kotlin/TwitterTest.kt Co-authored-by: yuuaHP <[email protected]> * Update src/test/kotlin/TwitterTest.kt Co-authored-by: yuuaHP <[email protected]> * Apply suggestions from code review Co-authored-by: yuuaHP <[email protected]> * fix: fileとattachmentの混在をattachmentに寄せる * Apply suggestions from code review Co-authored-by: yuuaHP <[email protected]> * fix: ignoreのtestでbefore, afterでcontextを分割 * Apply suggestions from code review Co-authored-by: yuuaHP <[email protected]> * Apply suggestions from code review Co-authored-by: yuuaHP <[email protected]> * Apply suggestions from code review Co-authored-by: yuuaHP <[email protected]> * Apply suggestions from code review Co-authored-by: yuuaHP <[email protected]> * fix: テスト後フォルダ削除処理の修正 * chore: レビューを受けたテストケース名の更新 --------- Co-authored-by: yuuaHP <[email protected]>
- Loading branch information
Showing
37 changed files
with
2,536 additions
and
464 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.jaoafa.vcspeaker | ||
|
||
object StringUtils { | ||
fun String.substringByCodePoints(start: Int, end: Int): String { | ||
val codePoints = codePoints().toArray() | ||
return String(codePoints.copyOfRange(start, end), 0, end - start) | ||
} | ||
|
||
fun String.lengthByCodePoints(): Long { | ||
return codePoints().count() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.jaoafa.vcspeaker.features | ||
|
||
import com.jaoafa.vcspeaker.stores.IgnoreStore | ||
import com.jaoafa.vcspeaker.stores.IgnoreType | ||
import dev.kord.common.entity.Snowflake | ||
|
||
object Ignore { | ||
fun String.shouldIgnoreOn(guildId: Snowflake) = | ||
IgnoreStore.filter(guildId).any { | ||
when (it.type) { | ||
IgnoreType.Equals -> this == it.search | ||
IgnoreType.Contains -> contains(it.search) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/kotlin/com/jaoafa/vcspeaker/tts/processors/BaseProcessor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.jaoafa.vcspeaker.tts.processors | ||
|
||
import com.jaoafa.vcspeaker.tts.Voice | ||
import dev.kord.core.entity.Message | ||
|
||
/** | ||
* メッセージを処理する基底クラス | ||
*/ | ||
abstract class BaseProcessor { | ||
abstract val priority: Int | ||
private var isCancelled: Boolean = false | ||
private var isImmediateRead: Boolean = false | ||
|
||
abstract suspend fun process(message: Message?, content: String, voice: Voice): Pair<String, Voice> | ||
|
||
fun isCancelled() = isCancelled | ||
fun isImmediately() = isImmediateRead | ||
|
||
fun cancel() { | ||
isCancelled = true | ||
} | ||
|
||
fun immediateRead() { | ||
isImmediateRead = true | ||
} | ||
} |
Oops, something went wrong.