1
0
mirror of https://github.com/Rudi9719/kbtui.git synced 2026-03-31 06:23:31 +00:00
Files
kbtui/cmdDelete.go
Casper Weiss Bang 439f09aa1c Mo' colors
Changes:
- Stream is colored now
- Stream is formatted
- Stream has it's own formatting option
- Colors are now a style, and is a struct
- Color struct has a pretty cool functional interface
- colored mentions and PMs
- Every message uses the same function (it's dry!!)
- Colorize errors!
- Create function for visualizing errors
- colorized some of the command output!
- Color is stored in a Style
- Create a Text struct that can use to stylize strings "easily"
- Text can be used to build strings
- color highlighting on code
- added tml config support
- added different color for mention url
- Added sprintf to use formatting with PrintFeed and PrintError

Known Bugs: (added as todos whereever)
- Cannot use multiple formatting at the same time (*bold _italic_*
doesn't work
- sprintf is pretty shit
- background doesn't cover as a `block` in codeblocks
- not possible to escape sprintf thing
2019-10-23 23:45:42 +02:00

34 lines
603 B
Go

// +build !rm_basic_commands allcommands deletecmd
package main
import (
"strconv"
)
func init() {
command := Command{
Cmd: []string{"delete", "del", "-"},
Description: "$messageId - Delete a message by $messageId",
Help: "",
Exec: cmdDelete,
}
RegisterCommand(command)
}
func cmdDelete(cmd []string) {
var messageID int
if len(cmd) > 1 {
messageID, _ = strconv.Atoi(cmd[1])
} else {
messageID = lastMessage.ID
}
chat := k.NewChat(channel)
_, err := chat.Delete(messageID)
if err != nil {
printError("There was an error deleting your message.")
}
}