Intro to the profanity filter function
Overview
The AccelByte Gaming Services (AGS) Extend service provides custom logic for different requirements for profanity filters, which you can use to filter user-generated content from across various features.
This article presents the contract of the customization with an example code of the Validate
function, which is a unary function and the only function in the contract.
service ProfanityFilterService {
rpc Validate(ExtendProfanityValidationRequest) returns (ExtendProfanityValidationResponse);
}
Validate
Validate
is called when a user's generated content needs to be validated.
- Go
- C#
- Java
- Python
In the app, the following function can be found in pkg/server/grpcserver.go
.
func (server *ProfanityFilterServer) Validate(ctx context.Context, request *registered_v1.ExtendProfanityValidationRequest) (*registered_v1.ExtendProfanityValidationResponse, error) {
...
}
In the app, the following function can be found in src/AccelByte.PluginArch.ProfanityFilter.Demo.Server/Services/ProfanityFilterServiceImpl.cs
.
public override Task<ExtendProfanityValidationResponse> Validate(ExtendProfanityValidationRequest request, ServerCallContext context)
{
...
}
In the app, the following function can be found in src/main/java/net/accelbyte/profanity/filter/service/ProfanityFilterService.java
.
@Override
public void validate(ExtendProfanityValidationRequest request, StreamObserver<ExtendProfanityValidationResponse> responseObserver) {
...
}
In the app, the following function can be found in src/app/services/profanity_service.py
.
async def Validate(self, request, context):
...