()
| 10 | ) |
| 11 | |
| 12 | func (b *Bdiscord) getAllowedMentions() *discordgo.MessageAllowedMentions { |
| 13 | // If AllowMention is not specified, then allow all mentions (default Discord behavior) |
| 14 | if !b.IsKeySet("AllowMention") { |
| 15 | return nil |
| 16 | } |
| 17 | |
| 18 | // Otherwise, allow only the mentions that are specified |
| 19 | allowedMentionTypes := make([]discordgo.AllowedMentionType, 0, 3) |
| 20 | for _, m := range b.GetStringSlice("AllowMention") { |
| 21 | switch m { |
| 22 | case "everyone": |
| 23 | allowedMentionTypes = append(allowedMentionTypes, discordgo.AllowedMentionTypeEveryone) |
| 24 | case "roles": |
| 25 | allowedMentionTypes = append(allowedMentionTypes, discordgo.AllowedMentionTypeRoles) |
| 26 | case "users": |
| 27 | allowedMentionTypes = append(allowedMentionTypes, discordgo.AllowedMentionTypeUsers) |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | return &discordgo.MessageAllowedMentions{ |
| 32 | Parse: allowedMentionTypes, |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | func (b *Bdiscord) getNick(user *discordgo.User, guildID string) string { |
| 37 | b.membersMutex.RLock() |
no test coverage detected