Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
srvpro2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
srvpro2
Commits
502e7220
Commit
502e7220
authored
Feb 20, 2026
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add msg length check
parent
7af8dcc4
Pipeline
#43343
passed with stages
in 3 minutes and 55 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
3 deletions
+27
-3
src/constants/trans.ts
src/constants/trans.ts
+2
-0
src/feats/chat-length-check.ts
src/feats/chat-length-check.ts
+20
-0
src/feats/feats-module.ts
src/feats/feats-module.ts
+2
-0
src/feats/resource/badword-provider.ts
src/feats/resource/badword-provider.ts
+3
-3
No files found.
src/constants/trans.ts
View file @
502e7220
...
...
@@ -101,6 +101,7 @@ export const TRANSLATIONS = {
refresh_success
:
'
Refresh field succeeded.
'
,
refresh_fail
:
'
Refresh field failed.
'
,
chat_disabled
:
'
Chat is disabled in this room.
'
,
chat_warn_level0
:
'
WARNING: Please stop sending inappropriate messages.
'
,
chat_warn_level1
:
'
Please avoid sensitive words.
'
,
chat_warn_level2
:
'
Your message contains blocked words.
'
,
menu_random_duel
:
'
Random Duel
'
,
...
...
@@ -271,6 +272,7 @@ export const TRANSLATIONS = {
refresh_success
:
'
刷新场面成功。
'
,
refresh_fail
:
'
刷新场面失败。
'
,
chat_disabled
:
'
本房间禁止聊天。
'
,
chat_warn_level0
:
'
请不要发送过长的消息或垃圾信息!
'
,
chat_warn_level1
:
'
请注意发言,敏感词已被替换。
'
,
chat_warn_level2
:
'
消息包含敏感词,已被拦截。
'
,
menu_random_duel
:
'
随机对战
'
,
...
...
src/feats/chat-length-check.ts
0 → 100644
View file @
502e7220
import
{
ChatColor
,
YGOProCtosChat
}
from
'
ygopro-msg-encode
'
;
import
{
Context
}
from
'
../app
'
;
export
class
ChatLengthCheck
{
constructor
(
private
ctx
:
Context
)
{}
async
init
()
{
this
.
ctx
.
middleware
(
YGOProCtosChat
,
async
(
msg
,
client
,
next
)
=>
{
const
content
=
(
msg
.
msg
||
''
).
trim
();
if
(
content
.
length
<=
0
)
{
return
;
}
if
(
content
.
length
>
100
)
{
await
client
.
sendChat
(
'
#{chat_warn_level0}
'
,
ChatColor
.
RED
);
return
;
}
return
next
();
});
}
}
src/feats/feats-module.ts
View file @
502e7220
...
...
@@ -12,6 +12,7 @@ import { ClientKeyProvider } from './client-key-provider';
import
{
HidePlayerNameProvider
}
from
'
./hide-player-name-provider
'
;
import
{
CommandsService
,
KoishiContextService
}
from
'
../koishi
'
;
import
{
ChatgptService
}
from
'
./chatgpt-service
'
;
import
{
ChatLengthCheck
}
from
'
./chat-length-check
'
;
import
{
CloudReplayService
}
from
'
./cloud-replay
'
;
import
{
LpLowHintService
}
from
'
./lp-low-hint-service
'
;
import
{
LockDeckService
}
from
'
./lock-deck
'
;
...
...
@@ -32,6 +33,7 @@ export const FeatsModule = createAppContext()
.
provide
(
CloudReplayService
)
// persist duel records
.
provide
(
BlockReplay
)
// block replay packets for in-room players
.
provide
(
ChatgptService
)
// AI-room chat replies
.
provide
(
ChatLengthCheck
)
// block blank/overlong chat messages
.
provide
(
LpLowHintService
)
// low LP hint in duel
.
provide
(
RoomDeathService
)
// srvpro-style death mode (model 2)
.
provide
(
RoomAutoDeathService
)
// auto trigger death mode after duel start
...
...
src/feats/resource/badword-provider.ts
View file @
502e7220
...
...
@@ -92,11 +92,11 @@ export class BadwordProvider extends BaseResourceProvider<BadwordsData> {
if
(
filtered
.
blocked
)
{
await
client
.
sendChat
(
'
#{chat_warn_level2}
'
,
ChatColor
.
RED
);
return
;
}
if
(
filtered
.
message
!==
msg
.
msg
)
{
}
else
if
(
filtered
.
message
!==
msg
.
msg
)
{
msg
.
msg
=
filtered
.
message
;
await
client
.
sendChat
(
'
#{chat_warn_level1}
'
,
ChatColor
.
BABYBLUE
);
}
else
if
(
filtered
.
level
===
0
)
{
await
client
.
sendChat
(
'
#{chat_warn_level0}
'
,
ChatColor
.
BABYBLUE
);
}
return
next
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment