Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
827bfb108d | ||
|
|
e2017ecfe9 | ||
|
|
059cb5cdd8 | ||
|
|
80d0ec57b1 | ||
|
|
790f0943cc | ||
|
|
4af2ca8799 | ||
|
|
323fd14c9e |
@@ -4,9 +4,9 @@
|
||||
|
||||
# @LightningTipBot 🏅
|
||||
|
||||
A tip bot and Lightning ⚡️ Bitcoin Wallet for Telegram group chats. It can also be used as a personal Lightning wallet by anyone who has a Telegram account.
|
||||
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](https://t.me/LightningTipBot) and invite it into your chat.
|
||||
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](https://t.me/LightningTipBot) and invite it into your group chat.
|
||||
|
||||
## Setting up the bot
|
||||
|
||||
@@ -21,9 +21,7 @@ go build .
|
||||
cp config.yaml-example config.yaml
|
||||
```
|
||||
|
||||
Alternatively, you can download binary releases [here](https://github.com/LightningTipBot/LightningTipBot/releases) **(note: no realses yet)**.
|
||||
|
||||
After you have configured the bot, start it using the command
|
||||
After the configuration (see below), start it using the command
|
||||
|
||||
```
|
||||
./LightningTipBot
|
||||
@@ -81,6 +79,14 @@ The bot replies to a tipped message to indicate to all participants how many and
|
||||
<img alt="How to set up a lnbits wallet and the User Manager extension." src="resources/tooltips.png" >
|
||||
</p>
|
||||
|
||||
### 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.
|
||||
|
||||
<p align="center">
|
||||
<img alt="QR code payment example." src="resources/qr_code_example.jpg" >
|
||||
</p>
|
||||
|
||||
### 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.
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
helpMessage = "ℹ️ *Info*\n_This bot sends Bitcoin tips on the Lightning Network⚡️. The basic unit of tips are Satoshis (sat). 100,000,000 sat = 1 Bitcoin. There will only ever be 21 Million Bitcoin._\n\n" +
|
||||
helpMessage = "ℹ️ *Info*\n_This bot is a Lightning Bitcoin wallet and can sends tips on Telegram. Simply add it to your group. The basic unit of tips are Satoshis (sat). 100,000,000 sat = 1 Bitcoin. There will only ever be 21 Million Bitcoin. Type /info for more._\n\n" +
|
||||
"❤️ *Donate*\n" +
|
||||
"_This bot charges no fees but generates costs. If you like to support this bot, please consider a donation. To donate, just tip @LightningTipBot or try_ `/send 1000 @LightningTipBot`\n\n" +
|
||||
"⚙️ *Commands*\n" +
|
||||
@@ -15,7 +15,7 @@ const (
|
||||
"*/send* 💸 Send funds to a user: `/send <amount> <@username> [<memo>]`\n" +
|
||||
"*/invoice* ⚡️ Receive over Lightning: `/invoice <amount> [<memo>]`\n" +
|
||||
"*/pay* ⚡️ Pay over Lightning: `/pay <invoice>`\n" +
|
||||
"*/help* 📖 Read this help (more: */info*).\n"
|
||||
"*/help* 📖 Read this help.\n"
|
||||
|
||||
infoMessage = "🧡 *Bitcoin*\n" +
|
||||
"_Bitcoin is the currency of the internet. It is permissionless and decentralized and has no masters and no controling authority. Bitcoin is sound money that is faster, more secure, and more inclusive than the legacy financial system._\n\n" +
|
||||
@@ -24,9 +24,11 @@ const (
|
||||
"⚡️ *The Lightning Network*\n" +
|
||||
"_The Lightning Network is a payment protocol that enables fast and cheap Bitcoin payments that require almost no energy. It is what scales Bitcoin to the billions of people around the world._\n\n" +
|
||||
"📲 *Lightning Wallets*\n" +
|
||||
"_Your funds on this bot can be sent to any other Lightning wallet and vice versa. If you don't have a Lightning wallet yet, check out_ [Phoenix](https://phoenix.acinq.co/)_,_ [Breez](https://breez.technology/)_,_ [Muun](https://muun.com/)_ (non-custodial), or_ [Wallet of Satoshi](https://www.walletofsatoshi.com/) _(easy)_.\n\n" +
|
||||
"_Your funds on this bot can be sent to any other Lightning wallet and vice versa. Recommended Lightning wallets for your phone are_ [Phoenix](https://phoenix.acinq.co/)_,_ [Breez](https://breez.technology/)_,_ [Muun](https://muun.com/)_ (non-custodial), or_ [Wallet of Satoshi](https://www.walletofsatoshi.com/) _(easy)_.\n\n" +
|
||||
"📄 *Open Source*\n" +
|
||||
"_This bot is free and_ [open source](https://github.com/LightningTipBot/LightningTipBot) _software. You can run it on your own computer and use it in your own community. You don't have to trust anyone to keep your funds safe._\n\n" +
|
||||
"✈️ *Telegram*\n" +
|
||||
"_Add this bot to your Telegram group chat to /tip posts. If you make the bot admin of the group it will also clean up commands to keep the chat tidy._\n\n" +
|
||||
// "🏛 *Terms*\n" +
|
||||
// "_We are not custodian of your funds. Any amount you load onto your wallet will be legally considered a donation that belongs to us. We will act in your best interest but we're also aware that the situation without KYC is tricky until we figure something out. Do not give us all your money. Be aware that this bot is in beta development. Use at your own risk._\n\n" +
|
||||
"❤️ *Donate*\n" +
|
||||
|
||||
@@ -25,6 +25,7 @@ func helpInvoiceUsage(errormsg string) string {
|
||||
}
|
||||
|
||||
func (bot TipBot) invoiceHandler(m *tb.Message) {
|
||||
log.Infof("[%s:%d %s:%d] %s", m.Chat.Title, m.Chat.ID, GetUserStr(m.Sender), m.Sender.ID, m.Text)
|
||||
if m.Chat.Type != tb.ChatPrivate {
|
||||
// delete message
|
||||
NewMessage(m).Dispose(0, bot.telegram)
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 55 KiB |
@@ -55,6 +55,7 @@ func (bot TipBot) initWallet(tguser *tb.User) error {
|
||||
return err
|
||||
}
|
||||
} else if !user.Initialized {
|
||||
// update all tip tooltips (with the "initialize me" message) that this user might have received before
|
||||
tipTooltipInitializedHandler(user.Telegram, bot)
|
||||
user.Initialized = true
|
||||
err = UpdateUserRecord(user, bot)
|
||||
|
||||
@@ -83,7 +83,7 @@ func (bot *TipBot) tipHandler(m *tb.Message) {
|
||||
|
||||
if !bot.UserHasWallet(to) {
|
||||
log.Infof("[/tip] User %s has no wallet.", toUserStr)
|
||||
err = bot.CreateWalletForUser(to)
|
||||
err = bot.CreateWalletForTelegramUser(to)
|
||||
if err != nil {
|
||||
errmsg := fmt.Errorf("[/tip] Error: Could not create wallet for %s", toUserStr)
|
||||
log.Errorln(errmsg)
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/LightningTipBot/LightningTipBot/internal/lnbits"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
tb "gopkg.in/tucnak/telebot.v2"
|
||||
@@ -94,13 +95,13 @@ func (bot *TipBot) GetUserBalance(user *tb.User) (amount int, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (bot *TipBot) CreateWalletForUser(tbUser *tb.User) error {
|
||||
user, err := GetUser(tbUser, *bot)
|
||||
func (bot *TipBot) CreateWalletForTelegramUser(tbUser *tb.User) error {
|
||||
user := &lnbits.User{Telegram: tbUser}
|
||||
userStr := GetUserStr(tbUser)
|
||||
log.Printf("[CreateWalletForUser] Creating wallet for user %s ... ", userStr)
|
||||
err = bot.createWallet(user)
|
||||
log.Printf("[CreateWalletForTelegramUser] Creating wallet for user %s ... ", userStr)
|
||||
err := bot.createWallet(user)
|
||||
if err != nil {
|
||||
errmsg := fmt.Sprintf("[CreateWalletForUser] Error: Could not create wallet for user %s", userStr)
|
||||
errmsg := fmt.Sprintf("[CreateWalletForTelegramUser] Error: Could not create wallet for user %s", userStr)
|
||||
log.Errorln(errmsg)
|
||||
return err
|
||||
}
|
||||
@@ -108,7 +109,7 @@ func (bot *TipBot) CreateWalletForUser(tbUser *tb.User) error {
|
||||
if tx.Error != nil {
|
||||
return tx.Error
|
||||
}
|
||||
log.Printf("[CreateWalletForUser] Wallet created for user %s. ", userStr)
|
||||
log.Printf("[CreateWalletForTelegramUser] Wallet created for user %s. ", userStr)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user