Complete Rewrite
changed everything
This commit is contained in:
parent
64419d5ddc
commit
522609c8ef
@ -194,7 +194,7 @@ async def on_message(message):
|
|||||||
if message.content.startswith('!wallpaper'):
|
if message.content.startswith('!wallpaper'):
|
||||||
await client.send_message(
|
await client.send_message(
|
||||||
message.channel,
|
message.channel,
|
||||||
wallpaper.getselect(message.content)
|
wallpaper.get_wall(message.content)
|
||||||
)
|
)
|
||||||
|
|
||||||
###################################
|
###################################
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import help_methods
|
import help_methods
|
||||||
|
|
||||||
def getselect(select):
|
def get_wall(message):
|
||||||
url = 'https://source.unsplash.com/3840x2160/'
|
unsplash_url = "https://source.unsplash.com/{}/?".format(resolution)
|
||||||
|
|
||||||
if len(select.split()) > 2:
|
if len(message.split()) > 2:
|
||||||
keyword = str(select.split('-'))
|
search_terms = message.split()[1:]
|
||||||
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(select.split()) > 1:
|
# Turn search_terms into strings separated by commas
|
||||||
#print (url)
|
joined_terms = ','.join(search_terms)
|
||||||
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')
|
|
||||||
|
|
||||||
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user