Skip to content

Commit

Permalink
retry with emojies
Browse files Browse the repository at this point in the history
  • Loading branch information
fbuetler committed Mar 29, 2024
1 parent 957bdc0 commit 1f4d1ba
Showing 1 changed file with 25 additions and 32 deletions.
57 changes: 25 additions & 32 deletions pkg/controller/DiscordController.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func (dc *DiscordController) GetDiscordUserCard(searchString string, buttonsEnab

if !shortCard {
// Available VLANs
// var vlanRow discordgo.ActionsRow
var vlanRow discordgo.ActionsRow
vlansMissing := false
if len(user.Sessions) > 0 {
switchIP := user.Sessions[0].SwitchIP
Expand All @@ -233,30 +233,27 @@ func (dc *DiscordController) GetDiscordUserCard(searchString string, buttonsEnab
vlansMissing = true
} else {
log.Debug("crafting vlan menu")
/*
skip vlan menu because of https://github.com/bwmarrin/discordgo/pull/1476
var vlanMenu []discordgo.SelectMenuOption
for _, vlan := range switchRef.Vlans {
isDefault := switchRef.PrimaryVlan == vlan
vlanMenu = append(vlanMenu, discordgo.SelectMenuOption{
Description: vlan.Description,
Value: fmt.Sprint(vlan.VlanID),
Label: fmt.Sprintf("VLAN %d (%s) - %s", vlan.VlanID, vlan.Name, vlan.IpRange.String()),
Default: isDefault,
})
}
vlanRow = discordgo.ActionsRow{
Components: []discordgo.MessageComponent{
discordgo.SelectMenu{
MaxValues: 1,
CustomID: "findVlanSelect",
Placeholder: "Default VLAN",
Options: vlanMenu,
Disabled: !buttonsEnabled,
},
var vlanMenu []discordgo.SelectMenuOption
for _, vlan := range switchRef.Vlans {
isDefault := switchRef.PrimaryVlan == vlan
vlanMenu = append(vlanMenu, discordgo.SelectMenuOption{
Description: vlan.Description,
Value: fmt.Sprint(vlan.VlanID),
Label: fmt.Sprintf("VLAN %d (%s) - %s", vlan.VlanID, vlan.Name, vlan.IpRange.String()),
Default: isDefault,
})
}
vlanRow = discordgo.ActionsRow{
Components: []discordgo.MessageComponent{
discordgo.SelectMenu{
MaxValues: 1,
CustomID: "findVlanSelect",
Placeholder: "Default VLAN",
Options: vlanMenu,
Disabled: !buttonsEnabled,
},
}
*/
},
}
}
} else {
log.Debug("vlan is missing")
Expand Down Expand Up @@ -295,21 +292,17 @@ func (dc *DiscordController) GetDiscordUserCard(searchString string, buttonsEnab
}

if !vlansMissing {
/*
card.Components = append(card.Components, vlanRow)
*/
card.Components = append(card.Components, vlanRow)
log.Debug("adding 'cancel' button to action menu")
actions = append(actions, discordgo.Button{
Label: "Cancel",
Style: discordgo.SecondaryButton,
Disabled: !buttonsEnabled,
CustomID: "findCancelBtn",
})
/*
card.Components = append(card.Components, discordgo.ActionsRow{
Components: actions,
})
*/
card.Components = append(card.Components, discordgo.ActionsRow{
Components: actions,
})
}
}

Expand Down

0 comments on commit 1f4d1ba

Please sign in to comment.