diff --git a/bot.py b/bot.py index bbe47ba..3cd9518 100644 --- a/bot.py +++ b/bot.py @@ -122,13 +122,13 @@ class QBittorrentAPICaller(): to_ret += "```" return to_ret - def add(self, url, username, tag="unknown"): + def add(self, url, username, category="unknown"): if not url.startswith("magnet:"): return "Please supply a magnet link (begins with \"magnet:\")" the_url = self.url + "/" + "api/v2/torrents/add" - resp = self.session.post(the_url, data={"urls":url,"category":username,"tags":tag}) + resp = self.session.post(the_url, data={"urls":url,"category":category,"tags":username}) if (resp.status_code == 415): return "Torrent file not valid" @@ -300,13 +300,13 @@ class QBBot(slixmpp.ClientXMPP): message += self.api_caller.torrentList("full") case "add": - tag = "unknown" + category = "unknown" string_start = 2 - if tokens[2].startswith("t="): - tag = tokens[2].removeprefix("t=") + if tokens[2].startswith("c="): + category = tokens[2].removeprefix("c=") string_start = 3 - message += self.api_caller.add(tokens[string_start], msg['mucnick'], tag) + message += self.api_caller.add(tokens[string_start], msg['mucnick'], category) case "searchplugins": resp = self.api_caller.get_search_plugins() @@ -404,7 +404,7 @@ class QBBot(slixmpp.ClientXMPP): message += "help: Displays this help" + "\n" message += "list: Lists torrents, names truncated to 25 characters\n" message += "fulllist: Lists torrents, no name truncation\n" - message += "add [t=TAG] MAGNET_URL: Adds torrent corresponding to MAGNET_URL to the download list.\n\tNote that this will take about 5 seconds, as there's a check for 0 seeds after 5 seconds as a warning.\n\tOptionally include TAG to assist in automated copy.\n\tValid TAG values can be found with the categories in searchplugins\n" + message += "add [c=CATEGORY] MAGNET_URL: Adds torrent corresponding to MAGNET_URL to the download list.\n\tNote that this will take about 5 seconds, as there's a check for 0 seeds after 5 seconds as a warning.\n\tOptionally include CATEGORY to assist in automated copy.\n\tValid CATEGORY values can be found with the categories in searchplugins\n" message += "searchplugins: List the installed search plugins\n" message += "search [c=CATEGORY] search_string: Search from all enabled plugins for search_string, with optional category CATEGORY. Valid categories can be found from the searchplugins command.\n" message += "searchselect: Selects a torrent from a previous search to download\n"