mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-19 18:13:41 -05:00
hicli/send: add support for /me and /notice
This commit is contained in:
parent
0d3536a592
commit
4d7dbffe05
1 changed files with 9 additions and 0 deletions
|
@ -41,6 +41,14 @@ func (h *HiClient) SendMessage(
|
|||
mentions *event.Mentions,
|
||||
) (*database.Event, error) {
|
||||
var content event.MessageEventContent
|
||||
msgType := event.MsgText
|
||||
if strings.HasPrefix(text, "/me ") {
|
||||
msgType = event.MsgEmote
|
||||
text = strings.TrimPrefix(text, "/me ")
|
||||
} else if strings.HasPrefix(text, "/notice ") {
|
||||
msgType = event.MsgNotice
|
||||
text = strings.TrimPrefix(text, "/notice ")
|
||||
}
|
||||
if strings.HasPrefix(text, "/rainbow ") {
|
||||
text = strings.TrimPrefix(text, "/rainbow ")
|
||||
content = format.RenderMarkdownCustom(text, rainbowWithHTML)
|
||||
|
@ -54,6 +62,7 @@ func (h *HiClient) SendMessage(
|
|||
} else if text != "" {
|
||||
content = format.RenderMarkdown(text, true, true)
|
||||
}
|
||||
content.MsgType = msgType
|
||||
if base != nil {
|
||||
if text != "" {
|
||||
base.Body = content.Body
|
||||
|
|
Loading…
Add table
Reference in a new issue