Hey all.
I need some help finishing up a song request system for my twitch bot. I want to add in a way for the bot to recognize links so that for the !songrequest command, if one does not give a link, their input will not be accepted. I'm still relatively new to IRC and coding so I was having trouble with this.
For example:
This: !songrequest Test youtube.com/test
Should give an output of "added song name Test to the song queue. youtube.com/test
Any help is appreciated. Thanks in advance.
on $*:TEXT:!songrequest &:#: {
if ((%floodsongrequest) || ($($+(%,floodsongrequest.,$nick),2))) { return }
write songlist.txt $2
write songlinks.txt $3
write songusers.txt $nick
msg $chan /me added song name $2 to the song queue. %slink
}
on *:text:!currentsong:#: {
if ((%floodcurrentsong) || ($($+(%,floodcurrentsong.,$nick),2))) { return }
set -u30 %floodcurrentsong On
set -u60 %floodcurrentsong. $+ $nick On {
if ($read(songlist.txt,2)) {
var %slist2 $read(songlist.txt,1)
var %slink2 $read(songlinks.txt,1)
var %suser2 $read(songusers.txt,1)
msg $chan /me : Current Song: %slist $chr(124) Requested by %suser $chr(124) %slink
write -dl1 songlist.txt
write -dl1 songlinks.txt
write -dl1 songusers.txt
}
else {
msg $chan /me : There are no more songs in the queue.
write -dl1 songlist.txt
write -dl1 songlinks.txt
write -dl1 songusers.txt
}
}
}
on *:text:!nextsong:#: {
if ($nick isop #) {
if ((%floodnextsong) || ($($+(%,floodnextsong.,$nick),2))) { return }
set -u5 %floodnextsong On
set -u10 %floodnextsong. $+ $nick On {
if ($read(songlist.txt,2)) {
var %slist2 $read(songlist.txt,2)
var %slink2 $read(songlinks.txt,2)
var %suser2 $read(songusers.txt,2)
msg $chan /me : Next Song: %slist $chr(124) Requested by %suser $chr(124) %slink
write -dl1 songlist.txt
write -dl1 songlinks.txt
write -dl1 songusers.txt
}
else {
msg $chan /me : There are no more songs in the queue.
write -dl1 songlist.txt
write -dl1 songlinks.txt
write -dl1 songusers.txt
}
}
}
else msg# Sorry, but this command is only available to moderators. FUNgineer
}