From c4efc88cae33c1c59ccc515ffbf4f11099f3cfd3 Mon Sep 17 00:00:00 2001 From: "King Mock (mockk)" Date: Tue, 27 Nov 2018 16:54:07 +0000 Subject: [PATCH] Add files via upload --- myconnector.py | 10 ++++++++++ web.py | 44 +++++++++++++++++++++++--------------------- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/myconnector.py b/myconnector.py index a3af545..dc6cdff 100644 --- a/myconnector.py +++ b/myconnector.py @@ -28,6 +28,7 @@ def commands(): commandList += "!name\n" commandList += "!hangman\n" commandList += "weather\n" + commandList += "web\n" return commandList @@ -105,9 +106,18 @@ async def on_message(message): elif message.content.lower().startswith('!help'): await client.send_message(message.channel, commands()) + ################################################## + # Kelvin Mock elif message.content.lower().startswith('weather'): await weather_realtime.weather(client,message) + elif message.content.lower().startswith('web'): + await web.YouTubeBrowser(client,message) + + elif message.content.lower().startswith('social'): + await + ################################################## + # sorry bout that, this part is causing some errors with stackoverflow module # elif message.content.lower().startswith('!'): # await client.send_message(message.channel, "Unknown command! Use `!help` for a command/usage list.") diff --git a/web.py b/web.py index 8745ef8..34acd77 100644 --- a/web.py +++ b/web.py @@ -1,22 +1,24 @@ -import requests -from bs4 import BeautifulSoup -import webbrowser - -page=requests.get("https://www.youtube.com/") - -soup=BeautifulSoup(page.text,"html.parser") - - -webbrowser.open("https://www.youtube.com/",new=2) -if webbrowser.open("https://www.youtube.com/",new=2)==True: #status printing - print("Successful browser, see in a few seconds.") - print("Status: ",page) -else: - print("I'm sorry. The browser isn't working though.") - print("Status: ",page) - - -#artist_name_list=soup.find(class_="BodyText") - -#artist_name_list_items=artist_name_list.find_all("a") +async def YouTubeBrowser(client,message): + import requests + from bs4 import BeautifulSoup + import webbrowser + + page=requests.get("https://www.youtube.com/") + + soup=BeautifulSoup(page.text,"html.parser") + + + webbrowser.open("https://www.youtube.com/",new=2) + if webbrowser.open("https://www.youtube.com/",new=2)==True: #status printing + print("Successful browser, see in a few seconds.") + await client.send_message(message.channel,"Successful browser, see in a few seconds.") + print("Status: ",page) + msg="Status: "+str(page) + await client.send_message(message.channel,msg) + else: + print("I'm sorry. The browser isn't working though.") + await client.send_message(message.channel,"I'm sorry. The browser isn't working though.") + print("Status: ",page) + msg="Status: "+str(page) + await client.send_message(message.channel,msg)