bot

package
v0.0.0-...-1e2a637 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Intents = 1535
)

Variables

View Source
var Handlers = []interface{}{
	func(session *discordgo.Session, interactionCreate *discordgo.InteractionCreate) {
		switch interactionCreate.Type {
		case discordgo.InteractionApplicationCommand:
			handler, exists := interactions.CommandHandlers[interactionCreate.ApplicationCommandData().Name]
			if !exists {
				interactions.InteractionRespondError(session, interactionCreate.Interaction, "Команда не найдена. Свяжитесь с администрацией.")
				return
			}
			handler(session, interactionCreate)
		case discordgo.InteractionMessageComponent:

			customID := strings.Split(interactionCreate.MessageComponentData().CustomID, ":")[0]
			handler, exists := interactions.ComponentHandlers[customID]
			if !exists {
				interactions.InteractionRespondError(session, interactionCreate.Interaction, "Команда не найдена. Свяжитесь с администрацией.")
				return
			}
			handler(session, interactionCreate)
		}
	},
	func(session *discordgo.Session, guildMemberRemove *discordgo.GuildMemberRemove) {
		err := db.RemoveUser(guildMemberRemove.User.ID)
		if err != nil {
			fmt.Printf("Error removing user: %v", err)
		}
	},
}

Functions

func AddHandlers

func AddHandlers(session *discordgo.Session)

func StartBot

func StartBot(token, mongoUri, mongoDatabaseName string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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