mirror of
https://github.com/FliegendeWurst/telegram_notes_bot.git
synced 2024-11-09 13:50:36 +00:00
19 lines
682 B
JavaScript
19 lines
682 B
JavaScript
api.addButtonToToolbar({
|
|
title: 'New task',
|
|
icon: 'check',
|
|
shortcut: 'alt+n',
|
|
action: async () => {
|
|
// creating notes is backend (server) responsibility so we need to pass
|
|
// the control there
|
|
const taskNoteId = await api.runOnServer(async () => {
|
|
const todoRootNote = await api.getNoteWithLabel('taskTodoRoot');
|
|
const resp = await api.createTextNote(todoRootNote.noteId, 'new task', '');
|
|
|
|
return resp.note.noteId;
|
|
});
|
|
|
|
await api.waitUntilSynced();
|
|
// we got an ID of newly created note and we want to immediatelly display it
|
|
await api.activateNewNote(taskNoteId);
|
|
}
|
|
}); |