package commands import ( "fmt" tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5" ) type DebugCommand struct{} func (d DebugCommand) Name() string { return "debug" } func (d DebugCommand) Help() string { return "Show debug info (admin only)" } func (d DebugCommand) Execute(update tgbotapi.Update, bot *tgbotapi.BotAPI) { user := update.Message.From if user == nil || !IsAdmin(user.ID) { msg := tgbotapi.NewMessage(update.Message.Chat.ID, "You are not authorized to use this command.") bot.Send(msg) return } info := fmt.Sprintf("UserID: %d\nChatID: %d\nText: %s", user.ID, update.Message.Chat.ID, update.Message.Text) msg := tgbotapi.NewMessage(update.Message.Chat.ID, info) bot.Send(msg) if update.Message.CommandArguments() == "panic" { panic("test panic") } } func init() { Register(DebugCommand{}) }