|
|
@@ -6,6 +6,7 @@ import (
|
|
|
"github.com/ayntgl/discordgo"
|
|
|
)
|
|
|
|
|
|
+// ChannelToString constructs a string representation of the given channel. The string representation may vary for different channel types.
|
|
|
func ChannelToString(c *discordgo.Channel) string {
|
|
|
var repr string
|
|
|
if c.Name != "" {
|
|
|
@@ -25,6 +26,7 @@ func ChannelToString(c *discordgo.Channel) string {
|
|
|
return repr
|
|
|
}
|
|
|
|
|
|
+// ChannelIsUnread returns `true` if the given channel is marked as read by the client user, otherwise `false`.
|
|
|
func ChannelIsUnread(s *discordgo.State, c *discordgo.Channel) bool {
|
|
|
if c.LastMessageID == "" {
|
|
|
return false
|
|
|
@@ -39,6 +41,7 @@ func ChannelIsUnread(s *discordgo.State, c *discordgo.Channel) bool {
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
+// FindMessageByID returns the index and the `*Message` struct of the current message if the given message ID *mID* is equal to the current message ID. If the given message ID *mID* is not found in the given slice *ms*, `-1` and `nil` are returned instead.
|
|
|
func FindMessageByID(ms []*discordgo.Message, mID string) (int, *discordgo.Message) {
|
|
|
for i, m := range ms {
|
|
|
if m.ID == mID {
|