Update pnut library to include api fixes and include embedded links #2

Merged
spacenerdmo merged 2 commits from message_fixes into main 2023-12-10 18:27:46 +00:00
3 changed files with 11 additions and 12 deletions
Showing only changes of commit 9c019a3abf - Show all commits

View file

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021 Morgan McMillian
Copyright (c) 2023 Morgan McMillian
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -2,20 +2,13 @@
A [matterbridge] API plugin allowing you to connect message channels on [pnut.io] to other supported chat services.
## Contributing
Report bugs or submit patches via [email].
Join my public chat room for development discussion.
- [#devel:mcmillian.ems.host]
## License
```
MIT License
Copyright (c) 2021 Morgan McMillian
Copyright (c) 2023 Morgan McMillian
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -38,5 +31,3 @@ SOFTWARE.
[matterbridge]: https://github.com/42wim/matterbridge
[pnut.io]: https://pnut.io
[email]: https://morgan.mcmillian.dev/contact
[#devel:mcmillian.ems.host]: https://matrix.to/#/#devel:mcmillian.ems.host

View file

@ -176,9 +176,17 @@ func pnutMsgHandler(conf *Config, msg woodstock.Message) {
if msg.User.Username == conf.PnutUsername {
return
}
msgtext := msg.Content.Text
linktext := ""
for _, v := range msg.Content.Entities.Links {
linktext = "| " + linktext + v.URL + "\n"
}
if len(linktext) > 0 {
msgtext = msgtext + "\n\n" + linktext
}
log.Printf(">> sending message from channel %s to %s ...", msg.ChannelID, gateway)
data := MbOutMsg{
Text: msg.Content.Text,
Text: msgtext,
Username: msg.User.Username,
Gateway: gateway,
}