Add: AiScript TheDesk Plugin

This commit is contained in:
cutls 2020-11-28 07:07:16 +09:00
parent 7169f1147b
commit c0a6ecec4d
8 changed files with 219 additions and 23 deletions

50
app/img/aiscript.svg Normal file
View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 687 72" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<g id="アートボード1" transform="matrix(1,0,0,1,-168.896,-476)">
<rect x="168.896" y="476" width="686.208" height="72" style="fill:none;"/>
<clipPath id="_clip1">
<rect x="168.896" y="476" width="686.208" height="72"/>
</clipPath>
<g clip-path="url(#_clip1)">
<g transform="matrix(1,0,0,1,77.6363,162.413)">
<g transform="matrix(96,0,0,96,88.3157,385.587)">
<path d="M0.463,-0.571C0.452,-0.59 0.436,-0.602 0.415,-0.608C0.394,-0.613 0.374,-0.611 0.356,-0.6L0.08,-0.443C0.053,-0.428 0.04,-0.405 0.04,-0.374C0.04,-0.344 0.053,-0.321 0.08,-0.306L0.356,-0.148C0.368,-0.141 0.381,-0.138 0.395,-0.138C0.425,-0.138 0.448,-0.151 0.463,-0.178C0.474,-0.197 0.476,-0.217 0.47,-0.237C0.465,-0.259 0.453,-0.274 0.434,-0.285L0.278,-0.374L0.434,-0.464C0.453,-0.474 0.465,-0.49 0.47,-0.511C0.476,-0.532 0.474,-0.552 0.463,-0.571Z" style="fill:rgb(129,201,196);fill-rule:nonzero;"/>
</g>
<g transform="matrix(96,0,0,96,137.468,385.587)">
<path d="M0.197,-0.67C0.197,-0.691 0.189,-0.71 0.174,-0.725C0.159,-0.74 0.14,-0.748 0.118,-0.748C0.096,-0.748 0.078,-0.74 0.063,-0.725C0.047,-0.71 0.04,-0.691 0.04,-0.67C0.04,-0.648 0.047,-0.629 0.063,-0.614C0.078,-0.599 0.096,-0.591 0.118,-0.591C0.14,-0.591 0.159,-0.599 0.174,-0.614C0.189,-0.629 0.197,-0.648 0.197,-0.67ZM0.197,-0.079C0.197,-0.101 0.189,-0.119 0.174,-0.135C0.159,-0.15 0.14,-0.158 0.118,-0.158C0.096,-0.158 0.078,-0.15 0.063,-0.135C0.047,-0.119 0.04,-0.101 0.04,-0.079C0.04,-0.057 0.047,-0.038 0.063,-0.023C0.078,-0.008 0.096,0 0.118,0C0.14,0 0.159,-0.008 0.174,-0.023C0.189,-0.038 0.197,-0.057 0.197,-0.079Z" style="fill:rgb(129,201,196);fill-rule:nonzero;"/>
</g>
<g transform="matrix(96,0,0,96,201.74,385.587)">
<path d="M0.118,-0.75C0.097,-0.75 0.078,-0.742 0.063,-0.727C0.047,-0.712 0.04,-0.693 0.04,-0.671L0.04,-0.573C0.04,-0.551 0.047,-0.532 0.063,-0.517C0.078,-0.502 0.097,-0.494 0.118,-0.494C0.14,-0.494 0.159,-0.502 0.174,-0.517C0.189,-0.532 0.197,-0.551 0.197,-0.573L0.197,-0.671C0.197,-0.693 0.189,-0.712 0.174,-0.727C0.159,-0.742 0.14,-0.75 0.118,-0.75ZM0.355,-0.75C0.333,-0.75 0.314,-0.742 0.299,-0.727C0.284,-0.712 0.276,-0.693 0.276,-0.671L0.276,-0.573C0.276,-0.551 0.284,-0.532 0.299,-0.517C0.314,-0.502 0.333,-0.494 0.355,-0.494C0.377,-0.494 0.395,-0.502 0.41,-0.517C0.426,-0.532 0.434,-0.551 0.434,-0.573L0.434,-0.671C0.434,-0.693 0.426,-0.712 0.41,-0.727C0.395,-0.742 0.377,-0.75 0.355,-0.75Z" style="fill:rgb(129,201,196);fill-rule:nonzero;"/>
</g>
<g transform="matrix(96,0,0,96,247.1,385.587)">
<path d="M0.394,-0.494L0.488,-0.306L0.3,-0.306L0.394,-0.494ZM0.063,-0.009C0.082,0.001 0.102,0.002 0.123,-0.005C0.144,-0.011 0.159,-0.024 0.169,-0.044L0.221,-0.148L0.566,-0.148L0.619,-0.044C0.625,-0.03 0.635,-0.02 0.648,-0.012C0.661,-0.004 0.674,0 0.689,0C0.701,0 0.713,-0.003 0.724,-0.009C0.743,-0.018 0.756,-0.033 0.763,-0.054C0.771,-0.075 0.769,-0.095 0.759,-0.114L0.464,-0.705C0.457,-0.718 0.448,-0.729 0.435,-0.737C0.422,-0.745 0.408,-0.749 0.394,-0.749C0.379,-0.749 0.365,-0.745 0.352,-0.737C0.339,-0.729 0.33,-0.718 0.323,-0.705L0.028,-0.114C0.018,-0.095 0.017,-0.075 0.024,-0.054C0.03,-0.033 0.043,-0.018 0.063,-0.009Z" style="fill:rgb(129,201,196);fill-rule:nonzero;"/>
</g>
<g transform="matrix(96,0,0,96,322.7,385.587)">
<path d="M0.158,0C0.18,0 0.198,-0.008 0.214,-0.023C0.229,-0.038 0.236,-0.057 0.236,-0.079L0.236,-0.67C0.236,-0.691 0.229,-0.71 0.214,-0.725C0.198,-0.741 0.18,-0.749 0.158,-0.749C0.136,-0.749 0.117,-0.741 0.102,-0.725C0.087,-0.71 0.079,-0.691 0.079,-0.67L0.079,-0.079C0.079,-0.057 0.087,-0.038 0.102,-0.023C0.117,-0.008 0.136,0 0.158,0Z" style="fill:rgb(129,201,196);fill-rule:nonzero;"/>
</g>
<g transform="matrix(96,0,0,96,352.988,385.587)">
<path d="M0.118,-0.158C0.097,-0.158 0.078,-0.15 0.063,-0.135C0.047,-0.119 0.04,-0.101 0.04,-0.079C0.04,-0.057 0.047,-0.038 0.063,-0.023C0.078,-0.008 0.097,0 0.118,0L0.463,0C0.525,0 0.579,-0.022 0.623,-0.067C0.667,-0.111 0.69,-0.164 0.69,-0.227C0.69,-0.289 0.667,-0.342 0.623,-0.387C0.579,-0.431 0.525,-0.453 0.463,-0.453L0.266,-0.453C0.247,-0.453 0.231,-0.46 0.218,-0.473C0.204,-0.487 0.197,-0.503 0.197,-0.522C0.197,-0.541 0.204,-0.557 0.218,-0.571C0.231,-0.584 0.247,-0.591 0.266,-0.591L0.611,-0.591C0.632,-0.591 0.651,-0.599 0.667,-0.614C0.682,-0.629 0.69,-0.648 0.69,-0.67C0.69,-0.691 0.682,-0.71 0.667,-0.725C0.651,-0.741 0.632,-0.749 0.611,-0.749L0.266,-0.749C0.204,-0.749 0.15,-0.726 0.106,-0.682C0.062,-0.638 0.04,-0.584 0.04,-0.522C0.04,-0.459 0.062,-0.406 0.106,-0.362C0.15,-0.318 0.204,-0.296 0.266,-0.296L0.463,-0.296C0.482,-0.296 0.498,-0.289 0.511,-0.275C0.525,-0.262 0.532,-0.246 0.532,-0.227C0.532,-0.207 0.525,-0.191 0.511,-0.178C0.498,-0.164 0.482,-0.158 0.463,-0.158L0.118,-0.158Z" style="fill:rgb(129,201,196);fill-rule:nonzero;"/>
</g>
<g transform="matrix(96,0,0,96,422.924,385.587)">
<path d="M0.413,0C0.517,0 0.605,-0.037 0.678,-0.11C0.693,-0.125 0.701,-0.143 0.701,-0.166C0.701,-0.187 0.693,-0.206 0.678,-0.221C0.663,-0.236 0.644,-0.244 0.623,-0.244C0.601,-0.244 0.582,-0.236 0.567,-0.221C0.524,-0.179 0.473,-0.158 0.413,-0.158C0.354,-0.158 0.303,-0.179 0.261,-0.221C0.218,-0.263 0.197,-0.314 0.197,-0.374C0.197,-0.434 0.218,-0.485 0.261,-0.528C0.303,-0.57 0.354,-0.591 0.413,-0.591C0.473,-0.591 0.524,-0.57 0.567,-0.528C0.582,-0.512 0.601,-0.504 0.623,-0.504C0.644,-0.504 0.663,-0.512 0.678,-0.528C0.693,-0.543 0.701,-0.561 0.701,-0.583C0.701,-0.605 0.693,-0.623 0.678,-0.639C0.605,-0.712 0.517,-0.749 0.413,-0.749C0.31,-0.749 0.222,-0.712 0.149,-0.639C0.076,-0.566 0.04,-0.478 0.04,-0.374C0.04,-0.271 0.076,-0.183 0.149,-0.11C0.222,-0.037 0.31,0 0.413,0Z" style="fill:rgb(129,201,196);fill-rule:nonzero;"/>
</g>
<g transform="matrix(96,0,0,96,492.86,385.587)">
<path d="M0.572,-0.472C0.572,-0.44 0.56,-0.412 0.537,-0.389C0.514,-0.366 0.486,-0.355 0.453,-0.355L0.236,-0.355L0.236,-0.591L0.453,-0.591C0.486,-0.591 0.514,-0.579 0.537,-0.556C0.56,-0.533 0.572,-0.505 0.572,-0.472ZM0.421,-0.197L0.595,-0.023C0.61,-0.008 0.628,0 0.65,0C0.672,0 0.69,-0.008 0.706,-0.023C0.721,-0.038 0.729,-0.057 0.729,-0.079C0.729,-0.101 0.721,-0.119 0.706,-0.135L0.601,-0.24C0.64,-0.265 0.671,-0.298 0.694,-0.338C0.717,-0.38 0.729,-0.425 0.729,-0.472C0.729,-0.549 0.702,-0.614 0.648,-0.668C0.594,-0.722 0.529,-0.749 0.453,-0.749L0.158,-0.749C0.136,-0.749 0.117,-0.741 0.102,-0.725C0.087,-0.71 0.079,-0.691 0.079,-0.67L0.079,-0.079C0.079,-0.057 0.087,-0.038 0.102,-0.023C0.117,-0.008 0.136,0 0.158,0C0.18,0 0.198,-0.008 0.214,-0.023C0.229,-0.038 0.236,-0.057 0.236,-0.079L0.236,-0.197L0.421,-0.197Z" style="fill:rgb(129,201,196);fill-rule:nonzero;"/>
</g>
<g transform="matrix(96,0,0,96,566.588,385.587)">
<path d="M0.158,0C0.18,0 0.198,-0.008 0.214,-0.023C0.229,-0.038 0.236,-0.057 0.236,-0.079L0.236,-0.67C0.236,-0.691 0.229,-0.71 0.214,-0.725C0.198,-0.741 0.18,-0.749 0.158,-0.749C0.136,-0.749 0.117,-0.741 0.102,-0.725C0.087,-0.71 0.079,-0.691 0.079,-0.67L0.079,-0.079C0.079,-0.057 0.087,-0.038 0.102,-0.023C0.117,-0.008 0.136,0 0.158,0Z" style="fill:rgb(129,201,196);fill-rule:nonzero;"/>
</g>
<g transform="matrix(96,0,0,96,596.876,385.587)">
<path d="M0.572,-0.472C0.572,-0.44 0.56,-0.412 0.537,-0.389C0.514,-0.366 0.486,-0.355 0.453,-0.355L0.236,-0.355L0.236,-0.591L0.453,-0.591C0.486,-0.591 0.514,-0.579 0.537,-0.556C0.56,-0.533 0.572,-0.505 0.572,-0.472ZM0.158,0C0.18,0 0.198,-0.008 0.214,-0.023C0.229,-0.038 0.236,-0.057 0.236,-0.079L0.236,-0.197L0.453,-0.197C0.529,-0.197 0.594,-0.224 0.648,-0.278C0.702,-0.332 0.729,-0.397 0.729,-0.472C0.729,-0.549 0.702,-0.614 0.648,-0.668C0.594,-0.722 0.529,-0.749 0.453,-0.749L0.158,-0.749C0.136,-0.749 0.117,-0.741 0.102,-0.725C0.087,-0.71 0.079,-0.691 0.079,-0.67L0.079,-0.079C0.079,-0.057 0.087,-0.038 0.102,-0.023C0.117,-0.008 0.136,0 0.158,0Z" style="fill:rgb(129,201,196);fill-rule:nonzero;"/>
</g>
<g transform="matrix(96,0,0,96,670.604,385.587)">
<path d="M0.266,-0.591L0.266,-0.079C0.266,-0.057 0.273,-0.038 0.289,-0.023C0.304,-0.008 0.323,0 0.344,0C0.366,0 0.385,-0.008 0.4,-0.023C0.415,-0.038 0.423,-0.057 0.423,-0.079L0.423,-0.591L0.591,-0.591C0.612,-0.591 0.631,-0.599 0.647,-0.614C0.662,-0.629 0.67,-0.648 0.67,-0.67C0.67,-0.691 0.662,-0.71 0.647,-0.725C0.631,-0.741 0.612,-0.749 0.591,-0.749L0.099,-0.749C0.077,-0.749 0.058,-0.741 0.043,-0.725C0.027,-0.71 0.02,-0.691 0.02,-0.67C0.02,-0.648 0.027,-0.629 0.043,-0.614C0.058,-0.599 0.077,-0.591 0.099,-0.591L0.266,-0.591Z" style="fill:rgb(129,201,196);fill-rule:nonzero;"/>
</g>
<g transform="matrix(96,0,0,96,736.748,385.587)">
<path d="M0.118,-0.75C0.097,-0.75 0.078,-0.742 0.063,-0.727C0.047,-0.712 0.04,-0.693 0.04,-0.671L0.04,-0.573C0.04,-0.551 0.047,-0.532 0.063,-0.517C0.078,-0.502 0.097,-0.494 0.118,-0.494C0.14,-0.494 0.159,-0.502 0.174,-0.517C0.189,-0.532 0.197,-0.551 0.197,-0.573L0.197,-0.671C0.197,-0.693 0.189,-0.712 0.174,-0.727C0.159,-0.742 0.14,-0.75 0.118,-0.75ZM0.355,-0.75C0.333,-0.75 0.314,-0.742 0.299,-0.727C0.284,-0.712 0.276,-0.693 0.276,-0.671L0.276,-0.573C0.276,-0.551 0.284,-0.532 0.299,-0.517C0.314,-0.502 0.333,-0.494 0.355,-0.494C0.377,-0.494 0.395,-0.502 0.41,-0.517C0.426,-0.532 0.434,-0.551 0.434,-0.573L0.434,-0.671C0.434,-0.693 0.426,-0.712 0.41,-0.727C0.395,-0.742 0.377,-0.75 0.355,-0.75Z" style="fill:rgb(129,201,196);fill-rule:nonzero;"/>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -6,20 +6,8 @@ function getPlugin() {
buttonOnPostbox: [],
buttonOnToot: []
}
//if(!json) return ret
//const plugins = JSON.parse(json)
const plugins = [
{
id: randomStr(20),
content: `### {
name: "マイ・ファースト・プラグイン"
version: 1
event: "buttonOnPostbox"
author: "Cutls P"
}
`
}
]
if(!json) return ret
const plugins = JSON.parse(json)
for (let plugin of plugins) {
const meta = getMeta(plugin.content)
if (!meta) continue

View File

@ -502,9 +502,9 @@ function copyColor(from, to) {
let i = 0
let color
for (tag of props) {
if(tag == from) {
if (tag == from) {
let used = $(`#use-color_${i}`).prop('checked')
if(!used) {
if (!used) {
Swal.fire({
type: 'error',
title: 'Not checked',
@ -516,9 +516,9 @@ function copyColor(from, to) {
}
i++
}
if(!color) return false
if (!color) return false
for (tag of props) {
if(tag == to) {
if (tag == to) {
$(`#color-picker${i}_value`).val(color)
$(`#use-color_${i}`).prop('checked', true)
break
@ -555,7 +555,7 @@ function customComp() {
var my = JSON.parse(multi)[0].name
var id = $('#custom-edit-sel').val()
const defaults = [
'black','blue','brown','green','indigo','polar','snow','white'
'black', 'blue', 'brown', 'green', 'indigo', 'polar', 'snow', 'white'
]
if (id == 'add_new' || defaults.includes(id)) {
id = makeCID()
@ -690,7 +690,7 @@ function customConnect(raw) {
i++
}
$('#custom_json').val(raw[1])
if(args.default) {
if (args.default) {
$('#delTheme').addClass('disabled')
}
}
@ -728,6 +728,107 @@ function customSoundSave(key, file) {
localStorage.setItem('custom' + key, file)
$(`#c${key}-file`).text(file)
}
function pluginLoad() {
$('#plugin-edit-sel').val('add_new')
$(".plugin_delete").addClass('disabled')
var template = ''
var pgns = localStorage.getItem('plugins')
var args = JSON.parse(pgns ? pgns : '[]')
Object.keys(args).forEach(function (key) {
var theme = args[key]
var themeid = theme.id
template = template + `<option value="${themeid}">${getMeta(theme.content).name}</option>`
})
template = '<option value="add_new">' + $('#plugin-selector').attr('data-add') + '</option>' + template
$('#plugin-edit-sel').html(template)
$('select').formSelect()
}
function pluginEdit() {
var id = $('#plugin-edit-sel').val()
$('#plugin').attr('data-id', id)
if (id == 'add_new') {
$('#plugin').val('')
$(".plugin_delete").addClass('disabled')
} else {
$(".plugin_delete").removeClass('disabled')
var pgns = localStorage.getItem('plugins')
var args = JSON.parse(pgns ? pgns : '[]')
Object.keys(args).forEach(function (key) {
var plugin = args[key]
var targetId = plugin.id
if (targetId == id) $('#plugin').val(plugin.content)
})
}
}
function completePlugin(comp) {
var pgns = localStorage.getItem('plugins')
var args = JSON.parse(pgns ? pgns : '[]')
var id = $('#plugin').attr('data-id')
var inputPlugin = $('#plugin').val()
var meta = getMeta(inputPlugin)
if (!meta) {
Swal.fire({
icon: 'error',
title: 'error',
})
return false
}
if (!meta.name || !meta.version || !meta.event || !meta.author) {
Swal.fire({
icon: 'error',
title: 'error',
})
return false
}
if (id == 'add_new') {
id = makeCID()
args.push({
id: id,
content: inputPlugin
})
} else {
Object.keys(args).forEach(function (key) {
var plugin = args[key]
var targetId = plugin.id
if (targetId == id) args[key].content = inputPlugin
})
}
var ss = args
localStorage.setItem('plugins', JSON.stringify(ss))
if(comp) return false
$('#plugin').attr('data-id', 'add_new')
$('#plugin').val('')
pluginLoad()
}
async function deletePlugin() {
const alert = await Swal.fire({
title: 'delete',
icon: 'warning',
showCancelButton: true
})
if (!alert) return false
$('#plugin').val('')
var pgns = localStorage.getItem('plugins')
var args = JSON.parse(pgns ? pgns : '[]')
var id = $('#plugin').attr('data-id')
$('#plugin').attr('data-id', 'add_new')
var ss = []
Object.keys(args).forEach(function (key) {
var plugin = args[key]
var targetId = plugin.id
if (targetId != id) ss.push(plugin)
})
localStorage.setItem('plugins', JSON.stringify(ss))
pluginLoad()
}
function execEditPlugin() {
completePlugin(true)
var id = $('#plugin').attr('data-id')
var inputPlugin = $('#plugin').val()
var meta = getMeta(inputPlugin)
execPlugin(id, meta.event, { acct_id: 0, id: null })
}
window.onload = function () {
//最初に読む
load()
@ -738,6 +839,7 @@ window.onload = function () {
voiceSettingLoad()
oksload()
ctLoad()
pluginLoad()
$('body').addClass(localStorage.getItem('platform'))
}
//設定画面で未読マーカーは要らない

View File

@ -158,6 +158,9 @@
"keysc": "Keyboard shortcut Preferences",
"iks": "Easy inserter",
"okswarn": "You can insert any letters and emojis with only 3 keys",
"plugin": "Plugins",
"howToWritePlugin": "Japanese docs of AiScript TheDesk plugins",
"pluginList": "Plugin list",
"muteemp": "Mute & Emphasis Preferences",
"climute": "Client Mute",
"cliemp": "Client Emphasis",

View File

@ -156,6 +156,9 @@
"keysc": "キーボードショートカットの設定",
"iks": "簡単文字入力",
"okswarn": "絵文字やタグ、&gt;BTなどを登録しておくとすぐに使えてええ感じや。",
"plugin": "プラグイン",
"howToWritePlugin": "AiScriptでTheDeskプラグイン書いたろ",
"pluginList": "プラグイン一覧",
"muteemp": "ミュート・強調の設定",
"climute": "クライアントミュート",
"cliemp": "クライアント強調",

View File

@ -155,6 +155,9 @@
"zeroWidthEmoji": "絵文字にゼロ幅スペースを使う",
"uploadCrop": "添付画像の自動リサイズ",
"uploadCropWarn": "最大の長辺ピクセル指定。JPEG以外は自動でPNGイメージに変換されます。大きなGIFアニメは静止画になります。0に設定するとリサイズしません。",
"plugin": "プラグイン",
"howToWritePlugin": "AiScriptによるTheDeskプラグインの書き方",
"pluginList": "プラグイン一覧",
"keysc": "キーボードショートカットの設定",
"iks": "簡単文字入力",
"okswarn": "絵文字やタグ、&gt;BTなどを登録しておくとすぐに入力できます。",

View File

@ -398,10 +398,19 @@
</li>
<li>
<div class="collapsible-header">
<i class="material-icons">power</i>@@plugin@@
<img src="../../img/aiscript.svg" style="height: 1.5rem; margin-left: 0.4rem; margin-right: 0.4rem;">@@plugin@@
</div>
<div class="collapsible-body">
<a href="https://github.com/cutls/TheDesk/blob/master/plugin.md">@@howToWritePlugin@@</a><br />
<textarea id="plugin" data-id="add_new" style="height: 20rem"></textarea>
<button class="btn waves-effect" style="width:7.7rem;" onclick="completePlugin()">@@change@@</button>
<button class="btn waves-effect red disabled plugin_delete" style="width:7.7rem;" onclick="deletePlugin()">@@delete@@</button>
<h5>@@pluginList@@</h5>
<div style="width:22rem" id="plugin-selector" data-add="@@add_new@@">
<select id="plugin-edit-sel" class="custom-sel" onchange="pluginEdit()">
<option value="add_new">@@add_new@@</option>
</select>
</div>
</div>
</li>
<li>
@ -599,6 +608,9 @@
</span><br>
TheDeskおよびCutls Pは<a href="https://donken.org/">被災地支援のためのマストドン研究会</a>をログイン機能提供等の形で応援しています。<br>
タグタイムラインを開く:<a href="index.html?mode=tag&code=被災地支援のためのマストドン研究会">#被災地支援のためのマストドン研究会</a><br>
<script type="text/javascript" src="../../@@node_base@@/lodash/lodash.min.js"></script>
<script type="text/javascript" src="../../js/platform/aiscript.js"></script>
<script type="text/javascript" src="../../js/platform/plugin.js"></script>
<script type="text/javascript" src="../../js/common/modal.js"></script>
<script type="text/javascript" src="../../js/common/about.js"></script>
<script type="text/javascript" src="../../js/platform/end.js"></script>

View File

@ -11,6 +11,7 @@
version: 1
event: "buttonOnPostbox"
author: "Cutls P"
apiGet: false(例)
}
```
これを冒頭に入れます。
@ -115,3 +116,37 @@ NSFWを切り替えます。forceはデフォルトでfalseで、trueにする
`apiPost`をtrueにしてください。
トゥートボタンを押したのと同じ挙動をします。
## 実例
https://misskey.io/@syuilo/pages/bebeyo をTheDeskで使用できるようにするためには…(勝手に改造)
```
### {
name: "ベベヨ"
version: 1
event: "buttonOnPostbox"
author: "syuilo"
}
#chars =
Str:split("ア,イ,ウ,エ,オ,カ,キ,ク,ケ,コ,サ,シ,ス,セ,ソ,タ,チ,ツ,テ,ト,ナ,ニ,ヌ,ネ,ノ,ハ,ヒ,フ,ヘ,ホ,マ,ミ,ム,メ,モ,ヤ,ユ,ヨ,ガ,ギ,グ,ゲ,ゴ,ザ,ジ,ズ,ゼ,ゾ,ダ,ヂ,ヅ,デ,ド,バ,ビ,ブ,ベ,ボ,パ,ピ,プ,ペ,ポ", ",")
#yos = ["オ", "ニョ"]
#suffixes = ["オオオオオオオ", "ナーラ", "ンチーノ"]
$text <- _
@do() {
#char1 = chars[Math:rnd(1, Arr:len(chars))]
#char2 = chars[Math:rnd(1, Arr:len(chars))]
#yo = ? (Math:rnd(0, 2) = 0) { yos[Math:rnd(1, Arr:len(yos))] } ... { "ヨ" }
#n = ? (Math:rnd(0, 2) = 0) { "ン" } ... { "" }
#suffix = ? (Math:rnd(0, 2) = 0) { suffixes[Math:rnd(1, Arr:len(suffixes))] } ... { "" }
text <- `{char1}{char2}{n}{yo}{suffix}`
TheDesk:postText(text)
}
do()
```
最初のメタデータを追加します。
また、do関数の最下部の`TheDesk:postText(text)`で、TheDeskの投稿ボックスに結果を挿入しています。