ban

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BanCommand = discord.SlashCommandCreate{
	Name:                     "ban",
	Description:              "Ban a user from the server",
	Contexts:                 []discord.InteractionContextType{discord.InteractionContextTypeGuild},
	IntegrationTypes:         []discord.ApplicationIntegrationType{discord.ApplicationIntegrationTypeGuildInstall},
	DefaultMemberPermissions: omit.NewPtr(discord.PermissionBanMembers),
	Options: []discord.ApplicationCommandOption{

		discord.ApplicationCommandOptionUser{
			Name:        "user",
			Description: "The user to ban",
			Required:    true,
		},
		discord.ApplicationCommandOptionString{
			Name:        "reason",
			Description: "Reason for banning the user. Not sent to the user. (Defaults to message)",
			Required:    false,
		},
		discord.ApplicationCommandOptionString{
			Name:        "message",
			Description: "The message sent to the user when banned.",
			Required:    false,
		},
		discord.ApplicationCommandOptionString{
			Name:        "duration",
			Description: "The duration to ban the user for",
			Required:    false,
			Choices:     durationChoices,
		},
		discord.ApplicationCommandOptionInt{
			Name:        "delete-messages",
			Description: "Whether to delete recent messages when banning the user",
			Required:    false,
			Choices: []discord.ApplicationCommandOptionChoiceInt{
				{
					Name:  "Do not delete messages",
					Value: 0,
				},
				{
					Name:  "Last 15 minutes",
					Value: 15 * 60,
				},
				{
					Name:  "Last 30 minutes",
					Value: 30 * 60,
				},
				{
					Name:  "Last hour",
					Value: 60 * 60,
				},
				{
					Name:  "Last 2 hours",
					Value: 2 * 60 * 60,
				},
				{
					Name:  "Last 4 hours",
					Value: 4 * 60 * 60,
				},
				{
					Name:  "Last 12 hours",
					Value: 12 * 60 * 60,
				},
				{
					Name:  "Last 24 hours",
					Value: 24 * 60 * 60,
				},
				{
					Name:  "Last 2 days",
					Value: 2 * 24 * 60 * 60,
				},
				{
					Name:  "Last week",
					Value: 7 * 24 * 60 * 60,
				},
			},
		},
		discord.ApplicationCommandOptionBool{
			Name:        "dont-auto-dm",
			Description: "Override server-default always send ban footer. message/duration will still trigger it",
		},
	},
}

Functions

func BanHandler

func BanHandler(e *handler.CommandEvent) error

Types

type BanHandlerData

type BanHandlerData struct {
	User *discord.User
	// BanningUserID is used when parsing the ID, when there is no REST client
	// available.
	BanningUserID snowflake.ID
	BanningUser   *discord.User
	Guild         *discord.Guild
	Duration      string
	Reason        string
	Message       string
}

func BanHandlerDataFromString

func BanHandlerDataFromString(s string) (data BanHandlerData)

func (BanHandlerData) String

func (data BanHandlerData) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL