1
0
Fork 0
mirror of https://github.com/diamondburned/cchat-discord.git synced 2024-11-01 12:24:15 +00:00
cchat-discord/internal/segments/mention/channel.go

31 lines
509 B
Go
Raw Normal View History

package mention
import (
2020-12-20 05:44:26 +00:00
"github.com/diamondburned/arikawa/v2/discord"
"github.com/diamondburned/cchat-discord/internal/segments/renderer"
"github.com/diamondburned/cchat/text"
)
type Channel struct {
discord.Channel
}
func NewChannel(ch discord.Channel) *Channel {
return &Channel{
Channel: ch,
}
}
func (ch *Channel) MentionInfo() text.Rich {
var topic = ch.Topic
if ch.NSFW {
topic = "(NSFW)\n" + topic
}
if topic == "" {
return text.Rich{}
}
return renderer.Parse([]byte(topic))
}