Complete Rewrite

changed everything
This commit is contained in:
Unknown 2017-08-17 00:30:17 -05:00
parent 64419d5ddc
commit 522609c8ef
2 changed files with 18 additions and 21 deletions

View File

@ -194,7 +194,7 @@ async def on_message(message):
if message.content.startswith('!wallpaper'):
await client.send_message(
message.channel,
wallpaper.getselect(message.content)
wallpaper.get_wall(message.content)
)
###################################

View File

@ -1,25 +1,22 @@
import help_methods
def getselect(select):
url = 'https://source.unsplash.com/3840x2160/'
def get_wall(message):
unsplash_url = "https://source.unsplash.com/{}/?".format(resolution)
if len(select.split()) > 2:
keyword = str(select.split('-'))
keyword = keyword.replace(' ', '&')
for reform in ['[', ']', '\'', '!wallpaper&']:
if reform in keyword:
keyword = keyword.replace(reform,"")
url = "?".join((url, keyword))
if 'waifu' in keyword:
url = 'https://media0.giphy.com/media/C79RKZ7nOcK8U/giphy.gif'
if len(message.split()) > 2:
search_terms = message.split()[1:]
if len(select.split()) > 1:
#print (url)
keyword = select.split()[1]
url = "?".join((url, keyword))
if 'waifu' in keyword:
url = 'https://media0.giphy.com/media/C79RKZ7nOcK8U/giphy.gif'
if 'help' in keyword:
return help_methods.get_help_message('wallpaper')
# Turn search_terms into strings separated by commas
joined_terms = ','.join(search_terms)
return url
# Add those comma separated strings onto the end of the URL variable
url = unsplash_url + joined_terms
elif len(message.split()) > 1:
term = message.split()[1]
url = unsplash_url + term
else:
url = unsplash_url
return url