{"id":19811537,"url":"https://github.com/beverlyroadgoose/fuse","last_synced_at":"2025-07-14T00:39:57.662Z","repository":{"id":42507400,"uuid":"463221995","full_name":"beverlyRoadGoose/fuse","owner":"beverlyRoadGoose","description":"A Go library for developing Telegram bots.","archived":false,"fork":false,"pushed_at":"2024-03-04T09:25:54.000Z","size":167,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"dev","last_synced_at":"2025-01-11T07:14:54.775Z","etag":null,"topics":["telegram","telegram-bot","telegram-bot-api"],"latest_commit_sha":null,"homepage":"https://fuse.heytobi.dev","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beverlyRoadGoose.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-24T16:35:08.000Z","updated_at":"2022-12-03T17:47:48.000Z","dependencies_parsed_at":"2024-06-20T03:02:05.962Z","dependency_job_id":"32818d4c-daed-453a-9612-b6ec15e5de84","html_url":"https://github.com/beverlyRoadGoose/fuse","commit_stats":null,"previous_names":[],"tags_count":58,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beverlyRoadGoose%2Ffuse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beverlyRoadGoose%2Ffuse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beverlyRoadGoose%2Ffuse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beverlyRoadGoose%2Ffuse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beverlyRoadGoose","download_url":"https://codeload.github.com/beverlyRoadGoose/fuse/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241156667,"owners_count":19919341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["telegram","telegram-bot","telegram-bot-api"],"created_at":"2024-11-12T09:26:51.221Z","updated_at":"2025-02-28T13:20:17.482Z","avatar_url":"https://github.com/beverlyRoadGoose.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/beverlyRoadGoose/fuse)\n[![GoDoc](https://godoc.org/heytobi.dev/fuse?status.svg)](https://godoc.org//heytobi.dev/fuse)\n[![GitHub Actions](https://github.com/beverlyRoadGoose/fuse/actions/workflows/ci.yaml/badge.svg)](https://github.com/beverlyRoadGoose/fuse/actions/workflows/ci.yaml)\n[![Go Report Card](https://goreportcard.com/badge/heytobi.dev/fuse)](https://goreportcard.com/report/heytobi.dev/fuse)\n[![codecov.io](https://codecov.io/gh/beverlyRoadGoose/fuse/coverage.svg?branch=dev)](https://codecov.io/gh/beverlyRoadGoose/fuse)\n[![GitHub tag (latest SemVer)](https://img.shields.io/github/v/release/beverlyRoadGoose/fuse?include_prereleases)](https://github.com/beverlyRoadGoose/fuse/releases)\n\nFuse is a Go library for developing [Telegram](https://telegram.org/) bots, using the [Telegram Bot API](https://core.telegram.org/bots/api).\n\n⚠️ I'm developing this for use in a hobby project, In the initial phase I'm only adding features as needed in the main \nproject. Overtime I'll aim to cover much of what the Telegram API provides. This also means some things might initially \nbe experimental and breaking changes are possible.\n\n## Installation\n```console\nyou@pc:~$ go get -u heytobi.dev/fuse\n```\n\n## Current Features\n✔️ Register Webhooks  \n✔️ Receive updates through Webhooks  \n✔️ Receive updates through polling  \n✔️ Send Messages  \n✔️ Supports Local Bot API Servers \n\n## Usage\n### Getting Updates through long polling\n#### Steps\n1. Initialize a Bot\n2. Register command handlers\n3. Start polling for updates\n\n```go\nhttpClient := \u0026http.Client{}\nconfig := \u0026telegram.Config{\n    Token:               \"\u003cYOUR TELEGRAM TOKEN\u003e\",\n    UpdateMethod:        telegram.UpdateMethodGetUpdates,\n    PollingIntervalMS:   1000,\n    PollingTimeout:      30,\n    PollingUpdatesLimit: 100,\n}\n\npoller, err := telegram.NewPoller(telegramConfig, httpClient)\nif err != nil {\n    return nil, errors.New(\"failed to initialize telegram poller\")\n}\n\nbot, err := telegram.NewBot(telegramConfig, httpClient)\nif err != nil {\n    return nil, errors.New(\"failed to initialize telegram instance\")\n}\n\nbot = bot.WithPoller(poller)\n\nbot.RegisterHandler(\"/start\", func(ctx context.Context, update *telegram.Update) {\n    result, err := bot.Send(telegram.SendMessageRequest{\n        ChatID: update.Message.Chat.ID,\n        Text:   \" ¯\\_(ツ)_/¯\",\n    })\n\n    if err != nil {\n        log.Error(\"failed to send telegram message\")\n    }\n\n    if !result.Successful {\n        log.Warn(fmt.Sprintf(\"failed to send telegram message: %s\", result.Description))\n    }\n})\n\nbot.Start() // start listening for updates.\n\n```\n\n### Getting Updates through a Webhook\n#### Steps\n1. Initialize a Bot\n2. Register a Webhook\n3. Register command handlers\n4. Call the process update method directly whenever your webhook is invoked\n\n```go\nhttpClient := \u0026http.Client{}\nconfig := \u0026telegram.Config{\n    Token:        \"\u003cYOUR TELEGRAM TOKEN\u003e\",\n    UpdateMethod: telegram.UpdateMethodWebhook,\n}\n\nbot, err := telegram.Init(config, httpClient)\nif err != nil {\n    log.Fatal(\"failed to initialize telegram bot\")\n}\n\nbot.RegisterWebhook(telegram.Webhook{url: \"mywebhook.com/notify\"})\nif err != nil {\n    log.Fatal(\"failed to register webhook\")\n}\n\nbot.RegisterHandler(\"/start\", func(ctx context.Context, update *telegram.Update) {\n    result, err := bot.Send(telegram.SendMessageRequest{\n        ChatID: update.Message.Chat.ID,\n        Text:   \" ¯\\_(ツ)_/¯\",\n    })\n\n    if err != nil {\n        log.Error(\"failed to send telegram message\")\n    }\n\n    if !result.Successful {\n        log.Warn(fmt.Sprintf(\"failed to send telegram message: %s\", result.Description))\n    }\n})\n\n// In your webhook http handler:\nbot.ProcessUpdate(Update{}) // the update parameter should be deserialized from the request body.\n```\n\n### Using a Local Bot API Server\nIf you are [running a Local Bot API Server](https://core.telegram.org/bots/api#using-a-local-bot-api-server), you can\nspecify the host and the port (if applicable) using the fields exposed in the config struct:\n\n```go\nconfig := \u0026telegram.Config{\n    BotApiServer: \"https://localserver.net\",\n    BotApiServerPort: 1234,\n}\n```\n\n### Documentation\nThe full documentation with examples is available at [fuse.heytobi.dev](https://fuse.heytobi.dev/)\n\n## License\n```\nMIT License\n\nCopyright (c) 2022 Oluwatobi Adeyinka\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeverlyroadgoose%2Ffuse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeverlyroadgoose%2Ffuse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeverlyroadgoose%2Ffuse/lists"}