Back to blog

Telegram profanity filters: set a language policy without silencing members

Choose a profanity dictionary, test quotations and multilingual false positives, understand deletion versus sanctions, and recover from mistakes in Defendy.

Imagine a hobby group where someone quotes an abusive message to report it. The profanity bot removes the report. A different member posts a cutting, personal insult without using a prohibited word, and nothing happens. The dictionary may be doing exactly what it was configured to do. The moderation policy still needs work.

A profanity filter is useful when particular language is out of bounds regardless of the speaker's intention. It cannot, by itself, enforce a rule such as “treat other people respectfully.” In Defendy, dictionary selection, exceptions, message deletion and member sanctions are separate decisions. Make them in that order, with a way for a person to review mistakes.

Decide what a match should mean

For a public workshop group, a straightforward policy might be: no profanity in the shared conversation, including quoted profanity; send reports privately to the designated moderator. In an informal gaming group, the same blanket rule might erase ordinary conversation while missing targeted harassment.

Those are hypothetical communities, not customer case studies. The useful distinction is between a language rule and a behavior rule:

  • A language rule says which words cannot appear in the shared space.
  • A behavior rule considers who is being targeted, repetition, context and the effect on the conversation.
  • A reporting rule explains how someone can show a moderator what happened without republishing it publicly.

Write all three where members can find them. Do not make reporting abuse depend on repeatedly posting a message the bot will delete. For the behavioral side, use the separate guide to hostility and human moderation.

Dictionaries are not sensitivity levels

Open the profanity filter in Defendy's Mini App and you will find three dictionary modes:

System uses the supplied dictionary. Custom uses entries you add for this group. Combined uses both and is the initial dictionary mode. An empty custom list does not secretly fall back to the system dictionary.

These options are not mild, medium and strict toxicity settings. They decide which entries are searched for. Neither the mode names nor the presence of a system dictionary establishes complete coverage of your group's languages.

The current matcher normalizes text before searching, including lowercasing, selected character substitutions and removal of some punctuation. It then checks word boundaries. This is not a literal search through the untouched message, nor a language model interpreting the conversation. A form with different endings, unusual spacing or a different script may behave differently from the base entry.

For an international community, collect ordinary names, technical terms and permitted expressions in each language alongside actual prohibited examples. Have someone who knows the language assess the intended results. Importing a large unfamiliar list is a policy decision you cannot review simply by checking that the upload succeeded.

Defendy's separate stop-word filter has its own matching modes and custom-condition syntax. Do not assume those controls or expressions work in the profanity dictionary.

An exception is broader than “allow this quotation”

The implementation subtracts normalized exception entries from the prohibited dictionary. An exception does not mean “permit this term only when quoting a book,” “ignore reports” or “let teachers use it.”

Here is a deliberately harmless example. Add testtoken to a custom dictionary in a test group. It should become a matching entry. Add the same marker to exceptions, and that entry is removed from consideration wherever it appears. Other prohibited entries in the same message can still match.

Conversely, adding an entire permitted sentence to exceptions does not create a contextual exemption for a shorter prohibited entry inside that sentence. The dictionary entry has to be the one excluded. If a term is unacceptable as an insult but acceptable in an ordinary discussion, a global exception may be too broad and a global ban too blunt. Leave that distinction to human moderation or change the policy.

Read the defaults before enabling anything

A new profanity module starts disabled. Its initial configuration nevertheless has message deletion on, media-text checking on, a combined dictionary and member action None. Enabling the module can therefore start deleting matched messages without issuing a warning.

“None” means no selected warning, mute, kick or ban from this action setting. It does not turn deletion off. Nor is it a promise of zero side effects elsewhere: if the group separately enables automatic reputation penalties, a deletion can feed that mechanism.

The opposite combination also matters. Turning deletion off does not turn a configured warning or mute off. A warning can cross an existing threshold and trigger a stronger consequence; review the warning system and the test member's existing points before trying it.

Changing the action type resets the shared duration control to zero. Where an action supports an indefinite duration, zero must not be read as “disabled.” Choose and verify a finite duration after selecting a temporary mute or ban. There is no reason to use either while checking whether the dictionary matches the right text.

A test that separates matching from punishment

Use a separate group and disposable messages. Do not experiment on a member's only copy of a useful explanation.

  1. Open @defendy_bot, choose Settings, select the test group and check its name at the top.
  2. Open the profanity filter. Enable it there, select None as the member action and deliberately choose whether your test will delete messages.
  3. Select Custom and add the harmless marker testtoken. Save in the add-entry form.
  4. Reopen the section to verify the saved list, mode and settings. Switches and selectors save when changed; a form with a Save button needs that button.
  5. Send the test set from a regular participant without filter immunity. Telegram administrators are skipped by Defendy's automatic moderation, and some Defendy roles separately grant immunity. Testing only from your admin account can produce a misleading pass.
  6. Replace the marker with the real policy entries and repeat the checks. Remove the marker and temporary exceptions when finished.

If you enable deletion to make a match visible, only send material you are willing to lose. None plus deletion off is not a dedicated preview mode with a guaranteed report. No visible effect does not prove there was no match: verify that the relevant events are being recorded before using the log to observe results.

Hypothetical checks for a custom dictionary containing testtoken

Test messageExpected matchWhat it establishes
This is testtokenYesThe custom entry is active
This is TESTTOKENYesCapitalization is normalized
This is pretesttokenNo match for the standalone entryA word boundary matters
Please do not write “testtoken”YesA quotation or negation is not an exemption
This is testtoken, after adding that marker to exceptionsNo match for this entryThe exception removes a dictionary entry

These are expected outcomes from the reviewed algorithm, not results from a live Telegram test. Run them in your own group, then add allowed names, multilingual phrases, a changed ending and a disguised version of a prohibited term. Record the observed outcome rather than assuming that a surviving message proves a correct exemption.

Captions and edits need their own checks

Send a permitted image with a test caption. The media setting controls text associated with media; it does not establish image recognition, OCR or speech transcription. A screenshot of a prohibited word and that word typed in a caption are different inputs.

The edit-check row in the Mini App is shown as always on, not as a switch. Edit a harmless test message to include the marker and check the result. For albums and other attachment risks, see media restrictions without losing useful uploads.

Repair the policy and the member's situation separately

When a legitimate message disappears, first stop the same mistake happening again. Disable the relevant module or correct the entry. Do not add a broad exception just to make an incident go away without understanding what it permits throughout the group.

Ask for the approximate time, relevant wording and the member's role. Check the moderation log if the relevant events were already enabled. A different filter, another bot or a human moderator may have caused the deletion; a missing log entry does not identify the cause.

Then address any incorrect warning or restriction separately. Editing a dictionary does not undo a sanction already applied, and it does not restore the original deleted message. After the rule is fixed, ask the member to repost useful material. Add the false positive to the permanent test set so a later dictionary import does not silently bring it back.

Sources and review boundary

Defendy's Mini App controls, dictionary matcher, exception handling and moderation consequences were checked against its implementation on 5 October 2026. The profanity reference collects the related settings. Telegram's bot FAQ explains message visibility; receiving a message and having permission to delete it remain different requirements.

The scenarios and test messages are hypothetical. Source review does not confirm the deployed service version, and no live Telegram group was tested for this article.