mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2015
Posts: 26
Z
zigress Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Sep 2015
Posts: 26
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
}

Joined: Feb 2015
Posts: 243
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
Do you mean to check if $2 is a valid youtube link?

Joined: Sep 2015
Posts: 26
Z
zigress Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Sep 2015
Posts: 26
I want to check if $3 is a valid link. $2 is the song name.
I just realized there's an error in the code. in the !songrequest command, it should be:
msg $chan /me added song name $2 to the song queue. $3

Joined: Feb 2015
Posts: 243
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
Ok!! Do you want to just check it like this:
Code:
if (*youtube.com/watch?v* iswm $3) {

Or use sockets to actually check if it is a real link??
I could write it for you if you want.

Joined: Sep 2015
Posts: 26
Z
zigress Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Sep 2015
Posts: 26
Just wanted to check if its a youtube link.
So, if someone does not give a youtube link, then the bot will output msg # insufficient parameters etc etc. Doesn't have to be valid.
I think this should be ok, though, but will alternate youtube links work? Like the ones that are like "yout.ube."

Thanks again! smile


Link Copied to Clipboard