Skip to content
/ telegramtemplate Public template

Telegram Template to get you started with your telegram bot projects

Notifications You must be signed in to change notification settings

mashaole/telegramtemplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Golang Telegram Bot Project Template

Telegram Template to get you started with your telegram bot projects

For the golang bot api library docs click Here

Prerequisites

This install assumes you are already running Git, Make sure you you have Golang installed on your machine
Telegram bot Token from BotFather
NB You must set bot token in config.json

Installation(Local)

NB You must set bot token in config.json

1.Clone this repository using git clone https://github.com/mashaole/telegramtemplate.git
2.Run make tidy to install required packages and add a vendor to your repo
3.Run make start

Deploy (Google App Engine)

NB You must set bot token in config.json

1.Clone this repository using git clone https://github.com/mashaole/telegramtemplate.git on gcp project terminal Cloud Shell
2.Run make tidy to install required packages and add a vendor to your repo
3.Run go build
4.Run gcloud app deploy
5.Open terminal and perform curl to set Telegram messages to your bot url curl --data "url=(Custom Url)/(handled route)" https://api.telegram.org/bot(botToken)/SetWebhook
E.g curl --data "url=https://mywbesite.com/bsjhdbsakjbdjks" https://api.telegram.org/bot1234567890:kdjakjsdlksajdkl-sldlakslk-aklsjhdkjha/SetWebhook

Usage

telegram.go

  • Telegram is initiated using InitTelegram() and theres a implentation for local environemnt and server environement(uses web hooks)
  • The deleteChatHistory() funtion is to clear screen when there is a new update.
  • The TelegramHandler() function handles updates from inline or simple keyboard.
  • The SendSimpleMessage() function handles sending simple message.
  • The SendInlineMessage() function handles sending Inline message.
  • The EditMessage() function handles editing message.
  • The CreateSimpleKeyBoard() returns Simlple Keyboard.
  • The CreateInlineKeyBoard() returns Inline Keyboard.

About

Telegram Template to get you started with your telegram bot projects

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published