add shortcuts for commands

This commit is contained in:
pyed 2016-07-04 01:52:51 +03:00
parent 2d7fd60bae
commit 950963dc31

View File

@ -132,87 +132,87 @@ func main() {
command := strings.ToLower(tokens[0]) command := strings.ToLower(tokens[0])
switch command { switch command {
case "list", "/list": case "list", "/list", "li", "/li":
// list torrents // list torrents
go list(update, tokens[1:]) go list(update, tokens[1:])
case "head", "/head": case "head", "/head", "he", "/he":
// list the first 5 or n torrents // list the first 5 or n torrents
go head(update, tokens[1:]) go head(update, tokens[1:])
case "tail", "/tail": case "tail", "/tail", "ta", "/ta":
// list the last 5 or n torrents // list the last 5 or n torrents
go tail(update, tokens[1:]) go tail(update, tokens[1:])
case "downs", "/downs": case "downs", "/downs", "do", "/do":
// list downloading // list downloading
go downs(update) go downs(update)
case "seeding", "/seeding": case "seeding", "/seeding", "sd", "/sd":
// list seeding // list seeding
go seeding(update) go seeding(update)
case "paused", "/paused": case "paused", "/paused", "pa", "/pa":
// list puased torrents // list puased torrents
go paused(update) go paused(update)
case "checking", "/checking": case "checking", "/checking", "ch", "/ch":
// list verifying torrents // list verifying torrents
go checking(update) go checking(update)
case "active", "/active": case "active", "/active", "ac", "/ac":
// list active torrents // list active torrents
go active(update) go active(update)
case "errors", "/errors": case "errors", "/errors", "er", "/er":
// list torrents with errors // list torrents with errors
go errors(update) go errors(update)
case "sort", "/sort": case "sort", "/sort", "so", "/so":
// sort torrents // sort torrents
go sort(update, tokens[1:]) go sort(update, tokens[1:])
case "trackers", "/trackers": case "trackers", "/trackers", "tr", "/tr":
// list trackers // list trackers
go trackers(update) go trackers(update)
case "add", "/add": case "add", "/add", "ad", "/ad":
// takes url to a torrent to add it // takes url to a torrent to add it
go add(update, tokens[1:]) go add(update, tokens[1:])
case "search", "/search", "grep", "/grep": case "search", "/search", "se", "/se":
// search for a torrent // search for a torrent
go search(update, tokens[1:]) go search(update, tokens[1:])
case "latest", "/latest": case "latest", "/latest", "la", "/la":
// get the latest torrents // get the latest torrents
go latest(update, tokens[1:]) go latest(update, tokens[1:])
case "info", "/info": case "info", "/info", "in", "/in":
// gets info on specific torrent // gets info on specific torrent
go info(update, tokens[1:]) go info(update, tokens[1:])
case "stop", "/stop": case "stop", "/stop", "sp", "/sp":
// stop one torrent or more // stop one torrent or more
go stop(update, tokens[1:]) go stop(update, tokens[1:])
case "start", "/start": case "start", "/start", "st", "/st":
// starts one torrent or more // starts one torrent or more
go start(update, tokens[1:]) go start(update, tokens[1:])
case "check", "/check": case "check", "/check", "ck", "/ck":
// verify a torrent or torrents // verify a torrent or torrents
go check(update, tokens[1:]) go check(update, tokens[1:])
case "stats", "/stats": case "stats", "/stats", "sa", "/sa":
// print transmission stats // print transmission stats
go stats(update) go stats(update)
case "speed", "/speed": case "speed", "/speed", "ss", "/ss":
// print current download and upload speeds // print current download and upload speeds
go speed(update) go speed(update)
case "count", "/count": case "count", "/count", "co", "/co":
// sends current torrents count per status // sends current torrents count per status
go count(update) go count(update)
@ -654,7 +654,7 @@ func add(ud tgbotapi.Update, tokens []string) {
send("add: error adding "+url, ud.Message.Chat.ID) send("add: error adding "+url, ud.Message.Chat.ID)
continue continue
} }
send("Added: "+torrent.Name, ud.Message.Chat.ID) send(fmt.Sprintf("Added: <%d> %s", torrent.ID, torrent.Name), ud.Message.Chat.ID)
} }
} }