Hi,
can someone write me a script that will say something like this:
User [username] tells us he is currently listening to the SONG: [song name] by BAND: [band]
so like:
+listen Jimmy Eat World - In the Middle
would get this displayed:
Bot Name: User BillyBob tells us he is currently listening to the SONG: In the Middle by BAND: Jimmy Eat World
I suppose the - would divide name of the song and band, so spaces wouldn't matter until the - shows up
Hi,
Hope it helps..
--Requested by frankyk
--Made by nErBoS
sBot = "Music-Bot"
function Main()
frmHub:RegBot(sBot)
end
function DataArrival(user, data)
if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
data = strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
if (cmd=="!listen") then
ListenMusic(user, data)
return 1
end
end
end
function ListenMusic(user, data)
local s,e,author,music = strfind(data, "%b<>%s+%S+%s+(%S+)%s+(.*)")
if (author == nil or music == nil) then
user:SendData(sBot, "Syntax Error, !listen , you must write a name to the author and to the music.")
else
SendToAll(sBot, "User "..user.sName.." tells us he is currently listening to the SONG: "..music.." by BAND: "..author)
end
end
In the Author Name i must have instead of space a underscore in the music name is no problem.
Best regards, nErBoS
or with spaces..
+listen
-
function DataArrival(user, data)
if strsub(data,1,1) == "<" then
local s, e, cmd, args = strfind(data, "^%b<> %+(%a+)%s*(.*)%|$")
if s and cmd == "listen" then
local s, e, artist, title = strfind(args, "^(.-)%s*%-%s*(.+)$")
if s then
SendToAll("*** "..user.sName.." now playing "..artist.."-"..title)
else
user:SendData(">> syntax: +listen -")
end
return 1
end
end
end
Good script, could you make it so instead of underscore, it takes a space, like linkin park - runaway would display linkin park and song is runaway instead of linkin name, song park runaway or something
Thanks!
right