mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-23 01:20:11 +00:00
remove leaked telegram token
token has been revoked, but it doesn't look like it was used anyway.
This commit is contained in:
parent
18bcd55972
commit
4b11bbe21f
@ -1,8 +0,0 @@
|
|||||||
module github.com/hrfee/jfa-go/telegram
|
|
||||||
|
|
||||||
go 1.16
|
|
||||||
|
|
||||||
require (
|
|
||||||
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible // indirect
|
|
||||||
github.com/technoweenie/multipartstreamer v1.0.1 // indirect
|
|
||||||
)
|
|
@ -1,4 +0,0 @@
|
|||||||
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible h1:2cauKuaELYAEARXRkq2LrJ0yDDv1rW7+wrTEdVL3uaU=
|
|
||||||
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible/go.mod h1:qf9acutJ8cwBUhm1bqgz6Bei9/C/c93FPDljKWwsOgM=
|
|
||||||
github.com/technoweenie/multipartstreamer v1.0.1 h1:XRztA5MXiR1TIRHxH2uNxXxaIkKQDeX7m2XsSOlQEnM=
|
|
||||||
github.com/technoweenie/multipartstreamer v1.0.1/go.mod h1:jNVxdtShOxzAsukZwTSw6MDx5eUJoiEBsSvzDU9uzog=
|
|
@ -1,59 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"log"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
tg "github.com/go-telegram-bot-api/telegram-bot-api"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
TOKEN = "1785754648:AAG4G6PKZpGDEJM_-MeQHJqD-xUDrrLrTC4"
|
|
||||||
USER = "johnikwock"
|
|
||||||
|
|
||||||
AUTH = "AB-CD-EF"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
log.Println("Connecting...")
|
|
||||||
bot, err := tg.NewBotAPI(TOKEN)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("Failed to initialize bot: %v", err)
|
|
||||||
}
|
|
||||||
bot.Debug = false
|
|
||||||
log.Printf("Authorized Telegram bot \"%s\"", bot.Self.UserName)
|
|
||||||
|
|
||||||
u := tg.NewUpdate(0)
|
|
||||||
u.Timeout = 60
|
|
||||||
|
|
||||||
updates, err := bot.GetUpdatesChan(u)
|
|
||||||
|
|
||||||
for update := range updates {
|
|
||||||
if update.Message == nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
log.Printf("New message from \"@%s\": \"%s\"", update.Message.From.UserName, update.Message.Text)
|
|
||||||
if update.Message.From.UserName != USER {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
var msg tg.MessageConfig
|
|
||||||
sects := strings.Split(update.Message.Text, " ")
|
|
||||||
if sects[0] == "/start" {
|
|
||||||
msg = tg.NewMessage(update.Message.Chat.ID, fmt.Sprintf("Enter this code on the sign-up page to continue: %s", AUTH))
|
|
||||||
} else if sects[0] != "/auth" || sects[len(sects)-1] != AUTH {
|
|
||||||
log.Println("Invalid command or auth token")
|
|
||||||
msg = tg.NewMessage(update.Message.Chat.ID, "Invalid command or token")
|
|
||||||
} else {
|
|
||||||
msg = tg.NewMessage(update.Message.Chat.ID, "Success!")
|
|
||||||
log.Println("Successful auth")
|
|
||||||
}
|
|
||||||
msg.ReplyToMessageID = update.Message.MessageID
|
|
||||||
|
|
||||||
_, err := bot.Send(msg)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("Send failed: %v", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
API key: 1785754648:AAG4G6PKZpGDEJM_-MeQHJqD-xUDrrLrTC4
|
|
||||||
|
|
||||||
Name: jfa-bot
|
|
||||||
Username: jfago_bot
|
|
Loading…
Reference in New Issue
Block a user