Created
March 25, 2023 14:43
-
-
Save alexgleason/5c2d084434fa0875397f44da198f4352 to your computer and use it in GitHub Desktop.
strfry American Policy (example)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { Policy } from 'https://gitlab.com/soapbox-pub/strfry-policies/-/blob/develop/mod.ts'; | |
/** Only American English is allowed. */ | |
const americanPolicy: Policy<void> = (msg) => { | |
const { content } = msg.event; | |
const words = [ | |
'armour', | |
'behaviour', | |
'colour', | |
'favourite', | |
'flavour', | |
'honour', | |
'humour', | |
'rumour', | |
]; | |
const isBritish = words.some((word) => content.toLowerCase().includes(word)); | |
if (isBritish) { | |
return { | |
id: msg.event.id, | |
action: 'reject', | |
msg: 'Sorry, only American English is allowed on this server!', | |
}; | |
} else { | |
return { | |
id: msg.event.id, | |
action: 'accept', | |
msg: '', | |
}; | |
} | |
}; | |
export default americanPolicy; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment