~arsen/irc-discord-bridgebot

559557f67afc1e9003eaff0ba9d1ba33812ddb8f — Arsen Arsenović 2 years ago c99bbb5
irc: translate CTCP ACTION into _%s_

this matches discords behavior on /me
1 files changed, 13 insertions(+), 1 deletions(-)

M pkg/sides/irc/irc.go
M pkg/sides/irc/irc.go => pkg/sides/irc/irc.go +13 -1
@@ 470,13 470,25 @@ func (is *IRCSide) handleEvent(c *girc.Client, e girc.Event) {
			return
		}

		content := e.Last()

		if ctcp := girc.DecodeCTCP(&e); ctcp != nil {
			if ctcp.Reply {
				return
			}

			if ctcp.Command == girc.CTCP_ACTION {
				content = fmt.Sprintf("_%s_", ctcp.Text)
			}
		}

		is.Lock()
		defer is.Unlock()

		// this is too many but w/e
		permittedMentionIDs := make([]string, 10)[:0]

		msg := is.highlightsRegex.ReplaceAllStringFunc(e.Last(),
		msg := is.highlightsRegex.ReplaceAllStringFunc(content,
			func(match string) string {
				id, found := is.nickMap[match]
				if !found {