Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Created by Doopian
- Version 1.0
- Date Updated: January 25th, 2016
- */
- on *:TEXT:!songs:#: {
- if (%songstimer == 0) {
- if (%SongsLink == $null) {
- msg $chan I don't have a link to a list of songs $nick
- }
- else {
- msg $chan The songs you can request are found here %SongsLink
- }
- %songstimer = 1
- .timer 1 10 set %songstimer 0
- }
- }
- on *:TEXT:!currentsong:#: {
- if (%currenttimer == 0) {
- var %songname $readini(SongRequests.ini, n, Songs, 0)
- var %user $readini(UserRequests.ini, n, Users, 0)
- if (%songname != $null) {
- msg $chan " %songname " requested by %user is the current song.
- }
- else {
- msg $chan there are no songs left on the list. Type !request to request a song.
- }
- %currenttimer = 1
- .timer 1 10 set %currenttimer 0
- }
- }
- on *:TEXT:!nextsong:#: {
- if (%nexttimer == 0) {
- var %songname $readini(SongRequests.ini, n, Songs, 1)
- var %user $readini(UserRequests.ini, n, Users, 1)
- if (%songname != $null) {
- msg $chan " %songname " requested by %user is the next song.
- }
- else {
- msg $chan there is no next song. type !request to get your song on the list.
- }
- %nexttimer = 1
- .timer 1 10 set %nexttimer 0
- }
- }
- on 3:TEXT:!resetsongs:#: {
- /remini SongRequests.ini Songs
- /remini UserRequests.ini Users
- %totalsongs = 0
- msg $chan songs have been reset.
- }
- on *:TEXT:!request*:#: {
- if ($2- == $null) {
- msg $chan please add a song name $nick
- }
- elseif ($2- isnum) {
- msg $chan you can not request numbers $nick
- }
- elseif (%totalsongs >= %TotalSongLimit) {
- msg $chan the song list is currently full $nick
- }
- elseif ($len($2-) > %SongLengthLimit) {
- msg $chan that song name too long $nick
- }
- elseif ($countRequest(SongRequests.ini, Songs, $2-) >= %SongRequestLimit) {
- msg $chan that song is already on the list $nick
- }
- elseif ($countRequest(UserRequests.ini, Users, $nick) >= %UserRequestLimit) {
- msg $chan you already have a song on the list $nick
- }
- else {
- var %song $2-
- writeini -n SongRequests.ini Songs %totalsongs %song
- writeini -n UserRequests.ini Users %totalsongs $nick
- %totalsongs = $calc(%totalsongs + 1)
- msg $chan The song " %song " has been added to the list $nick
- }
- }
- /*
- Removes the first song on the list (song currently being played)
- */
- on 3:TEXT:!pop:#: {
- $removeRequest(SongRequests.ini, Songs, 0)
- $removeRequest(UserRequests.ini, Users, 0)
- %totalsongs = $calc(%totalsongs - 1)
- var %next $readini(SongRequests.ini, n, Songs, 0)
- var %user $readini(UserRequests.ini, n, Users, 0)
- if (%next == $null) {
- msg $chan there are no songs left on the list. Type !request to request a song.
- }
- else {
- msg $chan the next song is " %next " requested by %user
- }
- }
- /*
- Removes a target song from the list (takes numbers starting at 1 or takes the song title)
- */
- on *:TEXT:!remove*:#: {
- if ($nick isop #) {
- if ($2- isnum) {
- var %index $2-
- if (%index < 1 || %index > %totalsongs) {
- msg $chan that is not a song's spot on the list $nick
- }
- elseif (. isin %index) {
- msg $chan don't use decimals $nick
- }
- else {
- var %actualIndex $calc(%index - 1)
- var %songname $readini(SongRequests.ini, n, Songs, %actualIndex)
- $removeRequest(UserRequests.ini, Users, %actualIndex)
- $removeRequest(SongRequests.ini, Songs, %actualIndex)
- %totalsongs = $calc(%totalsongs - 1)
- msg $chan " %songname " has been removed from the list $nick
- }
- }
- elseif ($2- == $null) {
- msg $chan please use a song number or song title to remove $nick
- }
- else {
- var %index $findNum($2-)
- if (%index == -1) {
- msg $chan Couldn't find that song $nick
- }
- else {
- $removeRequest(UserRequests.ini, Users, %actualIndex)
- $removeRequest(SongRequests.ini, Songs, %index)
- %totalsongs = $calc(%totalsongs - 1)
- msg $chan " $2- " has been removed from the list $nick
- }
- }
- }
- }
- on *:TEXT:!change*:#: {
- if ($nick isop #) {
- if ($2 isnum) {
- var %index $2
- if (%index < 1 || %index > %totalsongs) {
- msg $chan that is not a song's spot on the list $nick
- }
- elseif (. isin %index) {
- msg $chan don't use decimals $nick
- }
- else {
- var %actualIndex $calc(%index - 1)
- var %songname $readini(SongRequests.ini, n, Songs, %actualIndex)
- writeini -n SongRequests.ini Songs %actualindex $3-
- msg $chan $nick has changed " %songname " has been changed to " $3- "
- }
- }
- }
- }
- on *:TEXT:!list:#: {
- if (%listtimer == 0) {
- var %count 0
- var %output The song list is
- %output = %output $+ $chr(32) $+ $chr(32)
- while (%count < %totalsongs) {
- var %song $readini(SongRequests.ini, Songs, %count)
- if (%count == $calc(%totalsongs - 1)) {
- %output = %output $+ %song $+ $chr(46) $+ $chr(32) $+ $chr(32)
- }
- else {
- %output = %output $+ %song $+ $chr(44) $+ $chr(32) $+ $chr(32)
- }
- %count = $calc(%count + 1)
- }
- msg $chan %output
- %listtimer = 1
- .timer 1 10 set %listtimer 0
- }
- }
- alias findNum {
- var %count 0
- var %target $1
- while (%count < %totalsongs) {
- var %tempSong $readini(SongRequests.ini, n, Songs, %count)
- if (%tempSong == %target) {
- return %count
- }
- %count = $calc(%count + 1)
- }
- return -1
- }
- alias countRequest {
- var %count 0
- var %repeats 0
- while (%count < %totalsongs) {
- if ($readini($1, n, $2, %count) == $3) {
- inc %repeats
- }
- %count = $calc(%count + 1)
- }
- return %repeats
- }
- alias removeRequest {
- var %count 0
- var %found 0
- var %target $3
- while (%count < %totalsongs) {
- if (%found == 1) {
- var %beforeCount $calc(%count - 1)
- var %tempsong $readini($1, n, $2, %count)
- writeini -n $1 $2 %beforeCount %tempsong
- }
- if (%count == %target) {
- /remini $1 $2 %count
- %found = 1
- }
- %count = $calc(%count + 1)
- }
- /remini $1 $2 $calc(%count - 1)
- }
Advertisement
Add Comment
Please, Sign In to add comment