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