Skip to content

Commit 7238e1d

Browse files
author
Foxlet
committed
Intelligent Checks
1 parent 6586eec commit 7238e1d

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

plugins/issafe.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
1+
"""
2+
issafe.py
3+
4+
A plugin that uses the RRRather.com API to return random "Would you rather" questions.
5+
6+
Created By:
7+
- Foxlet <http://furcode.tk/>
8+
9+
License:
10+
GNU General Public License (Version 3)
11+
"""
12+
113
from cloudbot import hook
214
import cloudbot
315
import requests
16+
from urllib.parse import urlparse
417

518
API_SB = "https://sb-ssl.google.com/safebrowsing/api/lookup"
619

@@ -14,8 +27,8 @@ def load_api(bot):
1427
@hook.command()
1528
def issafe(text):
1629
"""<website> -- Checks the website against Google's Safe Browsing List."""
17-
if "http://" not in text:
18-
return "Check your URL (it must be complete)."
30+
if urlparse(text).scheme == False:
31+
return "Check your URL (it should be a complete url)."
1932

2033
parsed = requests.get(API_SB, params={"url": text, "client": "cloudbot", "key": dev_key, "pver": "3.1", "appver": str(cloudbot.__version__)})
2134

0 commit comments

Comments
 (0)