- Added new music commands: play, queue, and volume. - Implemented music management using disgolink for Lavalink integration. - Updated bot initialization to include Lavalink host and password. - Enhanced interaction handling for music commands, requiring DJ role for usage. - Introduced now playing message with interactive buttons for controlling playback. - Updated dependencies in go.mod for disgolink and snowflake.
37 lines
566 B
Go
37 lines
566 B
Go
package public
|
|
|
|
import "github.com/bwmarrin/discordgo"
|
|
|
|
func memberHasDJRole(s *discordgo.Session, guildID string, m *discordgo.Member) bool {
|
|
if s == nil || guildID == "" || m == nil {
|
|
return false
|
|
}
|
|
if len(m.Roles) == 0 {
|
|
return false
|
|
}
|
|
|
|
roles, err := s.GuildRoles(guildID)
|
|
if err != nil {
|
|
return false
|
|
}
|
|
|
|
djRoleID := ""
|
|
for _, r := range roles {
|
|
if r != nil && r.Name == "DJ" {
|
|
djRoleID = r.ID
|
|
break
|
|
}
|
|
}
|
|
if djRoleID == "" {
|
|
return false
|
|
}
|
|
|
|
for _, rid := range m.Roles {
|
|
if rid == djRoleID {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|