1. Hey Guest, are you looking for a place to host your IRC related project? Then check out the Resource Manager on IRCForums! Click the resources tab above this notice!
  2. Hello Guest, are you new to IRCForums? Why not introduce yourself in the introduction forum!
  3. We have updated the layout of our forums. Please see this thread for more information.

Play File Script

Discussion in 'IRC Script Help' started by Nascimento, Apr 21, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Nascimento Sports Chat

    Member Since:
    Dec 20, 2011
    Message Count:
    305
    Likes Received:
    53
    Trophy Points:
    86
    hello

    All I need is rather simple play file script
    via public command you set the time and the file you want to be played in a channel, the bot will set +m before it plays it, and -m after it finishes to play it

    example here:

    <Me> !play 21:30 Script.txt #ChannelNameHere
    <Bot> I will play script.txt to #ChannelNameHere at 21:30

    * 21:30 *

    #ChannelNameHere:

    *** Bot sets mode +m
    <Bot> 1st line from Script.txt
    <Bot> 2nd line from Script.txt
    ....
    *** Bot sets mode -m
  2. Offline

    Trixar_za GigIRC

    Member Since:
    Dec 18, 2011
    Message Count:
    1,295
    Likes Received:
    182
    Trophy Points:
    178
    Er, I could write one like that in like 5 minutes for python. Although I don't like the time idea - Why not use a set-able timer? Like you can set it to run in 1h, 1d, etc. Not everybody is in the same timezone and the bot might not share the same timezone as your users either :p
  3. Offline

    Nascimento Sports Chat

    Member Since:
    Dec 20, 2011
    Message Count:
    305
    Likes Received:
    53
    Trophy Points:
    86
    Hey Trixar_za, well the whole point is that I can run the script at a certain (or ask it to run 3 hours from now) so it can work if I`m nowhere near the computer and can't run it when I`m around.. so if it uses a timer by its local time, or ask it to run in 3 hours from now - pretty much the same for me
  4. Offline

    Nascimento Sports Chat

    Member Since:
    Dec 20, 2011
    Message Count:
    305
    Likes Received:
    53
    Trophy Points:
    86
    Would appreciate if you script it Trixar...
  5. Offline

    Trixar_za GigIRC

    Member Since:
    Dec 18, 2011
    Message Count:
    1,295
    Likes Received:
    182
    Trophy Points:
    178
    Check out http://www.trixarian.net/downloads/playbot.tar.gz

    It's not very advanced and I threw it together in a like an hour. The filenames are case sensitive and must be in the files folder. Also it doesn't auto-identify the bot either. What it does do is play files to a channel :p

    The syntax is pretty simple:
    !play filename (time) (channel)

    Note that I made the time and channel optional. If you include time, it will play the file in the current channel after a set amount of time. If you include a channel name, it will play to that channel after the set amount of time.

    The time formatting is also as follows:
    s = second
    h = hour
    d = day
    w = week

    so 10s means the bot will play the file after 10 seconds and 1h means it will play it after 1 hours.

    I may make it more advanced by making the filename's case not matter and actually checking the variables before trying to play the file or start the timer :p
  6. Offline

    Nascimento Sports Chat

    Member Since:
    Dec 20, 2011
    Message Count:
    305
    Likes Received:
    53
    Trophy Points:
    86
    Hey Trixar_za,

    Thanks for the script.. A couple of questions though..

    It seems just to play the script? does not set +m and -m

    Also,

    [19:14:50] <@Nascimento> !play preview.txt 2s #Moderators
    [19:14:54] * @AndyGray (eggy@h1071157.serverkompetenz.net) Quit (Excess Flood)

    Doesn't really help when it Excess Flood after a couple of lines
  7. Offline

    Trixar_za GigIRC

    Member Since:
    Dec 18, 2011
    Message Count:
    1,295
    Likes Received:
    182
    Trophy Points:
    178
    Well, it puts out 5 lines a second (intentional limit - it can be altered). This might be a bit much for some anti-flooding scripts. Also, did you try op'ing the bot in the channel? It needs access to +m and -m to set it.

    Anyway, to make the output delay longer, just change line 16 in playbot.py from:
    Code (python):
                time.sleep(0.2)
    to something like:
    Code (python):
                time.sleep(0.5)
    to make it output only 2 lines a second or even:
    Code (python):
                time.sleep(1)
    to make it output a line a second

    Also use a proper text editor like notepad++ to edit it on Windows
  8. Offline

    Nascimento Sports Chat

    Member Since:
    Dec 20, 2011
    Message Count:
    305
    Likes Received:
    53
    Trophy Points:
    86
    Works great now, changed it to time.sleep(1). Where can I get python scripts? looking to add an auto identify script to Quakenet's services to that bot
  9. Offline

    Trixar_za GigIRC

    Member Since:
    Dec 18, 2011
    Message Count:
    1,295
    Likes Received:
    182
    Trophy Points:
    178
    Well, there is the Right way and then there is the Lazy way.
    I'll do it in the lazy way:
    Open ircbot.py and go to line 79 and change:
    Code (python):

        if msg[1] == "005":
            for x in CHANNELS:
     
    to:
    Code (python):

        if msg[1] == "005":
            msg("NickServ", "identify PasswordHere")
            for x in CHANNELS:
     
    Change PasswordHere to the right password and save. Now it should auto-identify when it connects.

    EDIT: Considering it's QuakeNet, you may want to change NickServ to the right services name too (I think it's X).
  10. Offline

    Nascimento Sports Chat

    Member Since:
    Dec 20, 2011
    Message Count:
    305
    Likes Received:
    53
    Trophy Points:
    86
    Yeah that won't work for Quakenet's services (Q), thats why I was asking where I can find some scripts.
  11. Offline

    Trixar_za GigIRC

    Member Since:
    Dec 18, 2011
    Message Count:
    1,295
    Likes Received:
    182
    Trophy Points:
    178
    maybe:
    Code (python):
            msg("Q@CServe.quakenet.org", "AUTH PasswordHere")
    I don't know Q or QuakeServ, but the identification method should be EXACTLY the same one you use when you try identifying.

    There is no real scripting help for this. I wrote this IRC framework and other examples might not be useful :p
  12. Offline

    Napa182 Moderator

    Member Since:
    Dec 18, 2011
    Message Count:
    222
    Likes Received:
    83
    Trophy Points:
    56
Thread Status:
Not open for further replies.

Share This Page