Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
ChatBot/final_bruno.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
83 lines (65 sloc)
2.29 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import spotipy | |
import sys | |
import pprint | |
import discord | |
#from Check import checky,checkn | |
client = discord.Client() | |
#client.run('token') | |
#show the artist top songs via a url or urn#doesnt work | |
def arttopsongs(): | |
if len(sys.argv) > 1: # number of arguments | |
urn = sys.argv[1] | |
else: | |
urn = 'spotify:artist:3jOstUTkEu2JkjvRdBA5Gu' | |
sp = spotipy.Spotify() | |
response = sp.artist_top_tracks(urn) | |
for track in response['tracks']: | |
print(track['name']) | |
# shows the artist profile#doesnt work | |
def showartist(): | |
spotify = spotipy.Spotify() | |
results = spotify.search(q='artist:' + name, type='artist') | |
print(results) | |
# shows the artist albums#doesnt work | |
def artist_albums(self, q2, album_type=None, country=None, limit=20, offset=0): | |
trid = self._get_id('artist', q2) | |
return self._get('artists/' + trid + '/albums', album_type=album_type, country=country, limit=limit, offset=offset) | |
#-------------------CODE STARTS HERE-------------------# | |
print(sys.version) | |
#rpy = input("Hello user, what's your name?\n") | |
#rpy = rpy.capitalize() | |
#age = input("How old are you? ") | |
#ans = input("And how is your day so far?") | |
greet = input("Hello" + rpy + "my name is speedy and I'm the bot for music. How are you?\n" | |
name = input("And who is your favourite music artist?\n") | |
name = name.lower() | |
if name == "drake": | |
print("Really? He's my favourite artist too.") | |
else: | |
print("Yeah, I like him too but my favourite artist is the beast named DRAKEEEEEE") | |
q = input("Do you want to know his top songs?\n") | |
q = q.lower() | |
if q == "yes": | |
showartist() | |
elif q == "no": | |
print("Ok, you're the boss" + rpy) | |
else: | |
print("Can you write again because I didn't understood what you have said") | |
# return q | |
q2 = input("Do you want to check" + name + "'s albums?") | |
if q2 == "yes": | |
artist_albums() | |
elif q2 == "no": | |
print("Ok, you're the boss" + rpy) | |
else: | |
print("Can you write again because I didn't understood what you have said") | |
# return q2 | |
ans2 = print("Check also your favourite artist profile.\n") | |
q3 = input("Okay?\n") | |
if q3 == "yes": | |
showartist() | |
elif q3 == "no": | |
print("Ok, you're the boss" + rpy) | |
else: | |
print("Can you write again because I didn't understood what you have said") | |
#return ans2 |