diff options
| author | 2019-06-25 21:30:40 +0100 | |
|---|---|---|
| committer | 2019-06-25 21:30:40 +0100 | |
| commit | 94dc2655e7b81f7f8686eab1739f99210f142946 (patch) | |
| tree | 9b46173a213ecc7903e562b077532027f742eb13 /modules/bitly.py | |
| parent | 'vote-start-restricted' -> 'votes-start-restricted' so as to avoid find (diff) | |
merge bitly code back in to shorturl.py as we use it for default shortener
Diffstat (limited to 'modules/bitly.py')
| -rw-r--r-- | modules/bitly.py | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/modules/bitly.py b/modules/bitly.py deleted file mode 100644 index 52703fe9..00000000 --- a/modules/bitly.py +++ /dev/null @@ -1,22 +0,0 @@ -#--depends-on commands -#--require-config bitly-api-key - -import re -from src import ModuleManager, utils - -URL_BITLYSHORTEN = "https://api-ssl.bitly.com/v3/shorten" - -class Module(ModuleManager.BaseModule): - def on_load(self): - self.exports.add("shorturl-s-bitly", self._shorturl) - def _shorturl(self, url): - if len(url) < 22: - return None - - page = utils.http.request(URL_BITLYSHORTEN, get_params={ - "access_token": self.bot.config["bitly-api-key"], - "longUrl": url}, json=True) - - if page and page.data["data"]: - return page.data["data"]["url"] - return None |
