Settings is the configuration object passed to NewBot. Every field is optional except Token.
Fields
The Telegram Bot API token issued by @BotFather. This is the only required field.
Base URL of the Telegram Bot API server. Defaults to
https://api.telegram.org when empty.Override this to use a local Bot API server:Buffer capacity of the internal
Updates channel. Defaults to 100 when zero.Increase this if your bot receives bursts of updates faster than handlers can process them.The update provider used by
b.Start(). Defaults to &LongPoller{} when nil.Telebot ships two built-in pollers:| Type | Description |
|---|---|
*LongPoller | Classic long-polling. Configure Timeout, Limit, and AllowedUpdates. |
*Webhook | Receives updates via an HTTPS webhook endpoint. |
When
true, handlers run sequentially in the same goroutine as the update loop. ProcessUpdate returns only after the handler finishes.When false (the default), each handler is launched in its own goroutine.When
true, every outgoing API request is logged via the error handler. Use only for debugging — the output is verbose.Default parse mode attached to every
Send, Edit, and similar call. Can be overridden per-message by passing a ParseMode in opts.See ParseMode constants below.Callback invoked whenever a handler returns an error, or when an internal error occurs. The
Context argument may be nil for non-handler errors.Defaults to log.Println(update.ID, err) when nil.HTTP client used for all Telegram API requests. Defaults to
&http.Client{Timeout: time.Minute} when nil.Override to set custom timeouts, a proxy, or transport-level settings:When
true, NewBot skips the initial getMe call and sets b.Me to an empty &User{}. No network access occurs during construction.Intended for unit testing or environments without internet access.ParseMode Constants
ParseMode is a type alias for string. The following constants are defined:
| Constant | Value | Description |
|---|---|---|
tele.ModeDefault | "" | No parse mode. Message text is sent as-is. |
tele.ModeMarkdown | "Markdown" | Legacy Markdown (Telegram v1). Limited entity support. |
tele.ModeMarkdownV2 | "MarkdownV2" | Updated Markdown with stricter escaping rules. |
tele.ModeHTML | "HTML" | HTML subset: <b>, <i>, <u>, <s>, <code>, <pre>, <a>. |
Example: Fully Configured Settings
Minimal Settings
OnlyToken and Poller are needed for a working bot:
If
Poller is omitted, NewBot will set it to &LongPoller{} (with zero timeout), which still works but polls as fast as the API allows. Always set an appropriate Timeout.