A powerful and flexible Telegram bot library for Go!
🚀 **Coming Soon:** This library is currently for our private use, although we are developing it for public release.
We'll soon release it for public use!
- Easy Integration: Simple and straightforward integration with your Go projects.
- Flexible Functionality: Customize and extend the bot's functionality according to your needs.
- Fast and Efficient: Built using Go's concurrency features for optimal performance.
- Rich Documentation: Comprehensive documentation to help you get started quickly.
Download the library with the standard go get command:
go get github.com/LibraryGo/gotelebot/v1
package main
import (
"log"
"os"
"time"
"github.com/LibraryGo/gotelebot/v1"
)
func main() {
// Get bot token from environment variable
token := os.Getenv("TELEGRAM_BOT_TOKEN")
if token == "" {
log.Fatal("TELEGRAM_BOT_TOKEN environment variable is not set")
}
// Create a new instance of the bot
bot, err := gotelebot.NewBot(token)
if err != nil {
log.Fatalf("Failed to create bot: %s", err)
}
// Add message handler
bot.AddMessageHandler(HandleMessage)
// Start receiving updates
err = bot.StartPolling(&gotelebot.PollingOptions{Timeout: 10})
if err != nil {
log.Fatalf("Failed to start bot: %s", err)
}
for {
time.Sleep(time.Second)
}
}
// HandleMessage is a message handler function
func HandleMessage(bot *gotelebot.Bot, message *gotelebot.Message) {
if message.Text != "" {
bot.SendMessage(message.Chat.ID, "You said: "+message.Text, nil)
}
}
For detailed usage instructions, refer to the documentation.
We welcome contributions! If you'd like to contribute to LibraryGo - GoTeleBot, please check out the contribution guidelines.
🛠️ Stay Updated: Fork, star, and watch the repository to keep up with our latest updates. Your support means the world to us. Thank you!
LibraryGo - GoTeleBot is licensed under the MIT License.
- Telegram: @ankit_chaubey
- Write in Bot: @ChaubeyBot
Feel free to reach out if you have any questions, ideas, or feedback!
Made with ❤️ by Ankit Chaubey