|
@@ -6,6 +6,7 @@ import (
|
|
|
"os/exec"
|
|
"os/exec"
|
|
|
"strings"
|
|
"strings"
|
|
|
|
|
|
|
|
|
|
+ "github.com/atotto/clipboard"
|
|
|
"github.com/diamondburned/arikawa/v3/api"
|
|
"github.com/diamondburned/arikawa/v3/api"
|
|
|
"github.com/diamondburned/arikawa/v3/discord"
|
|
"github.com/diamondburned/arikawa/v3/discord"
|
|
|
"github.com/diamondburned/arikawa/v3/utils/json/option"
|
|
"github.com/diamondburned/arikawa/v3/utils/json/option"
|
|
@@ -46,6 +47,9 @@ func (mi *MessageInput) onInputCapture(event *tcell.EventKey) *tcell.EventKey {
|
|
|
case config.Keys.MessageInput.Send:
|
|
case config.Keys.MessageInput.Send:
|
|
|
mi.sendAction()
|
|
mi.sendAction()
|
|
|
return nil
|
|
return nil
|
|
|
|
|
+ case config.Keys.MessageInput.Paste:
|
|
|
|
|
+ mi.pasteAction()
|
|
|
|
|
+ return nil
|
|
|
case config.Keys.MessageInput.LaunchEditor:
|
|
case config.Keys.MessageInput.LaunchEditor:
|
|
|
messageInput.launchEditorAction()
|
|
messageInput.launchEditorAction()
|
|
|
return nil
|
|
return nil
|
|
@@ -100,6 +104,16 @@ func (mi *MessageInput) sendAction() {
|
|
|
mi.reset()
|
|
mi.reset()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+func (mi *MessageInput) pasteAction() {
|
|
|
|
|
+ text, err := clipboard.ReadAll()
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ log.Fatal(err)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // Append the text to the message input.
|
|
|
|
|
+ mi.SetText(mi.GetText() + text)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
func (mi *MessageInput) launchEditorAction() {
|
|
func (mi *MessageInput) launchEditorAction() {
|
|
|
e := config.Editor
|
|
e := config.Editor
|
|
|
if e == "default" {
|
|
if e == "default" {
|