Advertisement
swarfega

Untitled

Nov 2nd, 2012
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 26.57 KB | None | 0 0
  1. ############################################
  2. ############## radio-0.9.tcl ###############
  3. ############################################
  4. #    http://radioscript.sourceforge.net/   #
  5. # This is the main part of radio-0.9c.tcl! #
  6. ############################################
  7.  
  8. # Which is the radios main/public channel?
  9. set radio:chan "#epic.radio"
  10.  
  11. # What's your radios name?
  12. set radio:name "epic.Radio"
  13.  
  14. # Whats your radios homepage?
  15. set radio:url "http://www.http://epicradio.co.uk"
  16.  
  17. # URI of your Stream? (without listen.pls)
  18. set radio:stream "http://stream.epicradio.co.uk:8000/live.m3u"
  19.  
  20. # Display a welcome message?
  21. set radio:welcome "0"
  22.  
  23. # Don't change the next 2 lines if you don't know what you're doing!
  24. set radio:dj ""
  25. set radio:nextdj ""
  26.  
  27. # Which flag is needed to change the active dj?
  28. # (Only works if radio:commandmode is 1!)
  29. set radio:flag "R|R"
  30.  
  31. # Should the DJ set himself as DJ ("1") or set somebody else
  32. # into the DJ position ("2")?
  33. set radio:dj:mode "0"
  34.  
  35. # Disable the radioscript by default.
  36. set radio:off "0"
  37.  
  38. # Command mode:
  39. # 1: MSG to bot, 2: Control over internal/command channel
  40. set radio:commandmode "1"
  41.  
  42. # command channel (note _everybody_ can change anything if he/she gets
  43. # into there!)
  44. set radio:commandchan "#sandvich"
  45.  
  46. # In which file should the topic be saved?
  47. set radio:topicfile "radio.topic"
  48.  
  49. # In which file should the internal/command chan topic be saved?
  50. set radio:inttopicfile "radio.inttopic"
  51.  
  52. # Should I change the topic when changing the DJ?
  53. set radio:set:topic "0"
  54.  
  55. # Should I change the command chan topic when the next dj is set?
  56. # Note: Only use this if ${radio:commandchan} is set correctly!
  57. set radio:set:inttopic "1"
  58.  
  59. # Use the botnet? (Small option, big change. ;))
  60. set radio:net:enable "0"
  61.  
  62. #######################
  63. # Script begins here! #
  64. #######################
  65. bind pub -|- !url radio:pub:url
  66. bind pub -|- !stream radio:pub:stream
  67. bind pub -|- !dj radio:pub:dj
  68. bind pub -|- !wish radio:pub:wunsch
  69. bind pub -|- !greet radio:pub:gruss
  70. bind pub -|- !info radio:pub:info
  71. bind pub -|- !nextdj radio:pub:nextdj
  72. bind msg ${radio:flag} dj radio:msg:dj
  73. bind msg ${radio:flag} radiooff radio:msg:off
  74. bind msg ${radio:flag} nextdj radio:msg:nextdj
  75. bind msg ${radio:flag} next radio:msg:next
  76. bind msg ${radio:flag} topic radio:msg:topic
  77. bind join -|- * radio:join:welcome
  78. bind pub -|- .dj radio:pub:setdj
  79. bind pub -|- .radiooff radio:pub:off
  80. bind pub -|- .info radio:pub:dotinfo
  81. bind pub -|- .nextdj radio:pub:setnextdj
  82. bind pub -|- .next radio:pub:next
  83. bind pub -|- .restart radio:pub:restart
  84. bind pub -|- .topic radio:pub:topic
  85. bind pub -|- .inttopic radio:pub:inttopic
  86. bind pub -|- ?topic radio:pub:topicinfo
  87. bind pub -|- .dotopic radio:pub:dotopic
  88. bind pub -|- .ntopic radio:net:topic
  89. bind bot - radio_wunsch radio:net:wunsch
  90. bind bot - radio_gruss radio:net:gruss
  91. bind bot - radio_status radio:net:sendstatus
  92. bind link - * radio:net:offerstatus
  93.  
  94. proc radio:pub:url {nick host hand chan arg} {
  95.     global radio:name radio:url radio:chan
  96.         if {$chan == ${radio:chan}} {
  97.                 puthelp "NOTICE $nick :You can see the homepage of ${radio:name} at ${radio:url} if you want."
  98.     }
  99. }
  100.  
  101. proc radio:pub:stream {nick host hand chan arg} {
  102.     global radio:name radio:stream radio:off radio:chan
  103.         if {$chan == ${radio:chan}} {
  104.         if {${radio:off}} {
  105.                         puthelp "NOTICE $nick :The radio script is not active a this moment, sorry."
  106.             return 0
  107.         }
  108.                 puthelp "NOTICE $nick :Listen to the stream of ${radio:name} at ${radio:stream}listen.pls now!"
  109.     }
  110. }
  111.  
  112. proc radio:pub:dj {nick host hand chan arg} {
  113.     global radio:dj radio:off radio:chan
  114.         if {$chan == ${radio:chan}} {
  115.         if {${radio:off}} {
  116.                         puthelp "NOTICE $nick :The radio script is not active at this moment, sorrry."
  117.             return 0
  118.         }
  119.                 puthelp "NOTICE $nick :Right now, \002${radio:dj}\002 is amusing you with his or her music!"
  120.     }
  121. }
  122.  
  123. proc radio:pub:wunsch {nick host hand chan arg} {
  124.     global radio:name radio:dj radio:off radio:chan radio:wunsch
  125.         set radio:wunsch "$arg"
  126.         if {$chan == ${radio:chan}} {
  127.         if {${radio:off}} {
  128.                         puthelp "NOTICE $nick :The radio script is not active at this moment, sorry."
  129.             return 0
  130.         }
  131.                 if {${radio:wunsch} == ""} {
  132.                         puthelp "NOTICE $nick :What about giving me a title?!"
  133.             return 0
  134.         }
  135.                 putquick "PRIVMSG ${radio:dj} :04Wish: ${radio:wunsch} by $nick."
  136.                 puthelp "NOTICE $nick :Your wish ${radio:wunsch} has been sent to ${radio:dj}. Do not try wishing that again since we will obviously ignore you then!"
  137.     }
  138. }
  139.  
  140. proc radio:pub:gruss {nick host hand chan arg} {
  141.     global radio:name radio:dj radio:off radio:chan radio:gruss
  142.         set radio:gruss "$arg"
  143.         if {$chan == ${radio:chan}} {
  144.         if {${radio:off}} {
  145.                         puthelp "NOTICE $nick :The radio script is not active at this moment, sorry."
  146.             return 0
  147.         }
  148.                 if {${radio:gruss} == ""} {
  149.                         puthelp "NOTICE $nick :You did not append a greeting message!"
  150.             return 0
  151.         }
  152.                 putquick "PRIVMSG ${radio:dj} :07Greeting: ${radio:gruss} by $nick."
  153.                 puthelp "NOTICE $nick :Your greeting ${radio:gruss} has been sent to ${radio:dj}. Do not send the same greeting again or we will definately ignore you then! :P"
  154.     }
  155. }
  156.  
  157. proc radio:msg:dj {nick host hand arg} {
  158.         global radio:name radio:dj radio:off radio:chan
  159.     global radio:dj:mode radio:commandmode
  160.     global radio:topicfile radio:topic radio:set:topic
  161.     global radio:net:enable
  162.     if {${radio:commandmode} == "2"} { return 0 }
  163.     if {${radio:dj:mode} == "1"} {
  164.         set radio:dj "$nick"
  165.         if {${radio:off}} {
  166.                         putquick "PRIVMSG ${radio:dj} :The radio script had been offline before and has been activated now."
  167.                         puthelp "PRIVMSG ${radio:chan} :The radio is now ONLINE with your DJ ${radio:dj}."
  168.         }
  169.                 putquick "PRIVMSG ${radio:dj} :You are now DJ of ${radio:name}!"
  170.         set radio:off "0"
  171.                 if {${radio:set:topic} == "1"} {
  172.             source ${radio:topicfile}
  173.                         putserv "TOPIC ${radio:chan} :${radio:topic}"
  174.                 }
  175.         if {${radio:net:enable} == "1"} {
  176.             putallbots "radio_dj ${radio:dj}"
  177.         }
  178.         } else {
  179.                 if {$arg == ""} {
  180.                         putquick "NOTICE $nick :Gimme the nick of the DJ ..."
  181.             return 0
  182.         }
  183.                 set radio:dj "$arg"
  184.         if {${radio:off}} {
  185.                         putquick "PRIVMSG ${radio:dj} :The radio script had been offline before and has been activated now."
  186.                         puthelp "PRIVMSG ${radio:chan} :The radio is now ONLINE with your DJ ${radio:dj}."
  187.         }
  188.                 putquick "PRIVMSG ${radio:dj} :You are now DJ of ${radio:name}."
  189.                 putquick "NOTICE $nick :${radio:dj} has been set as the current DJ of ${radio:name}."
  190.         set radio:off "0"
  191.                 if {${radio:set:topic} == "1"} {
  192.             source ${radio:topicfile}
  193.                         putserv "TOPIC ${radio:chan} :${radio:topic}"
  194.                 }
  195.         if {${radio:net:enable} == "1"} {
  196.             putallbots "radio_dj ${radio:dj}"
  197.         }
  198.     }
  199. }
  200.  
  201. proc radio:msg:off {nick host hand arg} {
  202.         global radio:name radio:off radio:chan radio:dj radio:stream radio:url
  203.     global radio:commandmode
  204.     global radio:topicfile radio:topic radio:set:topic radio:stream
  205.     global radio:net:enable
  206.     if {${radio:commandmode} == "2"} { return 0 }
  207.     set radio:off "1"
  208.         set radio:dj "offline"
  209.     set radio:nextdj "none"
  210.         putquick "NOTICE $nick :The radio script for ${radio:chan} has been deactivated."
  211.         if {${radio:set:topic} == "1"} {
  212.         source ${radio:topicfile}
  213.                 putserv "TOPIC ${radio:chan} :${radio:topic}"
  214.         }
  215.     if {${radio:net:enable} == "1"} {
  216.         putallbots "radio_status off"
  217.     }
  218. }
  219.  
  220. proc radio:join:welcome {nick uhost hand chan} {
  221.     global radio:name radio:chan botnick radio:welcome
  222.     if {$nick == $botnick} {return 0}
  223.     if {${radio:welcome} == "0"} {return 0}
  224.         if {$chan == ${radio:chan}} {
  225.                 puthelp "NOTICE $nick :Welcome to ${radio:chan}, the IRC chan of ${radio:name}! You may use the following commands:"
  226.                 puthelp "NOTICE $nick :Type !url to get the address of our homepage, !stream on information where to listen to the radio, !dj to see the current and !nextdj for the next DJ. Further on you can !wish a song and !greet someone using the radio."
  227.         }
  228. }
  229.  
  230. proc radio:pub:setdj {nick host hand chan arg} {
  231.         global radio:name radio:dj radio:nextdj radio:off radio:chan radio:url radio:stream
  232.     global radio:dj:mode radio:commandmode radio:commandchan
  233.     global radio:topicfile radio:topic radio:set:topic
  234.     global radio:set:inttopic radio:inttopic radio:inttopicfile
  235.     global radio:net:enable
  236.     if {${radio:commandmode} == "1"} { return 0 }
  237.         if {$chan == ${radio:commandchan}} {
  238.         if {${radio:dj:mode} == "1"} {
  239.             set radio:dj "$nick"
  240.             if {${radio:off}} {
  241.                             putquick "PRIVMSG ${radio:dj} :The radio script had been offline before and has been activated now."
  242.                             puthelp "PRIVMSG ${radio:chan} :The radio is now ONLINE with your DJ ${radio:dj}."
  243.             }
  244.                     putquick "PRIVMSG ${radio:dj} :You are now DJ of ${radio:name}."
  245.             set radio:off "0"
  246.                         if {${radio:set:topic} == "1"} {
  247.                 source ${radio:topicfile}
  248.                                 putserv "TOPIC ${radio:chan} :${radio:topic}"
  249.                         }
  250.             if {${radio:net:enable} == "1"} {
  251.                 putallbots "radio_dj ${radio:dj}"
  252.             }
  253.             } else {
  254.                     if {$arg == ""} {
  255.                             putquick "PRIVMSG $chan :Gimme the nick of the DJ, $nick ..."
  256.                 return 0
  257.             }
  258.                     set radio:dj "$arg"
  259.             if {${radio:off}} {
  260.                             putquick "PRIVMSG ${radio:dj} :The radio script had been offline before and has been activated now."
  261.                             puthelp "PRIVMSG ${radio:chan} :The radio is now online with your DJ ${radio:dj}."
  262.             }
  263.                     putquick "PRIVMSG ${radio:dj} :You are now DJ of ${radio:name}."
  264.                     putquick "PRIVMSG ${radio:commandchan} :${radio:dj} has been set as the current DJ of ${radio:name}."
  265.             set radio:off "0"
  266.                         if {${radio:set:topic} == "1"} {
  267.                 source ${radio:topicfile}
  268.                                 putserv "TOPIC ${radio:chan} :${radio:topic}"
  269.                         }
  270.             if {${radio:set:inttopic} == "1"} {
  271.                 source ${radio:inttopicfile}
  272.                 putserv "TOPIC ${radio:commandchan} :${radio:inttopic}"
  273.             }
  274.             if {${radio:net:enable} == "1"} {
  275.                 putallbots "radio_dj ${radio:dj}"
  276.             }
  277.         }
  278.     }
  279. }
  280.  
  281. proc radio:pub:off {nick host hand chan arg} {
  282.         global radio:name radio:off radio:chan radio:stream radio:url radio:dj radio:nextdj
  283.     global radio:commandchan radio:commandmode
  284.     global radio:topic radio:topicfile radio:set:topic
  285.     global radio:set:inttopic radio:inttopic radio:inttopicfile
  286.     global radio:net:enable
  287.     if {${radio:commandmode} == "1"} { return 0 }
  288.         if {$chan == ${radio:commandchan}} {
  289.         set radio:off "1"
  290.                 set radio:dj "offline"
  291.         set radio:nextdj "none"
  292.                 putquick "PRIVMSG ${radio:commandchan} :The radio script for ${radio:chan} has been deactivated."
  293.                 if {${radio:set:topic} == "1"} {
  294.             source ${radio:topicfile}
  295.                         putserv "TOPIC ${radio:chan} :${radio:topic}"
  296.                 }
  297.         if {${radio:set:inttopic} == "1"} {
  298.             source ${radio:inttopicfile}
  299.             putserv "TOPIC ${radio:commandchan} :${radio:inttopic}"
  300.         }
  301.         if {${radio:net:enable} == "1"} {
  302.             putallbots "radio_status off"
  303.         }
  304.     }
  305. }
  306.  
  307. proc radio:pub:info {nick host hand chan arg} {
  308.     global radio:name radio:url radio:chan
  309.         if {$chan == ${radio:chan}} {
  310.                 puthelp "NOTICE $nick :You may use the following commands:"
  311.                 puthelp "NOTICE $nick :Type !url to get the address of our homepage, !stream on information where to listen to the radio, !dj to see the current and !nextdj for the next DJ. Further on you can !wish a song and !greet someone using the radio."
  312.     }
  313. }
  314.  
  315. proc radio:pub:restart {nick host hand chan arg} {
  316.     global radio:commandmode radio:commandchan
  317.     if {${radio:commandmode} == "1"} { return 0 }
  318.     if {$chan == ${radio:commandchan}} {
  319.         restart
  320.     }
  321. }
  322.  
  323. proc radio:pub:dotinfo {nick host hand chan arg} {
  324.     global radio:chan
  325.     global radio:dj:mode radio:commandmode radio:commandchan
  326.     global radio:set:topic
  327.     if {${radio:commandmode} == "1"} { return 0 }
  328.         if {$chan == ${radio:commandchan}} {
  329.                 puthelp "NOTICE $nick :You may use the following commands::"
  330.         if {${radio:dj:mode} == "1"} {
  331.             set radio:info:dj "Use \002.dj\002 to set \037yourself\037 as the DJ,"
  332.             set radio:info:nextdj "use \002.nextdj\002 to be the next DJ as soon as someone uses \002.next\002,"
  333.         } else {
  334.             set radio:info:dj "Use \002.dj NICK\002 to set \037NICK\037 as the DJ,"
  335.             set radio:info:nextdj "use \002.nextdj NICK\002 to set \037NICK\037 as the next DJ as soon as someone uses \002.next\002,"
  336.         }
  337.         set radio:info:restart "\002.restart\002 restarts the bot"
  338.         set radio:info:off "und \002.radiooff\002 deactivates the radio script."
  339.         if {${radio:set:topic} == "1"} {
  340.             set radio:info:topic "Informationen on the commands \002.topic\002 and \002.inttopic\002 will be given if you use \002?topic\002."
  341.         } else {
  342.             set radio:info:topic ""
  343.         }
  344.         puthelp "NOTICE $nick :${radio:info:dj} ${radio:info:nextdj} ${radio:info:restart} ${radio:info:off} ${radio:info:topic}"
  345.     }
  346. }
  347.  
  348. proc radio:pub:topicinfo {nick host hand chan arg} {
  349.     global radio:chan
  350.     global radio:commandmode radio:commandchan radio:dj:mode
  351.     if {${radio:commandmode} == "1"} { return 0 }
  352.         if {$chan == ${radio:commandchan}} {
  353.                 puthelp "NOTICE $nick :Use \002.topic\002 to set the topic which should be set as when changing the DJ or deactivating the script (DJ \"offline\"). Note that some letters like \],\[,\",\},\{,\\ _have to_ be escaped with \\!"
  354.         puthelp "NOTICE $nick :Example: \".topic \\\[ \${radio:name} \\\] \\\[ @ \${radio:dj} \\\] \\\[ Stream: \${radio:stream}listen.pls \\\]"
  355.         puthelp "NOTICE $nick :Same applies for the internal topic. (\002.inttopic\002)"
  356.     }
  357. }
  358.  
  359. proc radio:pub:nextdj {nick host hand chan arg} {
  360.     global radio:name radio:chan radio:nextdj radio:dj radio:off
  361.         if {$chan == ${radio:chan}} {
  362.         if {${radio:off}} {
  363.                         puthelp "NOTICE $nick :The radio script is not active atm."
  364.             return 0
  365.         }
  366.                 if {${radio:nextdj} == ""} {
  367.                         puthelp "NOTICE $nick :There is no successor for ${radio:dj}."
  368.                         return 0
  369.                 }
  370.                 putquick "NOTICE $nick :${radio:nextdj} will do ${radio:dj}'s job later."
  371.     }
  372. }
  373.  
  374. proc radio:pub:setnextdj {nick host hand chan arg} {
  375.     global radio:name radio:nextdj radio:off radio:chan
  376.     global radio:dj:mode radio:commandmode radio:commandchan
  377.     global radio:inttopic radio:inttopicfile global:set:inttopic
  378.     global radio:net:enable
  379.     if {${radio:commandmode} == "1"} { return 0 }
  380.         if {$chan == ${radio:commandchan}} {
  381.         if {${radio:dj:mode} == "1"} {
  382.             set radio:nextdj "$nick"
  383.                     putquick "PRIVMSG ${radio:commandchan} :${radio:nextdj} has been set as the next DJ of ${radio:name}."
  384.             } else {
  385.                     if {$arg == ""} {
  386.                             putquick "PRIVMSG ${radio:commandchan} :Gimme the nick of the next DJ, $nick..."
  387.                 return 0
  388.             }
  389.                     set radio:nextdj "$arg"
  390.                     putquick "PRIVMSG ${radio:nextdj} :You have been set as the next DJ for ${radio:name}."
  391.                     putquick "PRIVMSG ${radio:commandchan} :${radio:nextdj} has been set as the next DJ for ${radio:name}."
  392.         }
  393.         if {${radio:set:inttopic} == "1"} {
  394.             source ${radio:inttopicfile}
  395.             putserv "TOPIC ${radio:commandchan} :${radio:inttopic}"
  396.         }
  397.         if {${radio:net:enable} == "1"} {
  398.             putallbots "radio_nextdj ${radio:nextdj}"
  399.         }
  400.     }
  401. }
  402.  
  403. proc radio:msg:nextdj {nick host hand arg} {
  404.     global radio:name radio:chan radio:nextdj
  405.     global radio:dj:mode radio:commandmode
  406.     global radio:net:enable
  407.     if {${radio:commandmode} == "2"} { return 0 }
  408.     if {${radio:dj:mode} == "1"} {
  409.         set radio:nextdj "$nick"
  410.         putquick "PRIVMSG $nick :${radio:nextdj} has been set as the next DJ for ${radio:name}."
  411.         } else {
  412.                 if {$arg == ""} {
  413.                         putquick "NOTICE $nick :Gimme the nick of the next DJ, $nick  ..."
  414.             return 0
  415.         }
  416.                 set radio:nextdj "$arg"
  417.         putquick "PRIVMSG ${radio:nextdj} :You have been chosen to be the next DJ for ${radio:name} by $nick."
  418.             putquick "NOTICE $nick :${radio:nextdj} has been set as the next DJ for ${radio:name}."
  419.     }
  420.     if {${radio:net:enable} == "1"} {
  421.         putallbots "radio_nextdj ${radio:nextdj}"
  422.     }
  423. }
  424.  
  425. proc radio:pub:next {nick host hand chan arg} {
  426.         global radio:name radio:dj radio:nextdj radio:off radio:chan radio:stream radio:url
  427.     global radio:commandchan radio:commandmode
  428.     global radio:topicfile radio:topic radio:set:topic
  429.     global radio:set:inttopic radio:inttopic radio:inttopicfile
  430.     global radio:net:enable
  431.     if {${radio:commandmode} == "1"} { return 0 }
  432.         if {$chan == ${radio:commandchan}} {
  433.         if {${radio:nextdj} == ""} {
  434.             putquick "PRIVMSG ${radio:commandchan} :No successor set."
  435.             return 0
  436.         } else {
  437.             set radio:dj "${radio:nextdj}"
  438.             set radio:nextdj "none"
  439.             if {${radio:off}} {
  440.                             putquick "PRIVMSG ${radio:dj} :The radio script had been offline before and has been activated now."
  441.                             puthelp "PRIVMSG ${radio:chan} :The radio is now ONLINE with your DJ ${radio:dj}."
  442.             }
  443.                     putquick "PRIVMSG ${radio:dj} :You are now DJ of ${radio:name}."
  444.             set radio:off "0"
  445.                         if {${radio:set:topic} == "1"} {
  446.                 source ${radio:topicfile}
  447.                                 putserv "TOPIC ${radio:chan} :${radio:topic}"
  448.                         }
  449.             if {${radio:set:inttopic} == "1"} {
  450.                 source ${radio:inttopicfile}
  451.                 putserv "TOPIC ${radio:commandchan} :${radio:inttopic}"
  452.             }
  453.             if {${radio:net:enable} == "1"} {
  454.                 putallbots "radio_next next"
  455.             }
  456.             set radio:nextdj ""
  457.         }
  458.     }
  459. }
  460.  
  461. proc radio:msg:next {nick host hand arg} {
  462.         global radio:name radio:dj radio:nextdj radio:off radio:chan
  463.     global radio:commandmode
  464.     global radio:topicfile radio:topic radio:set:topic
  465.     global radio:set:inttopic radio:inttopic radio:inttopicfile
  466.     global radio:net:enable
  467.             if {${radio:commandmode} == "2"} { return 0 }
  468.         if {${radio:nextdj == ""} {
  469.             putquick "PRIVMSG $nick :No successor set."
  470.             return 0
  471.         } else {
  472.             set radio:dj "${radio:nextdj}"
  473.             set radio:nextdj "none"
  474.             if {${radio:off}} {
  475.                             putquick "PRIVMSG ${radio:dj} :The radio script had been offline before and has been activated now."
  476.                             puthelp "PRIVMSG ${radio:chan} :The radio is now online with your DJ ${radio:dj}."
  477.             }
  478.                     putquick "PRIVMSG ${radio:dj} :You are now DJ of ${radio:name}."
  479.             set radio:off "0"
  480.                         if {${radio:set:topic} == "1"} {
  481.                 source ${radio:topicfile}
  482.                                 putserv "TOPIC ${radio:chan} :${radio:topic}"
  483.                         }
  484.             if {${radio:set:inttopic} == "1"} {
  485.                 source ${radio:inttopicfile}
  486.                 putserv "TOPIC ${radio:commandchan} :${radio:inttopic}"
  487.             }
  488.             if {${radio:net:enable} == "1"} {
  489.                 putallbots "radio_next next"
  490.             }
  491.         }
  492.     }
  493. }
  494.  
  495. proc radio:pub:topic {nick host hand chan arg} {
  496.         global radio:chan radio:dj radio:name radio:stream radio:url
  497.     global radio:commandchan radio:commandmode
  498.     global radio:topicfile radio:topic radio:set:topic
  499.         if {${radio:commandmode} == "1"} { return 0 }
  500.     if {[llength $arg] == 0} {
  501.         puthelp "PRIVMSG ${radio:commandchan} :You did not set any topic, $nick!"
  502.         return 0
  503.     }
  504.         if {$chan == ${radio:commandchan}} {
  505.                 file delete ${radio:topicfile}
  506.                 set radio:openfile [open ${radio:topicfile} w]
  507.         close ${radio:openfile}
  508.                 set radio:openfile [open ${radio:topicfile} a+]
  509.         set radio:temptopic "set radio:topic \"$arg\""
  510.                 puts ${radio:openfile} ${radio:temptopic}
  511.                 close ${radio:openfile}
  512.         source ${radio:topicfile}
  513.                 putquick "PRIVMSG ${radio:commandchan} The topic has been changed to: ${radio:topic}."
  514.          }
  515. }
  516.  
  517. proc radio:msg:topic {nick host hand arg} {
  518.         global radio:chan radio:dj radio:name radio:stream radio:url
  519.     global radio:commandmode
  520.     global radio:topicfile radio:topic radio:set:topic
  521.         if {${radio:commandmode} == "2"} { return 0 }
  522.     if {[llength $arg] == 0} {
  523.         puthelp "NOTICE $nick :You did not set any topic, $nick!"
  524.         return 0
  525.     }
  526.     file delete ${radio:topicfile}
  527.     set radio:openfile [open ${radio:topicfile} w]
  528.     close ${radio:openfile}
  529.     set radio:openfile [open ${radio:topicfile} a+]
  530.     set radio:temptopic "set radio:topic \"$arg\""
  531.     puts ${radio:openfile} ${radio:temptopic}
  532.         close ${radio:openfile}
  533.     source ${radio:topicfile}
  534.         putquick "NOTICE $nick :The topic has been changed to: ${radio:topic}."
  535. }
  536.  
  537. proc radio:pub:inttopic {nick host hand chan arg} {
  538.     global radio:nextdj
  539.         global radio:commandchan radio:commandmode
  540.     global radio:inttopicfile radio:inttopic radio:set:inttopic
  541.         if {${radio:commandmode} == "1"} { return 0 }
  542.     if {${radio:set:inttopic} == "0"} { return 0 }
  543.         if {[llength $arg] == 0} {
  544.                 puthelp "PRIVMSG ${radio:commandchan} :You did not set any topic, $nick!"
  545.                 return 0
  546.         }
  547.         if {$chan == ${radio:commandchan}} {
  548.                 file delete ${radio:inttopicfile}
  549.                 set radio:openfile [open ${radio:inttopicfile} w]
  550.                 close ${radio:openfile}
  551.                 set radio:openfile [open ${radio:inttopicfile} a+]
  552.                 set radio:temptopic "set radio:inttopic \"$arg\""
  553.                 puts ${radio:openfile} ${radio:temptopic}
  554.                 close ${radio:openfile}
  555.                 source ${radio:inttopicfile}
  556.                 putquick "PRIVMSG ${radio:commandchan} :The topic for the internal chan has been changed to: ${radio:inttopic}."
  557.          }
  558. }
  559.  
  560. proc radio:pub:dotopic {nick host hand chan arg} {
  561.     global radio:chan
  562.     global radio:commandchan radio:commandmode
  563.     global radio:topicfile radio:topic radio:set:topic
  564.     global radio:inttopicfile radio:inttopic radio:set:inttopic
  565.     if {${radio:commandmode} == "1"} { return 0 }
  566.     if {${radio:set:inttopic} == "0"} { return 0 }
  567.     if {$chan == ${radio:commandchan}} {
  568.         if {${radio:set:topic} == "1"} {
  569.             source ${radio:topicfile}
  570.             putserv "TOPIC ${radio:chan} :${radio:topic}"
  571.             puthelp "PRIVMSG ${radio:commandchan} :Topic in \002${radio:chan}\002 set."
  572.         }
  573.         if {${radio:set:inttopic} == "1"} {
  574.             source ${radio:inttopicfile}
  575.             putserv "TOPIC ${radio:commandchan} :${radio:inttopic}"
  576.             puthelp "PRIVMSG ${radio:commandchan} :Topic in \002${radio:commandchan}\002 set."
  577.         }
  578.     }
  579. }
  580.  
  581. proc radio:net:wunsch {bot com arg} {
  582.     global radio:dj radio:wunsch
  583.     global radio:net:enable
  584.     set radio:remotenick [lindex $arg 0]
  585.     set radio:wunsch [join [lrange [split $arg " "] 1 end]]
  586.     if {${radio:net:enable} == "1"} {
  587.                 putquick "PRIVMSG ${radio:dj} :07Wish: ${radio:wunsch} by ${radio:remotenick}."
  588.     }
  589. }
  590.  
  591. proc radio:net:gruss {bot com arg} {
  592.     global radio:dj radio:gruss
  593.     global radio:net:enable
  594.     set radio:remotenick [lindex $arg 0]
  595.     set radio:gruss [join [lrange [split $arg " "] 1 end]]
  596.     if {${radio:net:enable} == "1"} {
  597.                 putquick "PRIVMSG ${radio:dj} :07Greet: ${radio:gruss} by ${radio:remotenick}."
  598.     }
  599. }
  600.  
  601. proc radio:net:sendstatus {bot com arg} {
  602.     global radio:off radio:dj radio:nextdj
  603.     global radio:net:enable
  604.     if {${radio:net:enable} == "1"} {
  605.         if {${radio:off}} {
  606.             putbot $bot "radio_status off"
  607.         } else {
  608.             putbot $bot "radio_status on"
  609.             putbot $bot "radio_dj ${radio:dj}"
  610.             putbot $bot "radio_nextdj ${radio:nextdj}"
  611.         }
  612.     }
  613. }
  614.  
  615. proc radio:net:offerstatus {botlinked via} {
  616.     global radio:off radio:dj radio:nextdj
  617.     global radio:net:enable
  618.     if {${radio:net:enable} == "1"} {
  619.         if {${radio:off}} {
  620.             putbot $botlinked "radio_status off"
  621.         } else {
  622.             putbot $botlinked "radio_status on"
  623.             putbot $botlinked "radio_dj ${radio:dj}"
  624.             putbot $botlinked "radio_nextdj ${radio:nextdj}"
  625.         }
  626.     }
  627. }
  628.  
  629. proc radio:net:topic {nick host hand chan arg} {
  630.     global radio:chan radio:dj radio:name radio:stream radio:url
  631.     global radio:commandchan radio:commandmode
  632.     global radio:net:bot radio:net:topic
  633.     if {${radio:commandmode} == "1"} { return 0 }
  634.     if {[llength $arg] == 0} {
  635.         puthelp "PRIVMSG ${radio:commandchan} :You did not set any topic, $nick!"
  636.         return 0
  637.     }
  638.     if {$chan == ${radio:commandchan}} {
  639.         set radio:net:bot [lindex $arg 0]
  640.         set radio:net:topic [join [lrange [split $arg " "] 1 end]]
  641.         putbot ${radio:net:bot} "radio_topic ${radio:net:topic}"
  642.         putquick "PRIVMSG ${radio:commandchan} :The topic has been changed to: ${radio:net:topic}."
  643.          }
  644. }
  645.  
  646.  
  647. # History:
  648. # Version 0.9: Internationalization.
  649. #
  650. # Version 0.8: Botnet-Mode added
  651. #
  652. # Version 0.74: Wenn jemand den DJ setzt und der gleich dem nextDJ ist, wird der nextDJ gelöscht. Bugfixes & Adds für Topic für ${radio:nextdj} in ${radio:commandchan}, .dotopic added.
  653. #
  654. # Version 0.73: Topicwechsel z.B. für Anzeige von ${radio:nextdj} für Intern-Channel, Re-Colourierung, bei ".dj" jetzt "... seiner/ihrer Musik ..." *g*
  655. #
  656. # Version 0.72: Bei Topic setzen jetzt erst Überprüfung, ob auch was nach ".topic" steht ...
  657. #
  658. # Version 0.71: Andere Befehle zum Löschen und neu Erstellen der ${radio:topicfile}
  659. #
  660. # Version 0.7: Bei !nextdj jetzt auch keine Rckmeldung wenn Radioscript aus ist oder kein ${radio:nextdj} gesetzt wurde, .topic added und automatische Žnderung des Topics bei DJ-Wechsel (THX to CyBex & thommey @ #tcl @ QuakeNet!)
  661. #
  662. # Version 0.62: !gruß & !gruss (wober !gruß richtige Rechtschreibung ist und !gruss wenn das System die Umlaute nicht nimmt ...)
  663. #
  664. # Version 0.61: .restart added
  665. #
  666. # Version 0.6: Put-Modi geändert.
  667. #
  668. # Version 0.5: Welcome Message ab nun optional
  669. #
  670. # Version 0.4: !info und .info hinzugefügt, !nextdj, .nextdj und nextdj hinzugefügt, .next und next hinzugefügt
  671. #
  672. # Version 0.3: Notices reduziert, Befehlschannel hinzugefügt
  673. #
  674. # Version 0.2: Welcome Message hinzugefügt
  675. #
  676. # Version 0.1: 1. Release für #radio4life
  677.  
  678. set radio:version "0.9"
  679. putlog "radio.tcl ${radio:version} (English) by hangy has been loaded."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement