diff --git a/plugins/urban.go b/plugins/urban.go index ef87312..bcf5f1f 100644 --- a/plugins/urban.go +++ b/plugins/urban.go @@ -17,6 +17,10 @@ import ( type Urban struct{} +// Keep the Urban Dictionary marker to the base code point so terminal clients +// do not have to interpret the optional emoji presentation selector U+FE0F. +const urbanPrefix = "🗣" + func (p *Urban) Name() string { return "urban" } func (p *Urban) Commands() []string { return []string{"urban", "u", "ud"} } func (p *Urban) Help() string { @@ -64,7 +68,7 @@ func (p *Urban) Handle(b *bot.Bot, m bot.Message) bool { if definition == "" { definition = "(empty definition)" } - b.Send(m.ReplyTarget(), fmt.Sprintf("🗣️ %s [%d/%d]: %s — %s", cleanExternalText(entry.Word), index, len(data.List), definition, cleanExternalText(entry.Permalink))) + b.Send(m.ReplyTarget(), fmt.Sprintf("%s %s [%d/%d]: %s — %s", urbanPrefix, cleanExternalText(entry.Word), index, len(data.List), definition, cleanExternalText(entry.Permalink))) return true } diff --git a/plugins/urban_test.go b/plugins/urban_test.go index 2dc445e..4221a20 100644 --- a/plugins/urban_test.go +++ b/plugins/urban_test.go @@ -13,6 +13,12 @@ func TestUrbanArgs(t *testing.T) { } } +func TestUrbanPrefixHasNoEmojiVariationSelector(t *testing.T) { + if urbanPrefix != "\U0001F5E3" { + t.Fatalf("urbanPrefix = %q, want only U+1F5E3 without U+FE0F", urbanPrefix) + } +} + func TestCleanExternalText(t *testing.T) { got := cleanExternalText("hello\x02 world\r\nagain") if got != "hello worldagain" {