mirror of
https://github.com/diamondburned/cchat-discord.git
synced 2024-11-01 12:24:15 +00:00
31 lines
509 B
Go
31 lines
509 B
Go
package mention
|
|
|
|
import (
|
|
"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))
|
|
}
|