Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with kick - HTTP 403 Forbidden Error #1550

Open
krai-me opened this issue Jul 30, 2024 · 3 comments
Open

Issue with kick - HTTP 403 Forbidden Error #1550

krai-me opened this issue Jul 30, 2024 · 3 comments

Comments

@krai-me
Copy link

krai-me commented Jul 30, 2024

err- Error kicking from guild: HTTP 403 Forbidden, {"message": "Missing Permissions", "code": 50013}
even the bot has higher role than the person and has proper permissions but it isnt kicking..

code-

func channelDelete(s *discordgo.Session, c *discordgo.ChannelDelete) {
		currentTime := time.Now()

		if currentTime.Sub(lastResetTime) > timeWindow {
				channelDeletions = make(map[string]int)
				lastResetTime = currentTime
		}

		guildID := c.GuildID
		channelDeletions[guildID]++

		if channelDeletions[guildID] > deletionThreshold {
				err := s.GuildMemberDelete(guildID, s.State.User.ID)
				if err != nil {
						if err.Error() == "403 Forbidden" {
								fmt.Println("Error kicking bot from guild: Missing Permissions")
						} else {
								fmt.Println("Error kicking bot from guild:", err)
						}
				} else {
						fmt.Println("successfully kicked from guild due to excessive channel deletions")
				}
		}
}

its bug or what

Environment:

Library Version: latest
Go Version: latest

Additional Information:

The bot's role is confirmed to be the highest in the role hierarchy.
The bot's role has the Kick Members permission enabled.(even tested with admin)

@glotchimo
Copy link

A bot can't kick itself from a guild, but it can leave (GuildLeave)

@krai-me
Copy link
Author

krai-me commented Sep 11, 2024

A bot can't kick itself from a guild, but it can leave (GuildLeave)

wait i am kicking my bot itself its an antinuke type bot .. so if other bot exceeds limit it will be kicked

@glotchimo
Copy link

Yes, but you must leave, not kick, simply by API restrictions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants