diff --git a/README.md b/README.md index e163695..8152935 100644 --- a/README.md +++ b/README.md @@ -35,28 +35,20 @@ Go is more portable than Node.js - [ ] AFK toggle (A) - [ ] Send DM (s) - [ ] Answer DM (a) - - [x] Current time (+) - - [ ] DM history (TBD) - - [ ] Reply to message (TBD) - - [ ] Toggle color (z) - [x] Message Receiving - Markdown styling - [x] Emotes - - [x] Timestamp parsing + - [ ] Timestamp parsing - [x] Mentions parsing - - [ ] Embeds - - [ ] Plain links with title = commode's posted links + - [ ] Embeds in the style of commode's posted links - [x] Messages wrapped in `*`'s or `_`'s parsed as emotes - [x] Inline DMs to replicate commode's private messages - [x] Replies - [ ] Group DMs - - [ ] Only works with user accounts, might not even be worth doing - [x] Message sending - [x] Puts incoming messages into queue whilst in send mode - - [x] Send typing - - [ ] Mentioning - [x] Configuration - [x] Write token from argv into rc file if rc file doesn't exist - [x] Default guild/channel -- [ ] Threads/Forums +- [ ] Threads - [ ] External rich presence when using bot accounts diff --git a/commands/send.go b/commands/send.go index 5870b21..0ba88ce 100644 --- a/commands/send.go +++ b/commands/send.go @@ -68,8 +68,6 @@ func SendMode() { prompt = ansi.Color(prompt, "cyan+b") } - client.Typing(channel.ID) - lib.MakePrompt(prompt, true, func(input string, interrupt bool) { if input == "" { if interrupt { diff --git a/events/main.go b/events/main.go index a006c57..bdd20ed 100644 --- a/events/main.go +++ b/events/main.go @@ -8,6 +8,5 @@ func Setup(session *ningen.State) { session.PreHandler.AddHandler(Ready) session.PreHandler.AddHandler(MessageCreate) session.PreHandler.AddHandler(MessageUpdate) - session.PreHandler.AddHandler(ReactionAdd) SetupClock() } diff --git a/events/reactions.go b/events/reactions.go deleted file mode 100644 index 4624973..0000000 --- a/events/reactions.go +++ /dev/null @@ -1,56 +0,0 @@ -package events - -import ( - "fmt" - "time" - - "github.com/Cynosphere/comcord/lib" - "github.com/Cynosphere/comcord/state" - "github.com/diamondburned/arikawa/v3/discord" - "github.com/diamondburned/arikawa/v3/gateway" -) - -func ReactionAdd(event *gateway.MessageReactionAddEvent) { - client := state.GetClient() - currentChannel := state.GetCurrentChannel() - - if event.ChannelID.String() != currentChannel { - return - } - - emote := event.Emoji.Name - if event.Emoji.IsCustom() { - emote = ":" + emote + ":" - } - - now := time.Now() - nowSnowflake := discord.NewSnowflake(now) - - message, err := client.MessageStore.Message(event.ChannelID, event.MessageID) - if err != nil { - message, err = client.Message(event.ChannelID, event.MessageID) - if err != nil { - return - } - } - - msg := discord.Message{ - Content: fmt.Sprintf("*reacted with %s*", emote), - Author: event.Member.User, - ChannelID: event.ChannelID, - GuildID: event.GuildID, - ID: discord.MessageID(nowSnowflake), - ReferencedMessage: message, - Type: discord.InlinedReplyMessage, - Timestamp: discord.Timestamp(now), - } - - if state.IsInPrompt() { - state.AddMessageToQueue(msg) - } else { - lines := lib.ProcessMessage(msg, lib.MessageOptions{NoColor: state.HasNoColor()}) - for _, line := range lines { - fmt.Print(line) - } - } -} diff --git a/lib/messages.go b/lib/messages.go index 5140eee..e49422c 100644 --- a/lib/messages.go +++ b/lib/messages.go @@ -301,6 +301,7 @@ func FormatMessage(options MessageOptions) []string { } } else { content := options.Content + content = ReplaceMarkdown(content, options.NoColor) if options.IsDM { name := fmt.Sprintf("*%s*", options.Name) @@ -308,8 +309,6 @@ func FormatMessage(options MessageOptions) []string { name = ansi.Color(name, "red+b") } - content = ReplaceMarkdown(content, options.NoColor) - lines = append(lines, fmt.Sprintf("%s %s\x07\n\r", name, content)) } else if utf8.RuneCountInString(content) > 1 && (strings.HasPrefix(content, "*") && strings.HasSuffix(content, "*") && !strings.HasPrefix(content, "**") && !strings.HasSuffix(content, "**")) || @@ -354,8 +353,6 @@ func FormatMessage(options MessageOptions) []string { nameColor = "yellow+b" } - content = ReplaceMarkdown(content, options.NoColor) - name := fmt.Sprintf("[%s]", options.Name) if !options.NoColor { name = ansi.Color(name, nameColor) @@ -480,7 +477,6 @@ func ProcessMessage(msg discord.Message, options MessageOptions) []string { if i == 0 { options.Reply = msg.ReferencedMessage } - options.Timestamp = time.Time(msg.Timestamp) options.IsMention = isPing options.IsDM = isDM options.IsJoin = msg.Type == discord.GuildMemberJoinMessage @@ -501,7 +497,6 @@ func ProcessMessage(msg discord.Message, options MessageOptions) []string { options.Attachments = msg.Attachments options.Stickers = msg.Stickers options.Reply = msg.ReferencedMessage - options.Timestamp = time.Time(msg.Timestamp) options.IsMention = isPing options.IsDM = isDM options.IsJoin = msg.Type == discord.GuildMemberJoinMessage diff --git a/main.go b/main.go index 763d52b..76ace95 100644 --- a/main.go +++ b/main.go @@ -128,9 +128,7 @@ func main() { client.AddIntents(gateway.IntentGuildPresences) client.AddIntents(gateway.IntentGuildMembers) client.AddIntents(gateway.IntentGuildMessages) - client.AddIntents(gateway.IntentGuildMessageReactions) client.AddIntents(gateway.IntentDirectMessages) - client.AddIntents(gateway.IntentDirectMessageReactions) client.AddIntents(gateway.IntentMessageContent) state.Setup(config, client)