Skip to content

CQ Code

CQ Code is the message segment format for OneBot V11, used to represent special content (such as images, emojis, etc.) in messages.

Format

CQ Code format:

[CQ:type,param1=value1,param2=value2]
  • type - Message segment type
  • param - Parameter name
  • value - Parameter value

Escaping

In CQ Code, the following characters need to be escaped:

CharacterEscape
&&
[[
]]
,, (only in CQ Code parameter values)

Message Segment Types

text Plain Text

Format

Plain text content (no CQ Code needed)

Parameters

ParameterTypeDescription
textstringPlain text content

Example

Hello, World!

face QQ Emoji

Format

[CQ:face,id=emoji_id]

Parameters

ParameterTypeDescription
idstringQQ emoji ID

Example

[CQ:face,id=178]

image Image

Format

[CQ:image,file=filename_or_url]

Parameters

ParameterTypeDefaultDescription
filestring-Image filename, absolute path, or URL
typestring-Image type, flash for flash image
urlstring-Image URL
cache0/11Only valid when sending via network URL, whether to use cached file
proxy0/11Only valid when sending via network URL, whether to download via proxy
timeoutnumber-Only valid when sending via network URL, download timeout (seconds)

Example

[CQ:image,file=image.jpg]
[CQ:image,file=https://example.com/image.jpg]
[CQ:image,file=image.jpg,type=flash]