/\ /\<p><b>Presenting:</b><span> Quick send, a Misskey (and forks) plugin! (Tested in Sharkey)<br><br>This plugin lets you quickly send notes to select users! </span>:blobcat_spin:<span><br><br>It works by adding users to a send list. Simply click the 3 dots on their profile (either on their profile page, or in the on hover preview), and at the very bottom you'll see an option to add them (or remove them).<br><br>Then, on any note, click on the 3 dots, and at the bottom you'll have a button for each user you've added. </span>:neocat_bongo_down:<span><br><br>There are also options for clearing the list, and in the plugin's settings you can tell it to ask for confirmation, or to show a success dialog box.<br><br>To install go to settings > plugins > install and paste the source code:<br></span></p><pre><code>/// @0.18.0
// This is licensed under MIT
### {
name: "Quick send"
version: "1.0.1"
author: "@linuxenjoyer@blahaj.zone"
description: "Send a note to your besties quickly"
permissions: [ "write:notes" ]
config: {
show_success: {
type: "boolean"
label: "Show success dialog"
description: "Makes a dialog pop up saying that it was sent. I'm not exactly sure how to do error handling, this is more to make sure the plugin didn't randomly crash."
default: false
}
ask_confirmation: {
type: "boolean"
label: "Ask for confirmation"
description: "Asks you if your really want to send the post."
default: false
}
}
}
@save(obj) {
Mk:save("user_send_list", obj)
}
@load() {
var ls = Mk:load("user_send_list")
if (ls == null) {
save({})
ls = {}
}
ls
}
// Simple function to format a username
@formatUsername(user) {
var username = `@{user.username}`
if (user.host != null) {
username = `{username}@{user.host}`
}
username
}
@sendNote(note, userId) {
// This is based on blahaj.zone's api-doc (sharkey)
let res = Mk:api("notes/create" {
visibility: "specified"
renoteId: note.id
visibleUserIds: [ userId ]
})
// TODO: Figure out error handling
true
}
@getAction(username, userId) {
@(note) {
var should_send = !Plugin:config.ask_confirmation
if (!should_send) {
should_send = Mk:confirm(`Send post to {user}?` "" "question")
}
if (should_send) {
let ok = sendNote(note, userId)
// This is a little ugly but idrk how to tidy it up
if (ok) {
if (Plugin:config.show_success) {
Mk:dialog(`Sent note to {username}`, "", "success")
}
} else {
Mk:dialog(`There was an error sending the note to {username}`, "", "error")
}
}
}
}
// Underscores bc it's in global scope
let __ls = load()
each (let usr, Obj:keys(__ls)) {
Plugin:register_note_action(`Send to {usr}`, getAction(usr, __ls[usr]))
}
Plugin:register_user_action("Add user to send list", @(user) {
let username = formatUsername(user)
let ls = load()
if (ls[username] != null) {
Mk:dialog(`{username} is already on the send list`, "", "error")
} else {
ls[username] = user.id
save(ls)
Mk:dialog(`Added {username} to the send list!`, "You might have to refresh to see the changes", "success")
}
})
Plugin:register_user_action("Remove user from send list" @(user) {
let username = formatUsername(user)
let ls = load()
if (ls[username] == null) {
Mk:dialog(`{username} is not on the send list`, "", "error")
} else {
ls[username] = null
save(ls)
Mk:dialog(`Removed {username} from the send list!`, "You might have to refresh to see the changes", "success")
}
})
Plugin:register_note_action("Clear user send list" @(note){
if (Mk:confirm("Are you sure you want to clear the list?", "There's no way to undo this", "warning")) {
save({})
Mk:dialog("List cleared", "You might have to refresh to see the changes", "success")
}
})
Plugin:register_user_action("Clear user send list" @(user){
if (Mk:confirm("Are you sure you want to clear the list?", "There's no way to undo this", "warning")) {
save({})
Mk:dialog("List cleared", "You might have to refresh to see the changes", "success")
}
})</code></pre><span><br>It'll ask for permissions to create notes (it needs this to be able to send stuff) </span>:blobcat_code:<span><br><br>If you found it useful or have feature ideas/patches let me know </span>:neocat_melt_reach:<span><br><br></span><a href="https://blahaj.zone/tags/plugins" rel="nofollow noopener noreferrer" target="_blank">#plugins</a> <a href="https://blahaj.zone/tags/plugin" rel="nofollow noopener noreferrer" target="_blank">#plugin</a> <a href="https://blahaj.zone/tags/aiscript" rel="nofollow noopener noreferrer" target="_blank">#aiscript</a> <a href="https://blahaj.zone/tags/aiscriptplugins" rel="nofollow noopener noreferrer" target="_blank">#aiscriptplugins</a><p></p>