fix
This commit is contained in:
parent
63c11f78ea
commit
042e452540
4
block.sh
Executable file
4
block.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
HEX=$(nak decode $1 | jq ".pubkey" | sed 's/"//i' | sed 's/"//i')
|
||||
echo "Adding $1 to block list"
|
||||
sed -i "30a '$HEX'," /opt/strfry-policies/strfry-policy.ts
|
53
src/policies/emoji.ts
Normal file
53
src/policies/emoji.ts
Normal file
@ -0,0 +1,53 @@
|
||||
import { Policy } from '../types.ts';
|
||||
|
||||
/**
|
||||
* Reject events whose content matches the regex.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* // Ban events matching a regex.
|
||||
* regexPolicy(msg, /(🟠|🔥|😳)ChtaGPT/i);
|
||||
* ```
|
||||
*/
|
||||
const emoji: Policy<RegExp> = ({ event: { id, content } }) => {
|
||||
|
||||
var fire_count = (content.match(/🔥/g) || []).length;
|
||||
var rainbow_count = (content.match(/🌈/g) || []).length;
|
||||
var happy_count = (content.match(/😀/g) || []).length;
|
||||
var hundred_count = (content.match(/💯/g) || []).length;
|
||||
var party_count = (content.match(/🎉/g) || []).length;
|
||||
var limit = 1;
|
||||
|
||||
|
||||
if ( happy_count > 0 && happy_count > 0 && fire_count > 0 ) {
|
||||
return {
|
||||
id,
|
||||
action: 'reject',
|
||||
msg: 'ReplyGuy Dual Emoji Policy: Blocked!',
|
||||
};
|
||||
}
|
||||
|
||||
if ( happy_count > 0 && fire_count > 0 ) {
|
||||
return {
|
||||
id,
|
||||
action: 'reject',
|
||||
msg: 'ReplyGuy Dual Emoji Policy: Blocked!',
|
||||
};
|
||||
}
|
||||
|
||||
if (hundred_count > limit || happy_count > limit || fire_count > limit || rainbow_count > limit ) {
|
||||
return {
|
||||
id,
|
||||
action: 'reject',
|
||||
msg: 'ReplyGuy Emoji Policy: Blocked!',
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
id,
|
||||
action: 'accept',
|
||||
msg: '',
|
||||
};
|
||||
};
|
||||
|
||||
export default emoji;
|
Loading…
Reference in New Issue
Block a user