Skip to content

Commit 6586eec

Browse files
author
Foxlet
committed
Ah, I already did that.
1 parent b47ecbe commit 6586eec

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

plugins/issafe.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from cloudbot import hook
2+
import cloudbot
23
import requests
34

45
API_SB = "https://sb-ssl.google.com/safebrowsing/api/lookup"
@@ -12,8 +13,13 @@ def load_api(bot):
1213

1314
@hook.command()
1415
def issafe(text):
15-
parsed = requests.get(API_SB, params={"url": text, "client": "cloudbot", "key": dev_key, "pver": "3.1", "appver": "1.0"})
16-
if str(parsed) == "<Response [204]>":
16+
"""<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)."
19+
20+
parsed = requests.get(API_SB, params={"url": text, "client": "cloudbot", "key": dev_key, "pver": "3.1", "appver": str(cloudbot.__version__)})
21+
22+
if parsed.status_code == 204:
1723
condition = "This website is safe."
1824
else:
1925
condition = "This site is known to contain: {}".format(parsed.text)

0 commit comments

Comments
 (0)