MCPcopy
hub / github.com/42wim/matterbridge / getAllowedMentions

Method getAllowedMentions

bridge/discord/helpers.go:12–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10)
11
12func (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
36func (b *Bdiscord) getNick(user *discordgo.User, guildID string) string {
37 b.membersMutex.RLock()

Callers 4

handleEventBotUserMethod · 0.95
handleUploadFileMethod · 0.95
webhookSendMethod · 0.95
handleEventWebhookMethod · 0.95

Calls 2

IsKeySetMethod · 0.65
GetStringSliceMethod · 0.65

Tested by

no test coverage detected