A tip bot and Lightning wallet on Telegram ⚡️



@LightningTipBot 🏅

A Telegram Lightning ⚡️ Bitcoin wallet and tip bot for group chats.

This repository contains everything you need to set up and run your own tip bot. If you simply want to use this bot in your group chat without having to install anything just start a conversation with @LightningTipBot and invite it into your group chat.

Setting up the bot


To build the bot from source, clone the repository and compile the source code.

git clone https://github.com/LightningTipBot/LightningTipBot.git
cd LightningTipBot
go build .
cp config.yaml-example config.yaml

After the configuration (see below), start it using the command



You need to edit config.yaml before starting the bot.

Create a Telegram bot

First, create a new Telegram bot by starting a conversation with the @BotFather. After you have created your bot, you will get an Api Token which you need to add to telegram_api_key in config.yaml accordingly.

Set up LNbits

You can either use your own LNbits instance (recommended) or create an account at lnbits.com to use their custodial service (easy).

  1. Create a wallet in LNbits (lnbits_url).
  2. Get the Admin key in the API Info tab of your user (lnbits_admin_key).
  3. Enable the User Manager extension.
  4. Get the Admin ID of the User Manager (lnbits_admin_id).

Getting LNbits keys

How to set up a lnbits wallet and the User Manager extension.

More configuration

  • webhook_server: URL that can reach the bot. This is used for creating webhooks with LNbits to receive notifications about payments (optional).
  • db_path: User database file path.
  • transactions_path: Transaction log file path.
  • message_dispose_duration: Duration in seconds after which commands will be deleted from channel (only if the bot is channel admin).



/tip 🏅 Reply to a message to tip it: /tip <amount> [<memo>]
/balance 👑 Check your balance: /balance
/send 💸 Send funds to a user: /send <amount> <@username> [<memo>]
/invoice ⚡️ Create a Lightning invoice to receive payments: /invoice <amount> [<memo>]
/pay ⚡️ Pay a Lightning invoice: /pay <invoice>
/help 📖 Read this help.
/info 📚 More info.
/donate 🙏 Donate to @LightningTipBot: /donate <amount>

Live tooltips

The bot replies to a tipped message to indicate to all participants how many and what amount of tips a post has received. This tooltip will be updated as new tips are given to a post.

How to set up a lnbits wallet and the User Manager extension.

Link to BlueWallet or Zap

Every user can link their wallet to an external app like Bluewallet or Zeus by using the command /link. If you host the bot, you will have to enable the LndHub extension in LNbits. You also need to edit the lnbits_public_url entry in config.yaml accordingly to an address that can be reached by the user's wallet (Tor should be fine as well).

QR code payment example.

Pay invoices by sending QR codes

To pay a Lightning invoice, you can snap a photo of a QR code and send it directly to the bot. Note that you might need to zoom in, center the QR code, or crop the image if the bot fails to decode the QR code from the photo. By the way, you can also just send an the invoice as a string, the bot will automatically detect it and initiate a payment.

QR code payment example.

Auto-delete commands

To minimize the clutter all the heavy tipping can cause in a group chat, the bot will remove all failed commands (for example due to a syntax error) from the chat immediately. All successful commands will stay visible for message_dispose_duration seconds (default 10s) and then be removed. The tips will sill be visible for everyone in the Live tooltip. This feature only works, if the bot is made admin of the group.

Made with

  • LNbits – Free and open-source lightning-network wallet/accounts system.
  • telebot – A Telegram bot framework in Go.
  • gozxing – barcode image processing library in Go.
  • ln-decodepay – Lightning Network BOLT11 invoice decoder.
  • when more users are using the bot, got error message like this

    when more users are using the bot, got error message like this

    2021/08/22 19:09:40 runtime error: invalid memory address or nil pointer dereference gopkg.in/tucnak/telebot%2ev2.(*Bot).debug /home//go/pkg/mod/gopkg.in/tucnak/[email protected]/util.go:14 gopkg.in/tucnak/telebot%2ev2.(*Bot).deferDebug /home//go/pkg/mod/gopkg.in/tucnak/[email protected]/util.go:25 runtime.gopanic /usr/local/go/src/runtime/panic.go:1038 runtime.panicmem /usr/local/go/src/runtime/panic.go:221 runtime.sigpanic /usr/local/go/src/runtime/signal_unix.go:735 main.tipTooltipInitializedHandler /home//src/LightningTipBot/message.go:79 main.TipBot.initWallet /home//src/LightningTipBot/start.go:58 main.TipBot.startHandler /home//src/LightningTipBot/start.go:29 main.TipBot.balanceHandler /home//src/LightningTipBot/balance.go:22 gopkg.in/tucnak/telebot%2ev2.(*Bot).handle.func1 /home//go/pkg/mod/gopkg.in/tucnak/[email protected]/bot.go:462 gopkg.in/tucnak/telebot%2ev2.(*Bot).runHandler.func1 /home//go/pkg/mod/gopkg.in/tucnak/[email protected]/util.go:35 runtime.goexit /usr/local/go/src/runtime/asm_amd64.s:1581

    opened by ghost 9
  •  Error initializing your wallet. Try again later.

    Error initializing your wallet. Try again later.

    From our desktop tg client ( running Ubuntu and other *NIX ) we get that message .Please note that we are located so to speak in Rouseau Dominica Caribbean and Bahia Blanca Argentina SA. This happens also with a VPN conn with NL IP number

    opened by gerenciaz 3
  • feature request: create a wallet for a  user when someone else /send to it if absent

    feature request: create a wallet for a user when someone else /send to it if absent

    a /send will fail right now if the recipient has not created a wallet already. Can we create a wallet by default if a user is being sent sats for the first time?

    opened by ghost 3
  • copying /tmp/go-build2378678836/b001/exe/a.out: open LightningTipBot: permission denied

    copying /tmp/go-build2378678836/b001/exe/a.out: open LightningTipBot: permission denied

    Hello, I get the following error when running go build . I have tried touch /tmp/myfile which gave me no response, so it seems to be fine.

    What can I do to fix it?

    Kind regards, jcjms.

    opened by jcjms 2
  • no support on GitHub

    no support on GitHub

    Something is wrong with lightningtipbot or your lndhub nodes..i can't send out or receive funds..also when i go to send out sats it takes my sats but states it couldnt pay the invoice..have tried lnurl, and invoice..

    opened by amuna1225 2
  • Error initializing your wallet. Try again later.

    Error initializing your wallet. Try again later.

    We have one user in our group that is unable to start a wallet.

    she has also tried deleting the chat and starting over - this has been going on for a while now. the rest of us in the telegram group have no issues.

    anything in her settings that could cause this? I see an old issue ( #113 ) that was resolved but no information on what the problem was.

    thank you


    opened by m4j0rbyte 2
  • Feature: Language selection

    Feature: Language selection

    I think it would be nice to make this bot available in different language. I'm willing to help for French as soon as the idea is accepted and a translation process is defined.

    opened by bitpaint 2
  • settlement date incorrect or confusing

    settlement date incorrect or confusing

    Here is an example of a tip shown in tx history:

    Date Created 24/Aug/2021 07:21

    Date Settled 31/Dec/1970 16:00

    If the settled date is unknown, maybe should be left blank.

    opened by ghost 2
  • failed to initialize database

    failed to initialize database

    With the current Version and with Release Version v0.5 i got this error on first start

    INFO[0000] Starting Dalle image generation. Worker: 2, Price: 1000 sat INFO[2022-10-25 12:49:29] [PriceWatcher] Watcher started

    2022/10/25 12:49:29 /home/lightningtipbot/LightningTipBot/internal/telegram/database.go:96 [error] failed to initialize database, got error unable to open database file: no such file or directory ERRO[2022-10-25 12:49:29] Recovered panic: Initialize orm failed.
    goroutine 1 [running]: runtime/debug.Stack() /usr/local/go/src/runtime/debug/stack.go:24 +0x88 runtime/debug.PrintStack() /usr/local/go/src/runtime/debug/stack.go:16 +0x20 main.withRecovery() /home/lightningtipbot/LightningTipBot/main.go:93 +0x98 panic({0xc935c0, 0xf888d8}) /usr/local/go/src/runtime/panic.go:1038 +0x224 github.com/LightningTipBot/LightningTipBot/internal/telegram.AutoMigration() /home/lightningtipbot/LightningTipBot/internal/telegram/database.go:98 +0x628 github.com/LightningTipBot/LightningTipBot/internal/telegram.NewBot() /home/lightningtipbot/LightningTipBot/internal/telegram/bot.go:48 +0xe8 main.main() /home/lightningtipbot/LightningTipBot/main.go:40 +0x60

    opened by ChuckNorrison 1
  • Lightning address is empty in /help

    Lightning address is empty in /help

    The bot works as expected, but at help command, the lightning addresses displayed are incomplete. The @domain is missing.

    ℹ️ Info Your Lightning address is [email protected]

    Already updated the config, but as described (https://github.com/LightningTipBot/LightningTipBot#lnurl-server), there is no config lnurl_public_server.

    my config looks like this:

          username: test
          password: username
      http_proxy: ""
      lnurl_public_host_name: "mydomain.org"
      lnurl_server: "https://mydomain.org/lndhub/ext"
      lnurl_image: true
      admin_api_host: localhost:6060
      message_dispose_duration: 10
      api_key: "1234:xyz"
      url: ""
      admin_key: "myadminkey"
      admin_id: "myadminid"
      webhook_server: ""
      lnbits_public_url: "https://mydomain.org"
      db_path: "data/bot.db"
      buntdb_path: "data/bunt.db"
      transactions_path: "data/transactions.db"
      shop_buntdb_path: "data/shop.db"
      groupsdb_path: "data/groups.db"
      dalle_key: "asd"
      dalle_price: 1000
      worker: 2

    How can i fix the displayed lightning addresses?

    bug documentation 
    opened by ChuckNorrison 3
  • Feature: Create and Redeem Coupons

    Feature: Create and Redeem Coupons

    Instead of sending sats to a specific user, I would like to attach funds to a random ~8 digits coupon code - for anyone could redeem.

    This will allow users to write down the coupon code on a piece of paper, for example as a tip in a restaurant (without the awkwardness of asking the waiter for his telegram username). There could also be a captcha to solve, in order to block bots that try all possible coupon codes.

    It could also be nice to design a small note to print (the size of a business card), like:

    |                Bitcoin Coupon!                |
    |    Redeemable with Telegram at www.ln.tips    |
    |           Coupon Code: ____________           |
    |       Value: ________ sats ≈ $ ________       |
    |           (dollar value may change)           |
    |       Expiry date (optional): _________       |
    |                                               |
    |       Sats is the base unit of Bitcoin        |
    |            like cents and dollars.            |
    |         1 Bitcoin = 100,000,000 sats          |

    (sorry for my pronunciation, I'm not a native english speaker).

    Users could print several of these notes, keep in their wallet, and on the spot fill the missing placeholders and leave it as a tip.

    Obviously the tipper could "steal the funds" knowing the coupon code, but then why would he tip in the first place...

    The expiry date could be give an incentive for lazy no-coiners to hurry up.

    opened by ozomer 2
  • WIP: update GetUserStr - GetUserStrMd

    WIP: update GetUserStr - GetUserStrMd

    • GetUserStr

    goos: darwin goarch: arm64 pkg: github.com/LightningTipBot/LightningTipBot/internal/telegram BenchmarkGetUserName BenchmarkGetUserName-10 20432500 58.77 ns/op BenchmarkGetUserStrNoUsername BenchmarkGetUserStrNoUsername-10 13479517 88.93 ns/op BenchmarkGetUserStrNoFirstName BenchmarkGetUserStrNoFirstName-10 12947025 92.27 ns/op PASS

    • updated GetUserStr

    goos: darwin goarch: arm64 pkg: github.com/LightningTipBot/LightningTipBot/internal/telegram BenchmarkGetUserName BenchmarkGetUserName-10 19599570 58.22 ns/op BenchmarkGetUserStrNoUsername BenchmarkGetUserStrNoUsername-10 22363182 53.96 ns/op BenchmarkGetUserStrNoFirstName BenchmarkGetUserStrNoFirstName-10 21759808 54.73 ns/op PASS

    • GetUserStrMd

    BenchmarkGetUserStrMdName-10 15102800 75.20 ns/op BenchmarkGetUserStrMdNoUsername BenchmarkGetUserStrMdNoUsername-10 7925005 151.2 ns/op BenchmarkGetUserStrMdNoFirstName BenchmarkGetUserStrMdNoFirstName-10 8326500 144.3 ns/op PASS

    • updated GetUserStdMd

    BenchmarkGetUserStrMdName-10 15895222 75.47 ns/op BenchmarkGetUserStrMdNoUsername BenchmarkGetUserStrMdNoUsername-10 10507543 114.8 ns/op BenchmarkGetUserStrMdNoFirstName BenchmarkGetUserStrMdNoFirstName-10 10276515 111.1 ns/op PASS

    Both passing all defined tests

    /private/var/folders/tt/fs3zvlp53cgf_dtv5hhyc6cc0000gn/T/GoLand/___users_test_go.test -test.v -test.paniconexit0 -test.run ^\QTestGetUserStr\E|\QTestGetUserStrMd\E$ === RUN TestGetUserStr --- PASS: TestGetUserStr (0.00s) === RUN TestGetUserStr/NoUserName --- PASS: TestGetUserStr/NoUserName (0.00s) === RUN TestGetUserStr/UserName --- PASS: TestGetUserStr/UserName (0.00s) === RUN TestGetUserStr/NoUserName#01 --- PASS: TestGetUserStr/NoUserName#01 (0.00s) === RUN TestGetUserStr/NoUserName#02 --- PASS: TestGetUserStr/NoUserName#02 (0.00s) === RUN TestGetUserStrMd --- PASS: TestGetUserStrMd (0.00s) === RUN TestGetUserStrMd/NoUserName --- PASS: TestGetUserStrMd/NoUserName (0.00s) === RUN TestGetUserStrMd/UserName --- PASS: TestGetUserStrMd/UserName (0.00s) === RUN TestGetUserStrMd/NoUserName#01 --- PASS: TestGetUserStrMd/NoUserName#01 (0.00s) === RUN TestGetUserStrMd/NoUserName#02 --- PASS: TestGetUserStrMd/NoUserName#02 (0.00s) PASS

    Process finished with the exit code 0

    opened by gohumble 1
  • v0.5(Mar 28, 2022)

    This release comes with a lot of new updates 🎉

    Major updates

    • ⌨️ A keyboard for more convenient interaction with your wallet.
    • 🛍 Introducing shops (alpha) for selling digital goods on Tellegram. Enter /shop to create your own shop.
    • 🎟 Introducing group tickets for private groups. Sell one-time tickets that prevent bot from joining your group and sending spam to your users.
    • 🕵️‍♀️ Anonymous Lightning addresses.
    • 🌄 LNURL sends and displays payer data and image.
    • 🤖 Update to Telebot v3

    Minor updates

    • Mutex locks for all user interactions.
    • Invoice callback events that are fired when an invoice is paid.
    • Faucet minium increased to 5 sats per user
    • LIFO stack for editing messages prevents running into Telegram rate limits
    • Cache for bunt object store.
    • And countless other changes (Full Changelog)
    Source code(tar.gz)
    Source code(zip)
  • v0.4.2(Dec 6, 2021)

  • v0.4.1(Nov 15, 2021)

    • Optimized db access (fewer tx's).
    • User cache
    • LNURL-w
    • Tipjar
    • Anonymous Lightning address
    • Fiat amount input (converted into sat).
    • Indonesian, Turkish translations
    Source code(tar.gz)
    Source code(zip)
  • v0.4(Oct 13, 2021)

    • Translations (Currently: English, French, German, Spanish, Dutch, Portuguese, Italian)
    • Inline commands (Currently: send, receive, and faucets. More to come!)
    • Send and receive LNURL comments
    • Fiat price conversion
    • Database optimizations
    • Huge refactoring
    Source code(tar.gz)
    Source code(zip)
  • v0.3(Aug 30, 2021)

  • v0.2(Aug 27, 2021)

    • LndHub: Link with BlueWallet and Zap /link
    • Webhooks for LndHub
    • Advanced help menu /advanced
    • Donation command /donate
    • Donations to forked bots are forwarded to the original project
    Source code(tar.gz)
    Source code(zip)
  • v.0.1.2(Aug 25, 2021)

  • v.0.1.1(Aug 23, 2021)

  • v0.1(Aug 22, 2021)

Pro-bot - A telegram bot to play around with the community telegram channels

pro-bot ?? Pro Bot A Telegram Bot to Play Around With The Community Telegram Cha

TechProber 1 Jan 24, 2022
lightning - forward messages between a qq group and a telegram group

lightning The purpose of this project is to forward messages between a qq group and a telegram group. Getting Started Clone this project: git clone ht

方泓睿 5 Nov 9, 2022
A bot based on Telegram Bot API written in Golang allows users to download public Instagram photos, videos, and albums without receiving the user's credentials.

InstagramRobot InstagramRobot is a bot based on Telegram Bot API written in Golang that allows users to download public Instagram photos, videos, and

FTC Team 8 Dec 16, 2021
This bot keeps information about your crypto wallet.

Telegram bot @crypto_wallet_gobot This bot writes to database information about your cryptocurrencies. Functions: add currency(example: btc) amount(ex

null 1 Jan 12, 2022
Bot - Telegram Music Bot in Go

Telegram Music Bot in Go An example bot using gotgcalls. Setup Install the serve

null 9 Jun 28, 2022
Bot-template - A simple bot template for creating a bot which includes a config, postgresql database

bot-template This is a simple bot template for creating a bot which includes a c

Disgo 2 Sep 9, 2022
The serverless OTP telegram service use telegram as OTP service, and send OTP through webhook

Setup OTP First thing, you need prepare API(webhook) with POST method, the payload format as below { "first_name": "Nolan", "last_name": "Nguyen",

Dong Nguyen 3 Jul 24, 2022
IRC, Slack, Telegram and RocketChat bot written in go

go-bot IRC, Slack & Telegram bot written in Go using go-ircevent for IRC connectivity, nlopes/slack for Slack and Syfaro/telegram-bot-api for Telegram

null 765 Nov 12, 2022
Golang telegram bot API wrapper, session-based router and middleware

go-tgbot Pure Golang telegram bot API wrapper generated from swagger definition, session-based routing and middlewares. Usage benefits No need to lear

Oleg Lebedev 118 Nov 16, 2022
Bot that polls activity API for Github organisation and pushes updates to Telegram.

git-telegram-bot Telegram bot for notifying org events Requirements (for building) Go version 1.16.x Setup If you don't have a telegram bot token yet,

Skycoin 4 Apr 8, 2022
Library for working with golang telegram client + bot based on tdlib. This library was taken from the user Arman92 and changed for the current version of tdlib.

go-tdlib Golang Telegram TdLib JSON bindings Install To install, you need to run inside a docker container (it is given below) go get -u github.com/ka

Rostislav Krivets 22 Oct 30, 2022
Telegram bot for distorting images and stickers using CAS

Distortioner Telegram bot for distorting pictures, stickers, voice messages and GIFs using Content Aware Scale. Currently resides here: @distortionerb

Nikitka 14 Oct 2, 2022
Telegram bot check your TrainingPeaks profile workouts and send notification if some workouts added or changed

TrainingPeaks Bot Telegram bot check your TrainingPeaks profile workouts and sen

Kotov Alexander 0 Dec 29, 2021
UcodeQrTelebot ver2 - Easy way to get QR and U-code using Utopia API in telegram bot

UcodeQrTelebot Easy way to get QR and U-code using Utopia API in telegram bot Us

null 1 Dec 30, 2021
RaspChecker - A Telegram bot that allows you to monitor your Raspberry Pi's temperature and shut it down. Written in Golang.

RaspChecker Remotely monitor your Raspberry Pi's temperature and shut it down if you want. All through Telegram. How to set up In order to run the bot

Drull 0 Jan 2, 2022
go telegram bot, used for video collect and more.

For what 我的想法: 部署一个私有的tg api server到国外的vps 通过 sshfs(sftp) 挂载我国内的nas到vps上 在tg上转发视频到我的bot 通过此程序handle此转发 透过私有api server会下载视频到我的vps上 将视频移动到挂载目录,自动同步到我的na

Kencin 0 Jan 15, 2022
A Telegram bot that asks you a question and evaluate the response you provide.

PiSquared A Telegram bot that asks you a question and evaluate the response you provide. Thanks to the labse_bert model, the evaluation of the answer

Erik Pellizzon 8 Nov 13, 2022
This repository will guide you to steal whatever the user copies and send content to telegram bot.

copy-clipboard-stealer-with-telegram This repository will guide you to steal whatever the user copies and send content to telegram bot. Setting Envior

Jhangju 2 Oct 4, 2022
Telegram Bot Framework for Go

Margelet Telegram Bot Framework for Go is based on telegram-bot-api It uses Redis to store it's states, configs and so on. Any low-level interactions

Gleb Sinyavskiy 75 Nov 16, 2022