samgh96 / spotiuribot Goto Github PK
View Code? Open in Web Editor NEWTelegram bot written in Elixir, given a Spotify URI returns its data.
Telegram bot written in Elixir, given a Spotify URI returns its data.
So! It would be awesome to use the bot like this:
@spotiuribot spotify:track:6lUC7qK9Wz3ED5EX9xxrU6
And then lets you choose the info you want to share:
(List should be discussed)
The All
one would be the most used option I think, It will send a message like:
Artist: Racer X
Album: Technical Difficulties
Track: Technical Difficulties
And a button with the link to the song in https://open.spotify.com
PD: https://www.urbandictionary.com/define.php?term=sexyness
Sending the song/album info is very usefull, but it would be awesome if the bot also searches the song on youtube and gives you a link to the first result of the response.
I think it fits better the intention of the bot if, instead of showing a sad face when given an unrecognized URI, it shows the "Give you the finger" emote
diff --git a/lib/bot/bot.ex b/lib/bot/bot.ex
index 0903f22..9df46c7 100644
--- a/lib/bot/bot.ex
+++ b/lib/bot/bot.ex
@@ -8,7 +8,7 @@ defmodule Spotiuribot.Bot do
def getalbum(uri) do
case HTTPotion.get("https://api.spotify.com/v1/albums/#{uri}").body |> Poison.decode do
- {:ok, %{"artists" => [%{"name" => artistname} | _ ], "name" => albumname}} -> "Artist: #{artistname} \nAlbum: #{albumname}"
+ {:ok, %{"artists" => [%{"name" => artistname} | _ ], "name" => albumname}} -> "Artist: #{artistname} \nAlbum: #{albumname}\n\nhttps://open.spotify.com/album/#{uri}"
_ -> "Unknown URI: #{uri} ☹️"
end
end
@@ -17,7 +17,7 @@ defmodule Spotiuribot.Bot do
case HTTPotion.get("https://api.spotify.com/v1/tracks/#{uri}").body |> Poison.decode do
{:ok, %{"artists" => [%{"name" => artistname} | _ ],
"album" => %{"name" => albumname},
- "name" => trackname}} -> "Artist: #{artistname} \nAlbum: #{albumname} \nTrack: #{trackname}"
+ "name" => trackname}} -> "Artist: #{artistname} \nAlbum: #{albumname} \nTrack: #{trackname}\n\nhttps://open.spotify.com/track/#{uri}"
_ -> "Unknown URI: #{uri} ☹️"
end
end
Estaria bien que los mensajes fueran mas pequeños para los usuarios de movil.
Aqui te dejo como se pueden quitar:
answer msg, message_text, bot: name, disable_web_page_preview: true
Pls.
echo *~ >> .gitignore
git rm mix.exs~
git add .gitignore
git commit
git push
❤️
"spotify:track:5MYfpFJYm8WNFGssR6H2Oz"
its ok, but why dont it also accept
"Ey Sam, you are soy beautiful, listen to this. spotify:track:5MYfpFJYm8WNFGssR6H2Oz I'm sure you will love it"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.