Delete channel once request is accepted/declined
This commit is contained in:
parent
71bec93b58
commit
d7c884bf1d
17
main.go
17
main.go
@ -259,6 +259,7 @@ var (
|
|||||||
log.Println("Error sending message to the ticket channel:", err)
|
log.Println("Error sending message to the ticket channel:", err)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"accept": func(client *discordgo.Session, i *discordgo.InteractionCreate) {
|
"accept": func(client *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||||
data := i.MessageComponentData().CustomID
|
data := i.MessageComponentData().CustomID
|
||||||
parts := strings.Split(data, "_")
|
parts := strings.Split(data, "_")
|
||||||
@ -269,7 +270,6 @@ var (
|
|||||||
userID := parts[1]
|
userID := parts[1]
|
||||||
softwareType := parts[2]
|
softwareType := parts[2]
|
||||||
|
|
||||||
|
|
||||||
member, err := client.GuildMember(i.GuildID, userID)
|
member, err := client.GuildMember(i.GuildID, userID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("Error fetching member info:", err)
|
log.Println("Error fetching member info:", err)
|
||||||
@ -297,6 +297,13 @@ var (
|
|||||||
log.Println("Error sending interaction response:", err)
|
log.Println("Error sending interaction response:", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_,err = client.ChannelDelete(i.ChannelID)
|
||||||
|
if err != nil {
|
||||||
|
log.Println("Error deleting channel:", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
dmChannel, err := client.UserChannelCreate(userID)
|
dmChannel, err := client.UserChannelCreate(userID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("Error creating DM channel:", err)
|
log.Println("Error creating DM channel:", err)
|
||||||
@ -318,7 +325,6 @@ var (
|
|||||||
}
|
}
|
||||||
userID := parts[1]
|
userID := parts[1]
|
||||||
|
|
||||||
|
|
||||||
err := client.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
err := client.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
||||||
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
||||||
Data: &discordgo.InteractionResponseData{
|
Data: &discordgo.InteractionResponseData{
|
||||||
@ -330,6 +336,13 @@ var (
|
|||||||
log.Println("Error sending interaction response:", err)
|
log.Println("Error sending interaction response:", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_,err = client.ChannelDelete(i.ChannelID)
|
||||||
|
if err != nil {
|
||||||
|
log.Println("Error deleting channel:", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
dmChannel, err := client.UserChannelCreate(userID)
|
dmChannel, err := client.UserChannelCreate(userID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("Error creating DM channel:", err)
|
log.Println("Error creating DM channel:", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user