Giter Club home page Giter Club logo

kbot's Introduction

Golang Telegram Bot Project

This repository is dedicated to a Telegram bot developed in the Go programming language, utilizing powerful libraries and API interactions to create a responsive and functional bot. This project is ideal for beginners looking to gain fundamental programming skills in Go and experience working with external APIs.

Overview

The purpose of this project is to develop a Telegram bot capable of processing and responding to user messages. By completing this project, developers will gain hands-on experience with Go, understand how to work with the Telegram Bot API, and learn how to design and implement bot functionality to interact with users.

Features

  • Language: Golang
  • Frameworks/Libraries: github.com/spf13/cobra and gopkg.in/telebot.v3
  • Functionality:
    • Message handler functions that reply to user messages in Telegram.
    • Integration of message handler functions into telebot.Bot methods.
    • Processing messages based on their type and content.

Getting Started

Prerequisites

  • Golang installed on your system.
  • Basic understanding of Git and GitHub.
  • A Telegram account to create and manage your bot.

Setup

  1. Environment Setup: If you're using Codespaces, it comes pre-configured with the necessary settings. Otherwise, ensure Golang is correctly installed and set up on your system.

  2. Project Initialization:

    • Create a new project on GitHub and clone it to your local machine.
    • Navigate to your project directory.
  3. Dependencies:

    • Add github.com/spf13/cobra to your project by importing it in your Go files.
    • Install gopkg.in/telebot.v3 by running go get gopkg.in/telebot.v3.
  4. Telegram Bot Creation:

    • Use BotFather in Telegram to create a new bot and obtain a bot token.
    • Save the bot token in an environment variable TELE_TOKEN.
  5. Development:

    • Import the necessary libraries in your Go files.
    • Create a telebot.Bot object with the bot token.
    • Implement message handler functions and attach them to the bot.
    • Compile and run your bot to test its functionality.

Running Your Bot

  1. Compile your bot using go build -ldflags "-X="github.com/illia-ilin/kbot/cmd.appVersion=v1.0.2.
  2. Run the compiled executable.
  3. Interact with your bot in Telegram to test its responses.

Example Usage

After setting up your bot and running it, you can interact with it on Telegram. Here's a simple command you can start with:

\start hello

Your bot should respond with a greeting message or a similar response based on your implementation.

Contributing

Contributions are welcome! Please feel free to submit pull requests or create issues for bugs and feature requests.

License

Distributed under the MIT License. See LICENSE for more information.

Acknowledgments

  • This project was inspired by the desire to learn Golang and explore the capabilities of the Telegram Bot API.
  • Thanks to the developers of cobra and telebot.v3 for their excellent libraries that make bot development more accessible.

kbot's People

Contributors

illia-ilin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.