lib/api/spotify.rb in hibot-0.0.1 vs lib/api/spotify.rb in hibot-0.0.2
- old
+ new
@@ -4,9 +4,10 @@
PERMITTED_TYPES = %w{album artist track}
URI_REGEX = /spotify:([a-z]+):(\w+)/
def search(query)
# Check that parameters are correct or return the corresponding error
+ query = query.gsub('!ssearch', '').strip
type, q = query.split(' ')
return "Invalid search request. You have to provide a valid type (artist, album or track) and then your query" if type.nil? || q.nil?
return "Bad request. Allowed types are album, artist and track." unless PERMITTED_TYPES.include?(type)
# Perform the search and return the result
\ No newline at end of file