jointrashposs/content/en/docs/4.for-developers/plugin/plugin-api-reference.md
かっこかり 6040f4902b
New Crowdin updates (#83)
* New translations ja-jp.yml (French)

* New translations share-form.md (French)

* New translations ja-jp.yml (Italian)

* New translations share-form.md (Italian)

* New translations ja-jp.yml (Korean)

* New translations 1.about-misskey.md (Korean)

* New translations reaction.md (Korean)

* New translations share-form.md (Korean)

* New translations 1.index.md (Korean)

* New translations announcement.md (Korean)

* New translations ftt.md (Korean)

* New translations role.md (Korean)

* New translations 1.index.md (Korean)

* New translations bash.md (Korean)

* New translations docker.md (Korean)

* New translations manual.md (Korean)

* New translations ubuntu-manual.md (Korean)

* New translations 1.index.md (Korean)

* New translations 1.index.md (Korean)

* New translations global-timeline.md (Korean)

* New translations home-timeline.md (Korean)

* New translations hybrid-timeline.md (Korean)

* New translations index.md (Korean)

* New translations local-timeline.md (Korean)

* New translations main.md (Korean)

* New translations 5.releases.md (Korean)

* New translations endpoints.md (Korean)

* New translations ja-jp.yml (Polish)

* New translations share-form.md (Polish)

* New translations ja-jp.yml (Chinese Simplified)

* New translations share-form.md (Chinese Simplified)

* New translations share-form.md (Chinese Traditional)

* New translations 5.releases.md (Chinese Traditional)

* New translations ja-jp.yml (English)

* New translations 1.index.md (English)

* New translations ads.md (English)

* New translations antenna.md (English)

* New translations charts.md (English)

* New translations clip.md (English)

* New translations share-form.md (English)

* New translations create-plugin.md (English)

* New translations plugin-api-reference.md (English)

* New translations publish-on-your-website.md (English)

* New translations ja-jp.yml (Indonesian)

* New translations share-form.md (Indonesian)
2023-12-26 12:57:24 +09:00

2.4 KiB
Raw Blame History

Plugin API Reference

Mk:dialog(title text type)

Display a dialog box.The following values can be set for type.
info success warn error question
If omitted, it will be info.

Mk:confirm(title text type)

Display a confirmation dialog.The following values can be set for type.
info success warn error question
If omitted, it will be question.
Returns true if the user selects "OK" or false if the user selects "cancel".

Mk:api(endpoint params)

Make a request to the Misskey API.Passes the endpoint name as the first argument and the parameter object as the second argument.

Mk:save(key value)

Persistently saves an arbitrary key with any given value.The saved value will remain after the AiScript context ends and can be loaded with Mk:load.

Mk:load(key)

Reads the value of the specified name saved by Mk:save.

Plugin:register_post_form_action(title fn)

Adds an action in the post form.Passes the name of the action as the first argument and the callback function when the action is selected as the second argument.The post form object is passed to the callback function as the first argument.

Plugin:register_note_action(title fn)

Adds an action in the note menu.Passes the name of the item as the first argument and the callback function when the action is selected as the second argument.
The target note object is passed to the callback function as the first argument.

Plugin:register_user_action(title fn)

Adds an action in the user menu.Passes the name of the item as the first argument and the callback function when the action is selected as the second argument.
The target user object is passed to the callback function as the first argument.

Plugin:register_note_view_interruptor(fn)

Rewrites the note information displayed on the UI.
The target note object is passed to the callback function as the first argument.
The note will be rewritten with the return value of the callback function.

Plugin:register_note_post_interruptor(fn)

Rewrite note information when posting notes.
The target note object is passed to the callback function as the first argument.
The note will be rewritten with the return value of the callback function.

Plugin:open_url(url)

Opens the URL given as the first parameter in a new browser tab.

Plugin:config

An object containing the plugin settings.The values set in the plugin definition's config are saved in the object keys.