Tabs
This commit is contained in:
parent
7eebc01816
commit
2a42301c25
20
main.go
20
main.go
@ -21,9 +21,9 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Discord Discord `toml:"discord"`
|
Discord Discord `toml:"discord"`
|
||||||
Database Database `toml:"database"`
|
Database Database `toml:"database"`
|
||||||
AdminRoles []string `toml:"admin_roles"`
|
AdminRoles []string `toml:"admin_roles"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Discord struct {
|
type Discord struct {
|
||||||
@ -108,12 +108,11 @@ func getUsernameFromMember(member *discordgo.Member) string {
|
|||||||
} else if member.User != nil && member.User.Username != "" {
|
} else if member.User != nil && member.User.Username != "" {
|
||||||
userName = member.User.Username
|
userName = member.User.Username
|
||||||
} else {
|
} else {
|
||||||
userName = "UnknownUser"
|
userName = "UnknownUser"
|
||||||
}
|
}
|
||||||
return userName
|
return userName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
commands = []discordgo.ApplicationCommand{
|
commands = []discordgo.ApplicationCommand{
|
||||||
{
|
{
|
||||||
@ -230,9 +229,9 @@ var (
|
|||||||
ParentID: categoryID,
|
ParentID: categoryID,
|
||||||
PermissionOverwrites: []*discordgo.PermissionOverwrite{
|
PermissionOverwrites: []*discordgo.PermissionOverwrite{
|
||||||
{
|
{
|
||||||
ID: guildID,
|
ID: guildID,
|
||||||
Type: discordgo.PermissionOverwriteTypeRole,
|
Type: discordgo.PermissionOverwriteTypeRole,
|
||||||
Deny: discordgo.PermissionViewChannel,
|
Deny: discordgo.PermissionViewChannel,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -375,10 +374,10 @@ func canCreateTicket(userName, softwareType string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, channel := range guildChannels {
|
for _, channel := range guildChannels {
|
||||||
if channel.Type == discordgo.ChannelTypeGuildText && channel.ParentID == config.Discord.CategoryID {
|
if channel.Type == discordgo.ChannelTypeGuildText && channel.ParentID == config.Discord.CategoryID {
|
||||||
expectedName := fmt.Sprintf("reset-%s-%s", softwareType, userName)
|
expectedName := fmt.Sprintf("reset-%s-%s", softwareType, userName)
|
||||||
if channel.Name == expectedName {
|
if channel.Name == expectedName {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -441,4 +440,3 @@ func main() {
|
|||||||
db.Close()
|
db.Close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user