Skip to content

Commit 792da2b

Browse files
authored
Merge branch 'main' into message-types
2 parents 3914d63 + 8c430c0 commit 792da2b

40 files changed

Lines changed: 2340 additions & 1528 deletions

‎README.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,10 @@ Discordo uses the default configuration if a configuration file is not found in
7272

7373
> [!IMPORTANT]
7474
> Automated user accounts or "self-bots" are against Discord's Terms of Service. I am not responsible for any loss caused by using "self-bots" or Discordo.
75+
76+
## License
77+
78+
Copyright (C) 2025-present ayn2op
79+
80+
This project is licensed under the GNU General Public License v3.0 (GPL-3.0).
81+
See the [LICENSE](./LICENSE) file for the full license text.

‎cmd/root.go‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ import (
88
"github.com/ayn2op/discordo/internal/config"
99
"github.com/ayn2op/discordo/internal/logger"
1010
"github.com/ayn2op/discordo/internal/ui/root"
11+
"github.com/ayn2op/tview"
1112
"github.com/diamondburned/arikawa/v3/utils/ws"
13+
"github.com/gdamore/tcell/v3"
1214
)
1315

1416
var (
@@ -45,5 +47,24 @@ func Run() error {
4547
return fmt.Errorf("failed to load config: %w", err)
4648
}
4749

48-
return root.NewView(cfg).Run()
50+
screen, err := tcell.NewScreen()
51+
if err != nil {
52+
return fmt.Errorf("failed to create screen: %w", err)
53+
}
54+
55+
if err := screen.Init(); err != nil {
56+
return fmt.Errorf("failed to init screen: %w", err)
57+
}
58+
59+
if cfg.Mouse {
60+
screen.EnableMouse()
61+
}
62+
screen.EnablePaste()
63+
screen.EnableFocus()
64+
65+
tview.Styles = tview.Theme{}
66+
app := tview.NewApplication()
67+
app.SetRoot(root.NewModel(cfg, app))
68+
app.SetScreen(screen)
69+
return app.Run()
4970
}

‎go.mod‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,33 @@
11
module github.com/ayn2op/discordo
22

3-
go 1.25.3
3+
go 1.26.0
44

55
// replace github.com/ayn2op/tview => ../tview
66

7+
// replace github.com/diamondburned/arikawa/v3 => ../arikawa
8+
79
require (
810
github.com/BurntSushi/toml v1.6.0
911
github.com/alecthomas/chroma/v2 v2.23.1
1012
github.com/andybalholm/brotli v1.2.0
11-
github.com/ayn2op/tview v0.0.0-20260225014619-7f27f376aea9
13+
github.com/ayn2op/clipboard v0.0.0-20260308203959-c5ad7df3fc97
14+
github.com/ayn2op/tview v0.0.0-20260311012550-9b46cad522bf
1215
github.com/deckarep/gosx-notifier v0.0.0-20180201035817-e127226297fb
13-
github.com/diamondburned/arikawa/v3 v3.6.1-0.20260226015332-783a3e8e8e86
14-
github.com/diamondburned/ningen/v3 v3.0.1-0.20250920191746-98fbd92e134d
16+
github.com/diamondburned/arikawa/v3 v3.6.1-0.20260309010533-e61165a61b64
17+
github.com/diamondburned/ningen/v3 v3.0.1-0.20260306213430-5a08d3a709b4
1518
github.com/gdamore/tcell/v3 v3.1.2
1619
github.com/gen2brain/beeep v0.11.2
1720
github.com/google/go-cmp v0.6.0
1821
github.com/google/uuid v1.6.0
1922
github.com/gorilla/websocket v1.5.3
2023
github.com/klauspost/compress v1.18.4
2124
github.com/ncruces/zenity v0.10.14
25+
github.com/rivo/uniseg v0.4.7
2226
github.com/sahilm/fuzzy v0.1.1
2327
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
2428
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
2529
github.com/yuin/goldmark v1.7.16
2630
github.com/zalando/go-keyring v0.2.6
27-
golang.design/x/clipboard v0.7.1
2831
)
2932

3033
require (
@@ -45,7 +48,6 @@ require (
4548
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
4649
github.com/pkg/errors v0.9.1 // indirect
4750
github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844 // indirect
48-
github.com/rivo/uniseg v0.4.7 // indirect
4951
github.com/sergeymakinen/go-bmp v1.0.0 // indirect
5052
github.com/sergeymakinen/go-ico v1.0.0 // indirect
5153
github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af // indirect
@@ -54,8 +56,8 @@ require (
5456
golang.org/x/exp/shiny v0.0.0-20260218203240-3dfff04db8fa // indirect
5557
golang.org/x/image v0.36.0 // indirect
5658
golang.org/x/mobile v0.0.0-20260217195705-b56b3793a9c4 // indirect
57-
golang.org/x/sys v0.41.0 // indirect
59+
golang.org/x/sys v0.42.0 // indirect
5860
golang.org/x/term v0.40.0 // indirect
5961
golang.org/x/text v0.34.0 // indirect
60-
golang.org/x/time v0.14.0 // indirect
62+
golang.org/x/time v0.15.0 // indirect
6163
)

‎go.sum‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ github.com/alecthomas/repr v0.5.2 h1:SU73FTI9D1P5UNtvseffFSGmdNci/O6RsqzeXJtP0Qs
1414
github.com/alecthomas/repr v0.5.2/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
1515
github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwToPjQ=
1616
github.com/andybalholm/brotli v1.2.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
17-
github.com/ayn2op/tview v0.0.0-20260225014619-7f27f376aea9 h1:6zEOzR3v3bylvKLrNUiQ2ykVGzZilVKypdUU3EcVK7c=
18-
github.com/ayn2op/tview v0.0.0-20260225014619-7f27f376aea9/go.mod h1:lZ8RdOegQWBQafTOasGE7Ps1/Ymy4jmXoPt5vz2QsS0=
17+
github.com/ayn2op/clipboard v0.0.0-20260308203959-c5ad7df3fc97 h1:WujETUV+v0DEJyZgjeLzQvihWyL80c0Tg4qf0dDo+Io=
18+
github.com/ayn2op/clipboard v0.0.0-20260308203959-c5ad7df3fc97/go.mod h1:3kFnpNCa3dF6WryzOMCDao7PfZ7DTCh+pievlfuwV80=
19+
github.com/ayn2op/tview v0.0.0-20260311012550-9b46cad522bf h1:ay4OtKYsFGvK4Ng1pmZ/n8MA1CWzZO80lDlrDiCpdag=
20+
github.com/ayn2op/tview v0.0.0-20260311012550-9b46cad522bf/go.mod h1:lZ8RdOegQWBQafTOasGE7Ps1/Ymy4jmXoPt5vz2QsS0=
1921
github.com/danieljoos/wincred v1.2.3 h1:v7dZC2x32Ut3nEfRH+vhoZGvN72+dQ/snVXo/vMFLdQ=
2022
github.com/danieljoos/wincred v1.2.3/go.mod h1:6qqX0WNrS4RzPZ1tnroDzq9kY3fu1KwE7MRLQK4X0bs=
2123
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -25,10 +27,10 @@ github.com/dchest/jsmin v1.0.0 h1:Y2hWXmGZiRxtl+VcTksyucgTlYxnhPzTozCwx9gy9zI=
2527
github.com/dchest/jsmin v1.0.0/go.mod h1:AVBIund7Mr7lKXT70hKT2YgL3XEXUaUk5iw9DZ8b0Uc=
2628
github.com/deckarep/gosx-notifier v0.0.0-20180201035817-e127226297fb h1:6S+TKObz6+Io2c8IOkcbK4Sz7nj6RpEVU7TkvmsZZcw=
2729
github.com/deckarep/gosx-notifier v0.0.0-20180201035817-e127226297fb/go.mod h1:wf3nKtOnQqCp7kp9xB7hHnNlZ6m3NoiOxjrB9hFRq4Y=
28-
github.com/diamondburned/arikawa/v3 v3.6.1-0.20260226015332-783a3e8e8e86 h1:GJdiEzVS9Y7uUDfTmeChn9KWw+MJeS/FmNf6d8ZHQcg=
29-
github.com/diamondburned/arikawa/v3 v3.6.1-0.20260226015332-783a3e8e8e86/go.mod h1:TpV2GvCJIYSwAXUEAx4sutPcftyAbVidiFlG6l7K0go=
30-
github.com/diamondburned/ningen/v3 v3.0.1-0.20250920191746-98fbd92e134d h1:wS6HWl86RFItw38sUSdXlulj0VarV4G+9Rlv8j+p3oQ=
31-
github.com/diamondburned/ningen/v3 v3.0.1-0.20250920191746-98fbd92e134d/go.mod h1:9PWnJlArEASrZQI89KQiBJBYOEDcsDyfhFcxRTL8eO4=
30+
github.com/diamondburned/arikawa/v3 v3.6.1-0.20260309010533-e61165a61b64 h1:ZdzbwItbGTvOdNfoCH7QIbRiBPDufsq8AwfJUaM4mHM=
31+
github.com/diamondburned/arikawa/v3 v3.6.1-0.20260309010533-e61165a61b64/go.mod h1:TpV2GvCJIYSwAXUEAx4sutPcftyAbVidiFlG6l7K0go=
32+
github.com/diamondburned/ningen/v3 v3.0.1-0.20260306213430-5a08d3a709b4 h1:m1WyrOUuFE4BuIcQzPeRmmLQmJMBNElT/tfx/s2+AoE=
33+
github.com/diamondburned/ningen/v3 v3.0.1-0.20260306213430-5a08d3a709b4/go.mod h1:JSqSCBN5MAI9yjAO6tZlSayXM9KWx+8q3EhhlkCuscM=
3234
github.com/dlclark/regexp2 v1.11.5 h1:Q/sSnsKerHeCkc/jSTNq1oCm7KiVgUMZRDUoRu0JQZQ=
3335
github.com/dlclark/regexp2 v1.11.5/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
3436
github.com/esiqveland/notify v0.13.3 h1:QCMw6o1n+6rl+oLUfg8P1IIDSFsDEb2WlXvVvIJbI/o=
@@ -113,8 +115,6 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
113115
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
114116
go4.org v0.0.0-20260112195520-a5071408f32f h1:ziUVAjmTPwQMBmYR1tbdRFJPtTcQUI12fH9QQjfb0Sw=
115117
go4.org v0.0.0-20260112195520-a5071408f32f/go.mod h1:ZRJnO5ZI4zAwMFp+dS1+V6J6MSyAowhRqAE+DPa1Xp0=
116-
golang.design/x/clipboard v0.7.1 h1:OEG3CmcYRBNnRwpDp7+uWLiZi3hrMRJpE9JkkkYtz2c=
117-
golang.design/x/clipboard v0.7.1/go.mod h1:i5SiIqj0wLFw9P/1D7vfILFK0KHMk7ydE72HRrUIgkg=
118118
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
119119
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
120120
golang.org/x/exp/shiny v0.0.0-20260218203240-3dfff04db8fa h1:+7e7RPzOw2fG8DBbddatlOmHGNCg+VlA2Ar0yVMw7sM=
@@ -139,8 +139,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
139139
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
140140
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
141141
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
142-
golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k=
143-
golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
142+
golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo=
143+
golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
144144
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
145145
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
146146
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
@@ -153,8 +153,8 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
153153
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
154154
golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk=
155155
golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA=
156-
golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
157-
golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
156+
golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U=
157+
golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno=
158158
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
159159
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
160160
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=

‎internal/cache/cache.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func (c *Cache) Get(query string) uint {
3131
// the search limit.
3232
// "aa", "ab", "ac", ..., "ay" // where length is longer than the limit
3333
// if "ay" leaves, then "az" would not be loaded becaue it would not be
34-
// returned by the search results because of the search limit
34+
// returned by the search results because of the search limit.
3535
func (c *Cache) Invalidate(name string, limit uint) {
3636
for name != "" {
3737
if c.Exists(name) && c.Get(name) >= limit {

‎internal/clipboard/clipboard.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package clipboard
22

3-
import designClipb "golang.design/x/clipboard"
3+
import "github.com/ayn2op/clipboard"
44

5-
type Format = designClipb.Format
5+
type Format = clipboard.Format
66

77
const (
8-
FmtText Format = designClipb.FmtText
9-
FmtImage = designClipb.FmtImage
8+
FmtText Format = clipboard.FmtText
9+
FmtImage = clipboard.FmtImage
1010
)
Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1-
//go:build !linux
1+
//go:build !linux && !freebsd
22

33
package clipboard
44

5-
import designClipb "golang.design/x/clipboard"
6-
7-
var (
8-
Init = designClipb.Init
9-
Read = designClipb.Read
10-
Write = designClipb.Write
5+
import (
6+
"github.com/ayn2op/clipboard"
117
)
8+
9+
func Init() error {
10+
return clipboard.Init()
11+
}
12+
13+
func Read(t Format) ([]byte, error) {
14+
return clipboard.Read(clipboard.Format(t))
15+
}
16+
17+
func Write(t Format, buf []byte) error {
18+
return clipboard.Write(clipboard.Format(t), buf)
19+
}
Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
//go:build linux
1+
//go:build linux || freebsd
22

33
package clipboard
44

55
import (
66
"bytes"
7-
designClipb "golang.design/x/clipboard"
8-
"log/slog"
7+
"github.com/ayn2op/clipboard"
98
"os"
109
"os/exec"
1110
)
@@ -14,7 +13,7 @@ var wayland bool
1413

1514
func Init() error {
1615
if _, ok := os.LookupEnv("WAYLAND_DISPLAY"); !ok {
17-
return designClipb.Init()
16+
return clipboard.Init()
1817
}
1918
if _, err := exec.LookPath("wl-copy"); err != nil {
2019
return err
@@ -26,33 +25,29 @@ func Init() error {
2625
return nil
2726
}
2827

29-
func Read(t Format) []byte {
28+
func Read(t Format) ([]byte, error) {
3029
if !wayland {
31-
return designClipb.Read(designClipb.Format(t))
30+
return clipboard.Read(clipboard.Format(t))
3231
}
3332
// -n: Don't print a newline at the end
3433
// -t type: MIME type specifier
3534
cmd := exec.Command("wl-paste", "-nt", formatToType(t))
3635
outBuffer := bytes.Buffer{}
3736
cmd.Stdout = &outBuffer
3837
if err := cmd.Run(); err != nil {
39-
slog.Error("failed to read clipboard", "err", err)
40-
return nil
38+
return nil, err
4139
}
42-
return outBuffer.Bytes()
40+
return outBuffer.Bytes(), nil
4341
}
4442

45-
func Write(t Format, buf []byte) <-chan struct{} {
43+
func Write(t Format, buf []byte) error {
4644
if !wayland {
47-
return designClipb.Write(designClipb.Format(t), buf)
45+
return clipboard.Write(clipboard.Format(t), buf)
4846
}
4947
// -t type: MIME type specifier
5048
cmd := exec.Command("wl-copy", "-t", formatToType(t))
5149
cmd.Stdin = bytes.NewReader(buf)
52-
if err := cmd.Run(); err != nil {
53-
slog.Error("failed to write to clipboard", "err", err)
54-
}
55-
return nil
50+
return cmd.Run()
5651
}
5752

5853
func formatToType(t Format) string {

‎internal/config/config.toml‎

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ down = "ctrl+n"
169169
top = "home"
170170
bottom = "end"
171171

172-
# style = { foreground = "", background = "", attributes = "" or [""] }
172+
# style = { foreground = "", background = "", attributes = "" or ["",""], underline = "", underline_color = "" }
173173
[theme.title]
174174
alignment = "left" # `"left"`, `"center"`, or `"right"`.
175175
normal_style = { attributes = "dim" }
@@ -197,6 +197,15 @@ auto_expand_folders = true
197197
graphics = true
198198
graphics_color = "default"
199199

200+
# Guilds tree indentation for different item types
201+
[theme.guilds_tree.indents]
202+
dm = 2
203+
group_dm = 1
204+
guild = 2 # server inside a folder
205+
category = 1
206+
channel = 2
207+
forum = 2
208+
200209
[theme.scroll_bar]
201210
visibility = "auto"
202211
# "minimal", "box_drawing", or "unicode"
@@ -208,13 +217,23 @@ thumb_style = {}
208217
reply_indicator = ">"
209218
forwarded_indicator = "<"
210219

211-
mention_style = { foreground = "blue" }
220+
mention_style = { foreground = "blue", attributes = "bold" }
212221
emoji_style = { foreground = "green" }
213222
url_style = { foreground = "blue" }
214223
attachment_style = { foreground = "yellow" }
215224
message_style = {}
216225
selected_message_style = { attributes = "reverse" }
217226

227+
[theme.messages_list.embeds]
228+
provider_style = { attributes = ["dim", "italic"] }
229+
author_style = { attributes = "italic" }
230+
title_style = { foreground = "blue", attributes = "bold" }
231+
description_style = { attributes = "dim" }
232+
field_name_style = { attributes = ["bold", "underline"] }
233+
field_value_style = {}
234+
footer_style = { attributes = ["dim", "italic"] }
235+
url_style = { foreground = "blue", underline = "solid" }
236+
218237
[theme.mentions_list]
219238
# Note: width and height are capped to the avaliable space
220239
# Minimum width

0 commit comments

Comments
 (0)