Skip to content

Commit

Permalink
feat: dirty words
Browse files Browse the repository at this point in the history
  • Loading branch information
SiongSng committed Jul 11, 2023
1 parent edf4f5b commit a86cccc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/handler/universe_chat_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,15 @@ class UniverseChatHandler {
}

Future<void> sendMessage(UniverseChatMessage msg, {Function? ack}) async {
const List<String> dirtyWords = ["傻逼", "屁事"];

bool phishing = await ScamDetection.detectionWithBool(msg.message);
bool isDirtyWord =
dirtyWords.firstWhereOrNull((word) => msg.message.contains(word)) !=
null;

/// Detect phishing
if (phishing) {
if (phishing || isDirtyWord) {
return ack?.call(json.encode({
'status': 'phishing',
}));
Expand Down

0 comments on commit a86cccc

Please sign in to comment.