Lock Types
Complete reference of all available lock types in the Locks module
🔒 Lock Types Reference
This page documents all available lock types in the Locks module. Locks allow administrators to restrict specific types of content or actions in their groups.
Overview
- Total Lock Types: 22
- Permission Locks: 16 (specific content types)
- Restriction Locks: 6 (broad categories)
How Locks Work
Locks prevent users who are neither admins nor approved from posting specific types of content. When a lock is enabled, the bot will automatically delete matching messages from regular users.
Usage
/lock <lock_type> [lock_type2 ...]
/unlock <lock_type> [lock_type2 ...]
/locks - View the lock settings stored for this chat
/locktypes - View all available lock types
Restriction Locks
Restriction locks affect broad categories of messages. These are powerful locks that can block multiple content types at once.
| Lock Type | Description |
|---|---|
all |
Blocks all messages from users who are neither admins nor approved |
comments |
Blocks messages from non-members (discussion comments) |
media |
Blocks all media files (audio, document, GIF, video, photo, video note, voice) |
messages |
Blocks all text, media, contacts, locations, games, stickers, and GIFs |
other |
Blocks games, stickers, and GIFs |
previews |
Blocks messages containing URLs, whether or not a preview is shown (same match as url) |
Permission Locks
Permission locks target specific types of content or actions. Use these for fine-grained control over what users can post.
| Lock Type | Description |
|---|---|
anonchannel |
Blocks messages from anonymous channels and linked channel posts |
audio |
Blocks audio file messages |
bots |
Prevents users who are neither admins nor approved from adding bots to the group |
contact |
Blocks contact card messages |
document |
Blocks document files (excludes GIFs/animations) |
forward |
Blocks forwarded messages |
game |
Blocks game messages |
gif |
Blocks GIF/animation messages |
location |
Blocks location/venue messages |
photo |
Blocks photo messages |
rtl |
Blocks message text and media captions containing Arabic-script characters (U+0600-U+06FF); other RTL scripts such as Hebrew are not checked |
sticker |
Blocks sticker messages |
url |
Blocks messages containing URLs |
video |
Blocks video messages |
videonote |
Blocks video note messages (round videos) |
voice |
Blocks voice messages |
Media Type Locks
These locks control specific types of media content:
photo: Blocks photo messagesvideo: Blocks video messagesaudio: Blocks audio file messagesvoice: Blocks voice messagesdocument: Blocks document files (excludes GIFs/animations)gif: Blocks GIF/animation messagessticker: Blocks sticker messagesvideonote: Blocks video note messages (round videos)
Content Behavior Locks
These locks control how content behaves:
forward: Blocks forwarded messagesurl: Blocks messages containing URLspreviews: Blocks messages containing URLs, whether or not a preview is shown (same match as url)rtl: Blocks message text and media captions containing Arabic-script characters (U+0600-U+06FF); other RTL scripts such as Hebrew are not checkedanonchannel: Blocks messages from anonymous channels and linked channel postscomments: Blocks messages from non-members (discussion comments)
Special Locks
bots
Prevents users who are neither admins nor approved from adding bots to the group
Behavior: When enabled, the bot will automatically ban any bot added by a user who is neither an admin nor approved.
all
Blocks all messages from users who are neither admins nor approved
Use Case: Useful for temporarily freezing chat activity or creating read-only channels.
Examples
Prevent Media Spam
/lock media
Blocks all media files (audio, documents, GIFs, videos, photos, video notes, and voice messages).
Create Read-Only Chat
/lock all
Prevents all users who are neither admins nor approved from sending any messages.
Block Forwarded Content
/lock forward
Prevents users from forwarding messages from other chats.
Prevent Bot Addition
/lock bots
Only admins and approved users can add bots to the group.
Multiple Locks at Once
/lock sticker gif video
Lock multiple content types in a single command.
Important Notes
Admin and Approved User Exemption
All locks automatically exempt administrators and approved users (see /approve). They can always post any content type, regardless of which locks are enabled.
Bot Permissions
The bot requires the following permissions to enforce locks:
- Delete Messages: Required to remove locked content
- Ban Users: Only for the
botslock (to ban unauthorized bot additions)
Interaction with Other Modules
Locks work independently but complement other moderation modules:
- Antiflood: Locks control content types, antiflood controls message frequency
- Filters: Custom filters can block specific words/patterns, locks block content types
- Blacklist: Blacklist blocks specific words, locks block entire categories
Related Commands
/lock <type>- Enable one or more locks/unlock <type>- Disable one or more locks/locks- View the lock settings stored for this chat (true = locked, false = unlocked)/locktypes- View all available lock types
For more information, see the Locks module documentation.