> For the complete documentation index, see [llms.txt](https://docs.rainybot.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rainybot.dev/api/imagemessage.md).

# 类: ImageMessage

[(返回目录)](/api.md)

**继承自:** [Message](/api/message.md)

RainyBot的图像消息类，其实例记录了与一个图像消息相关的各类数据

## 方法

* static [ImageMessage](/api/imagemessage.md) **init (** [Image](https://docs.godotengine.org/en/latest/classes/class_image.html) image **)**

基于图像实例缓存并手动构造一个ImageMessage类的实例

***

* static [ImageMessage](/api/imagemessage.md) **init\_gif (** [GifImage](/api/gifimage.md) gif\_image **)**

基于Gif动图实例缓存并手动构造一个ImageMessage类的实例

***

* static [ImageMessage](/api/imagemessage.md) **init\_id (** [String](https://docs.godotengine.org/en/latest/classes/class_string.html) image\_id **)**

基于指定的图像ID来手动构造一个ImageMessage类的实例

***

* static [ImageMessage](/api/imagemessage.md) **init\_url (** [String](https://docs.godotengine.org/en/latest/classes/class_string.html) image\_url **)**

基于指定的URL地址来手动构造一个ImageMessage类的实例

***

* static [ImageMessage](/api/imagemessage.md) **init\_path (** [String](https://docs.godotengine.org/en/latest/classes/class_string.html) image\_path **)**

基于指定的本地文件路径来手动构造一个ImageMessage类的实例

***

* static [ImageMessage](/api/imagemessage.md) **init\_base64 (** [String](https://docs.godotengine.org/en/latest/classes/class_string.html) image\_base64 **)**

基于指定的BASE64编码来手动构造一个ImageMessage类的实例

***

* static [ImageMessage](/api/imagemessage.md) **init\_meta (** [Dictionary](https://docs.godotengine.org/en/latest/classes/class_dictionary.html) dic **)**

通过机器人协议后端的元数据字典构造一个此类的实例，仅当你知道自己在做什么时才使用

***

* [String](https://docs.godotengine.org/en/latest/classes/class_string.html) **get\_image\_id ( )**

获取此实例对应的图像的ID

***

* void **set\_image\_id (** [String](https://docs.godotengine.org/en/latest/classes/class_string.html) image\_id **)**

设置此实例对应的图像的ID

***

* [String](https://docs.godotengine.org/en/latest/classes/class_string.html) **get\_image\_url ( )**

获取此实例对应的图像的URL链接

***

* void **set\_image\_url (** [String](https://docs.godotengine.org/en/latest/classes/class_string.html) image\_url **)**

设置此实例对应的图像的URL链接

***

* [String](https://docs.godotengine.org/en/latest/classes/class_string.html) **get\_image\_path ( )**

获取此实例对应的图像的本地路径

***

* void **set\_image\_path (** [String](https://docs.godotengine.org/en/latest/classes/class_string.html) image\_path **)**

设置此实例对应的图像的本地路径

***

* [String](https://docs.godotengine.org/en/latest/classes/class_string.html) **get\_image\_base64 ( )**

获取此实例对应的图像的Base64编码

***

* void **set\_image\_base64 (** [String](https://docs.godotengine.org/en/latest/classes/class_string.html) image\_base64 **)**

设置此实例对应的图像的Base64编码

***

* [int](https://docs.godotengine.org/en/latest/classes/class_int.html) **get\_image\_height ( )**

获取此实例对应的图像的高度

***

* [int](https://docs.godotengine.org/en/latest/classes/class_int.html) **get\_image\_width ( )**

获取此实例对应的图像的宽度

***

* [float](https://docs.godotengine.org/en/latest/classes/class_float.html) **get\_image\_size ( )**

获取此实例对应的图像的文件大小

***

* [String](https://docs.godotengine.org/en/latest/classes/class_string.html) **get\_image\_type ( )**

获取此实例对应的图像的类型文本

***

* [bool](https://docs.godotengine.org/en/latest/classes/class_bool.html) **is\_emoji ( )**

判断此实例对应的图像是否为表情

***

* [String](https://docs.godotengine.org/en/latest/classes/class_string.html) **get\_as\_text ( )**

将此实例获取为字符串的形式

***
