strfry-policies/entrypoint.example.ts

27 lines
644 B
TypeScript
Raw Normal View History

2023-03-24 19:36:11 +00:00
#!/bin/sh
//bin/true; exec deno run -A "$0" "$@"
import {
antiDuplicationPolicy,
hellthreadPolicy,
2023-03-26 21:40:35 +00:00
keywordPolicy,
noopPolicy,
pipeline,
2023-03-26 20:37:24 +00:00
pubkeyBanPolicy,
rateLimitPolicy,
readStdin,
writeStdout,
} from './mod.ts';
2023-03-24 19:36:11 +00:00
for await (const msg of readStdin()) {
const result = await pipeline(msg, [
noopPolicy,
[hellthreadPolicy, { limit: 100 }],
[antiDuplicationPolicy, { ttl: 60000, minLength: 50 }],
[rateLimitPolicy, { whitelist: ['127.0.0.1'] }],
2023-03-26 20:37:24 +00:00
[pubkeyBanPolicy, ['e810fafa1e89cdf80cced8e013938e87e21b699b24c8570537be92aec4b12c18']],
2023-03-26 21:40:35 +00:00
[keywordPolicy, ['https://t.me/']],
]);
writeStdout(result);
}