Verified Commit 2dbefa7b authored by Kiryuu Sakuya's avatar Kiryuu Sakuya 🎵
Browse files

Don't know wtf

parent 05c9e93b
package main
import (
"io"
"log"
"net/http"
"os"
"path"
"strings"
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api"
)
/*
// DownloadTorrent just download a torrent from iTorrents.
// See https://golangcode.com/download-a-file-from-a-url/
func DownloadTorrent(filepath string, url string) error {
......@@ -28,7 +29,6 @@ func DownloadTorrent(filepath string, url string) error {
_, err = io.Copy(output, response.Body)
return err
}
*/
func main() {
bot, err := tgbotapi.NewBotAPI(os.Getenv("TGBot_TOKEN"))
......@@ -112,17 +112,14 @@ func main() {
// msg.Text = "Now try to get the torrent file for you. The hash is: " + Magnet
TorrentFileURL := "https://itorrents.org/torrent/" + Magnet + ".torrent"
/*
TorrentFileName := path.Base(TorrentFileURL)
TorrentFileName := path.Base(TorrentFileURL)
if err := DownloadTorrent(TorrentFileName, TorrentFileURL); err != nil {
panic(err)
}
if err := DownloadTorrent(TorrentFileName, TorrentFileURL); err != nil {
panic(err)
}
*/
TorrentFile := tgbotapi.NewDocumentUpload(update.Message.Chat.ID, TorrentFileName)
bot.Send(TorrentFile)
msg := tgbotapi.NewDocumentUpload(update.Message.Chat.ID, TorrentFileURL+".zip")
bot.Send(msg)
default:
// TODO: Will conflict with other bots.
msg.Text = "I don't know that command"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment