socketbot

By PuNkTuReD on Sep 10, 2008

work in progress
socketbot
load into remotes
set your bot options in any menu
click run

commands:

+commands - lists commands
+op -op - give or take ops
+hop -hop - give or take hops
+vop -vop - give or take vop
!seen
!addquote
!readquote <Quote #>

example
+commands
+op PuNkTuReD
-op PuNkTuReD
!seen PuNkTuReD
!addquote Hi guys how r ya all?
!readquote 1

has owner section and users section

users section is currently very basic storing names in a variable only

on *:load: {
  Echo -a W|ck3d^Bot Has Been Loaded Successfully.
  Echo -a Written by PuNkTuReD
}
;-----------------------------------------------------------------------------------------------------------------------------------------------------------------Menu
menu * {
  -
  † W|ck3d^Bot
  .Control Console:dialog $iif($dialog(Socket.Bot),-v,-dm) Socket.Bot Socket.Bot
  .-
  ;-----------------------------------------------------------------------------------------------------------------------------------------------------------------Sets Bots Users
  . Bots Users (Add via List):set %bot.users $$1 %bot.users | msg %bot.channel 4 $$1 7You now have4 USER 7level access to4 %bot.name $+ 4.
  . Bots Users (Add manually):set %bot.users $$?"Nick To Add" %bot.users | msg %bot.channel 4 $1 7You now have4 USER 7level access to4 %bot.name $+ 4.
  ;-----------------------------------------------------------------------------------------------------------------------------------------------------------------Echos the bots current stored info
  . Announce Bot Info:bot.announce.info
  . Protection
  .. $iif(%bot.spam.protect == ON,$style(1)) Spam Protect ON:set %bot.spam.protect ON 
  .. $iif(%bot.spam.protect == OFF,$style(1)) Spam Protect OFF:set %bot.spam.protect OFF 
  .-
  . Help:dialog $iif($dialog(socket.bot.help),-v,-dm)  socket.bot.help socket.bot.help
  -
}
;-----------------------------------------------------------------------------------------------------------------------------------------------------------------Main Dialog
dialog Socket.Bot {
  title "W|ck3d^BoT"
  size -1 -1 250 250
  option dbu
  text "Bot Owner", 1, 5 11 30 8
  edit "", 2, 40 10 50 10,autohs
  text "Bots Nick", 3, 5 24 30 8
  edit "", 4, 40 23 50 10,autohs
  text "Bots Ident", 5, 5 36 30 8
  edit "", 6, 40 35 50 10,autohs
  text "Bots Server", 7, 5 49 30 8
  edit "", 8, 40 48 50 10,autohs
  text "Bots Channel", 9, 5 61 35 8
  edit "", 10, 40 60 50 10,autohs
  button "Save Info" 11, 5 73 40 10
  button "Reset Info" 12, 50 73 40 10
  button "Run Bot" 13, 5 85 40 10
  button "Kill Bot" 14, 50 85 40 10
  list 15, 5 100 240 145, size, vsbar, hsbar
  text "Target:", 16, 100 11 30 8
  edit "", 17, 130 10 60 10,autohs 
  text "Message:", 18, 100 24 30 8
  edit "", 19, 130 23 115 10,autohs 
  button "Send", 20, 195 10 50 10

  button "Join", 21, 130 36 50 10
  button "Part", 22, 195 36 50 10

  text "Nick:", 23, 100 50 30 8
  edit "", 24, 130 49 60 10,autohs 
  button "Change", 25, 195 49 50 10

  menu "Txt Files" 100
  item "Seen File" 101, 100
  item "Quotes File" 102, 100
}
on *:dialog:Socket.Bot:*:*: {
  var %a = $dname, %b = $devent, %c = $did
  if (%b == init) { did -z %a 15 1000 1000 | var %d = did -ra Socket.Bot | %d 2 %bot.owner | %d 4 %bot.name | %d 6 %bot.ident | %d 8 %bots.server | %d 10 %bot.channel | %d 17 %bot.channel }
  if (%b == edit) { 
    if (%c == 2) { did -t %a 11 }
    if (%c == 4) { did -t %a 11 }
    if (%c == 6) { did -t %a 11 }
    if (%c == 8) { did -t %a 11 }
    if (%c == 10) { did -t %a 11 }
    if (%c == 17) { did -t %a 20 }
    if (%c == 19) { did -t %a 20 }
    if (%c == 24) { did -t %a 25 }
  }
  if (%b == sclick) {
    if (%c == 11) { write.main.conf }
    if (%c == 12) { clear.main.conf | var %d = did -ra Socket.Bot | %d 2,4,6,8,10 Field Required | %d 17 }
    if (%c == 20) { did -a %a 15 %bot.name PRIVMSG $did(Socket.Bot,17) $did(Socket.Bot,19) | sockwrite -nt %bot.name PRIVMSG $did(Socket.Bot,17) $did(Socket.Bot,19) | did -r %a 19 | did -c Socket.Bot 15 $did(Socket.Bot,15).lines | did -z Socket.Bot 15 }
    if (%c == 13) { did -ra %a 15 %bot.name Online. | run.bot }
    if (%c == 14) { kill.bot | did -a %a 15 Killing %bot.name $+ . | .timer 1 1 did -ra %a 15 %bot.name Offline. }
    if (%c == 21) { sockwrite -nt %bot.name JOIN $did(Socket.Bot,17) }
    if (%c == 22) { sockwrite -nt %bot.name PART $did(Socket.Bot,17) }
    if (%c == 25) { sockwrite -nt %bot.name NICK $did(Socket.Bot,24) }
  }
  if (%b == menu) {
    if (%c == 101) { run $mircdirlastseen.txt }
    if (%c == 102) { run $mircdirquotes.txt }
  }
}
;-----------------------------------------------------------------------------------------------------------------------------------------------------------------Aliases
alias run.bot { sockopen %bot.name %bots.server 6668 }
alias kill.bot { sockclose %bot.name }
alias clear.main.conf { var %d = unset | %d %bot.owner | %d %bot.name | %d %bot.ident | %d  %bots.server | %d  %bot.channel | did -ra Socket.Bot 15 W|ck3d^BoT Reset To Factory Settings. | did -t Socket.Bot 2 }
alias write.main.conf { var %d = set | %d %bot.owner $did(Socket.Bot,2) | %d %bot.name $did(Socket.Bot,4) | %d %bot.ident $did(Socket.Bot,6) | %d  %bots.server $did(Socket.Bot,8) | %d  %bot.channel $did(Socket.Bot,10) | did -ra Socket.Bot 15 W|ck3d^BoT Has Been Re-Configured. | did -t Socket.Bot 13 }
;-----------------------------------------------------------------------------------------------------------------------------------------------------------------Lists Bot Current Stored Info
alias bot.announce.info {
  var %a = sockwrite -nt %bot.name PRIVMSG %bot.channel
  %a 4W|ck3d^FuRy SocketBot Info:
  %a 4*****************************
  %a 4Owner:7 %bot.owner
  %a 4Users:7 %bot.users
  %a 4Bots Nick:7 %bot.name
  %a 4Bots Email:7 %bot.ident
  %a 4Bots Server:7 %bots.server
  %a 4Bots Channel:7 %bot.channel
  %a 4Most users chatting:7 %bot.channel.most.users
  %a 4*****************************
  %a 4Spam Protect:7 %bot.spam.protect
  %a 4*****************************
}
;-----------------------------------------------------------------------------------------------------------------------------------------------------------------Notice Owner Commands
alias bot.list.commands.owner {
  var %a = sockwrite -nt %bot.name NOTICE %respond.nick
  %a 4Available Commands For Bot Owner
  %a 7+op 4and 7-op 4- 7syntax4:7 +op PuNkTuReD
  %a 7+hop 4and 7-hop 4- 7syntax4:7 +hop PuNkTuReD
  %a 7+vop 4and 7-vop 4- 7syntax4:7 +vop PuNkTuReD
}
;-----------------------------------------------------------------------------------------------------------------------------------------------------------------Notice Users Commands
alias bot.list.commands.users {
  var %a = sockwrite -nt %bot.name NOTICE %respond.nick
  %a 4Available Commands For Bot Users
  %a 7+vop 4and 7-vop 4- 7syntax4:7 +vop PuNkTuReD
  %a 7!seen 4- 7syntax4:7 !seen PuNkTuReD
  %a 7!addquote 4- 7syntax4:7 !addquote (PuNkTuReD) hi guys hope your all doing well.
  %a 7!readquote 4- 7syntax4:7 !readquote 2
  %a 7!countquote 4- 7syntax4:7 !countquote 
}
;-----------------------------------------------------------------------------------------------------------------------------------------------------------------Sock Open
on *:sockopen:%bot.name: {
  ;-----------------------------------------------------------------------------------------------------------------------------------------------------------------Error Check
  if ($sockerr) { did -i Socket.Bot 15 1 Error - $sockname - $sockerr | return }
  else { 
    var %a = sockwrite -nt %bot.name
    ;-----------------------------------------------------------------------------------------------------------------------------------------------------------------Nick to use
    sockwrite -n $sockname user %bot.ident %bot.name %bot.ident %bot.name
    sockwrite -n $sockname nick %bot.name
    ;-----------------------------------------------------------------------------------------------------------------------------------------------------------------Channel to join
    %a JOIN $($+(%,bot.channel),2)
  }
}
;-----------------------------------------------------------------------------------------------------------------------------------------------------------------Sock Read
on *:sockread:%bot.name: {
  sockread %bot.data
  set %respond.nick $mid($gettok($gettok(%bot.data,1,32),1,33),2-)
  ; did -a Socket.Bot 15 %respond.nick $strip($gettok(%bot.data,2-,32))
  ; did -c Socket.Bot 15 $did(Socket.Bot,15).lines
  ; did -z Socket.Bot 15 
  ;-----------------------------------------------------------------------------------------------------------------------------------------------------------------Error Check
  if ($sockerr) { did -a Socket.Bot 15 Error - $sockname - $sock($sockname).wsmsg | return }
  ;-----------------------------------------------------------------------------------------------------------------------------------------------------------------PING/PONG Section
  if (PING isin %bot.data) { sockwrite -nt $sockname PONG $($+(%,bots.server),2) $2- | .halt }
  ;-----------------------------------------------------------------------------------------------------------------------------------------------------------------JOIN section
  if (JOIN : $+ %bot.channel isin %bot.data) { 
    did -a Socket.Bot 15 %respond.nick $strip($gettok(%bot.data,2-,32))
    did -c Socket.Bot 15 $did(Socket.Bot,15).lines
    did -z Socket.Bot 15 
    if (%respond.nick == %bot.name) { sockwrite -nt $sockname PRIVMSG %bot.channel Ahhh it's good to be home. | .halt }
    if (%respond.nick isin %bot.users) { sockwrite -nt $sockname PRIVMSG %bot.channel 7Welcome to4 %bot.channel %respond.nick | sockwrite -nt $sockname PRIVMSG %bot.channel 7For a list of available commands type4:7 +commands }
    if (%bot.channel.most.users == $null) || ($nick(%bot.channel,0) > %bot.channel.most.users) { set %bot.channel.most.users $nick(%bot.channel,0) | sockwrite -nt $sockname PRIVMSG %bot.channel 4[7NEW RECORD4] %bot.channel 7most users to chat on4 %bot.channel 7is now set to4 %bot.channel.most.users $+ 7. On4 $fulldate $+ 7. }
  }
  ;-----------------------------------------------------------------------------------------------------------------------------------------------------------------PART/QUIT section
  if (PART %bot.channel isin %bot.data) { 
    did -a Socket.Bot 15 %respond.nick $strip($gettok(%bot.data,2-,32))
    did -c Socket.Bot 15 $did(Socket.Bot,15).lines
    did -z Socket.Bot 15 
    write -ds $+ %respond.nick lastseen.txt 
    write lastseen.txt %respond.nick last seen parting from %bot.channel - $fulldate 
  }
  if (QUIT :Quit: isin %bot.data) { 
    did -a Socket.Bot 15 %respond.nick $strip($gettok(%bot.data,2-,32))
    did -c Socket.Bot 15 $did(Socket.Bot,15).lines
    did -z Socket.Bot 15 
    write -ds $+ %respond.nick lastseen.txt 
    write lastseen.txt %respond.nick last seen quiting from %bot.channel - $fulldate 
  }
  ;-----------------------------------------------------------------------------------------------------------------------------------------------------------------PRIVMSG Section
  if (PRIVMSG isin %bot.data) {
    did -a Socket.Bot 15 %respond.nick $strip($gettok(%bot.data,2-,32))
    did -c Socket.Bot 15 $did(Socket.Bot,15).lines
    did -z Socket.Bot 15 
    ;-----------------------------------------------------------------------------------------------------------------------------------------------------------------Spam Protect
    if ((http://) || (https://) || (www.) || (.net) || (.com isin $strip($gettok(%bot.data,4-,32))) && (%bot.spam.protect == ON)) { 
      if ($($+(%,%respond.nick,spam),2) == $null) {
        sockwrite -nt $sockname PRIVMSG %bot.channel 4[7WARNING4][7 $+ %respond.nick $+ 4]7 Spamming is not tolerated in this channel4.  
        set -u300 % $+ $($+(%,respond.nick),2) $+ spam 1
        .halt
      }
      if ($($+(%,%respond.nick,spam),2) == 1) {
        sockwrite -nt $sockname PRIVMSG %bot.channel 4[7WARNING4][7 $+ %respond.nick $+ 4]7 You have been warned about spamming in this channel4.7 Once more and you will be removed4.  
        set -u300 % $+ $($+(%,respond.nick),2) $+ spam 2
        .halt
      }
      if ($($+(%,%respond.nick,spam),2) == 2) {
        sockwrite -nt $sockname PRIVMSG %bot.channel 4[7WARNING4][7 $+ %respond.nick $+ 4]7 You have had your warnings for spamming4,7 You will now be removed from the channel4.  
        sockwrite -nt $sockname KICK %bot.channel %respond.nick
        unset % $+ $($+(%,respond.nick),2) $+ spam 
        .halt
      }
    }
    ;-----------------------------------------------------------------------------------------------------------------------------------------------------------------Users Section
    if (hello %bot.name isin $gettok(%bot.data,4-,32)) && (%respond.nick isin %bot.users) { sockwrite -nt $sockname PRIVMSG %bot.channel Hello %respond.nick | .halt }
    ;-----------------------------------------------------------------------------------------------------------------------------------------------------------------Users Commands
    if (+vop isin $gettok(%bot.data,4,32)) && (%respond.nick isin %bot.users) { sockwrite -nt $sockname MODE %bot.channel +v $gettok(%bot.data,5,32) | .halt }
    if (-vop isin $gettok(%bot.data,4,32)) && (%respond.nick isin %bot.users) { sockwrite -nt $sockname MODE %bot.channel -v $gettok(%bot.data,5,32) | .halt }
    if (!seen isin $strip($gettok(%bot.data,4,32))) { 
      if ($read(lastseen.txt, s, $strip($gettok(%bot.data,5-,32))) == $null) {  
        sockwrite -nt $sockname PRIVMSG %bot.channel Currently no Seen info stored for $strip($gettok(%bot.data,5-,32)) $+ .
      }
      else {
        set %last.seen $read(lastseen.txt, s, $strip($gettok(%bot.data,5-,32)))
        sockwrite -nt $sockname PRIVMSG %bot.channel $strip($gettok(%bot.data,5-,32)) Was %last.seen 
      }
    }
    if (!addquote isin $strip($gettok(%bot.data,4,32))) { 
      write quotes.txt %respond.nick : $asctime(dddd) $ord( $+ $asctime(dd) $+ ) Of $asctime(mmmm) $+ , $asctime(hh:nn:tt)  $asctime(yyyy) : Quote Stored : $strip($gettok(%bot.data,5-,32))
      sockwrite -nt $sockname PRIVMSG %bot.channel Added quote  $lines(quotes.txt) successfully.
    }
    if (!readquote isin $strip($gettok(%bot.data,4,32))) { 
      if ($strip($gettok(%bot.data,5,32)) > $lines(quotes.txt)) { 
        sockwrite -nt $sockname PRIVMSG %bot.channel Sorry we only have $lines(quotes.txt) Quotes.
      }
      else {
        sockwrite -nt $sockname PRIVMSG %bot.channel Quote: $strip($gettok(%bot.data,5,32)) : $read(quotes.txt, $strip($gettok(%bot.data,5,32)))
      }
    }
    if (!countquote isin $strip($gettok(%bot.data,4,32))) { 
      sockwrite -nt $sockname PRIVMSG %bot.channel Total Quotes: $lines(quotes.txt)
    }
    if (+commands isin $gettok(%bot.data,4,32)) && (%respond.nick isin %bot.users) { bot.list.commands.users }
    ;-----------------------------------------------------------------------------------------------------------------------------------------------------------------Owners Section
    ;-----------------------------------------------------------------------------------------------------------------------------------------------------------------Owners Commands
    if (+op isin $gettok(%bot.data,4,32)) && (%respond.nick == %bot.owner) { sockwrite -nt $sockname MODE %bot.channel +o $gettok(%bot.data,5,32) | .halt }
    if (-op isin $gettok(%bot.data,4,32)) && (%respond.nick == %bot.owner) { sockwrite -nt $sockname MODE %bot.channel -o $gettok(%bot.data,5,32) | .halt }
    if (+hop isin $gettok(%bot.data,4,32)) && (%respond.nick == %bot.owner) { sockwrite -nt $sockname MODE %bot.channel +h $gettok(%bot.data,5,32) | .halt }
    if (-hop isin $gettok(%bot.data,4,32)) && (%respond.nick == %bot.owner) { sockwrite -nt $sockname MODE %bot.channel -h $gettok(%bot.data,5,32) | .halt }
    if (+vop isin $gettok(%bot.data,4,32)) && (%respond.nick == %bot.owner) { sockwrite -nt $sockname MODE %bot.channel +v $gettok(%bot.data,5,32) | .halt }
    if (-vop isin $gettok(%bot.data,4,32)) && (%respond.nick == %bot.owner) { sockwrite -nt $sockname MODE %bot.channel -v $gettok(%bot.data,5,32) | .halt }
    if (+commands isin $gettok(%bot.data,4,32)) && (%respond.nick == %bot.owner) { bot.list.commands.owner | .halt }
    ;-----------------------------------------------------------------------------------------------------------------------------------------------------------------Everything else gets echoed into your status screen
    ;else { did -a Socket.Bot 15 %bot.data }
  }
}
alias bt {
  //sockwrite -nt %bot.name PRIVMSG $1 $2-
}
alias bj { 
  //sockwrite -nt %bot.name JOIN $1-
}
alias bp {
  //sockwrite -nt %bot.name PART $1-
}
alias bn {
  //sockwrite -nt %bot.name NICK $1-
}
dialog socket.bot.help {
  title "((o- Help -o))"
  size -1 -1 200 200
  option dbu
  list 1, 5 5 190 190, size, hsbar
}
on *:dialog:socket.bot.help:init:*: {
  var %a = did -a socket.bot.help 1
  %a ************************************************
  %a Welcome to W|ck3d^Bot
  %a Made by: PuNkTuReD 
  %a ************************************************
  %a //bt ($chan) Msg-Here
  %a sends msg to channel
  %a ***********************************
  %a //bj ($chan)
  %a joins channel
  %a ***********************************
  %a //bp ($chan)
  %a parts channel
  %a ***********************************
  %a //bn ($nick)
  %a changes the bots nick
  %a ***********************************
  %a !seen ($nick)
  %a returns last quit or part time of said nick
  %a ***********************************
  %a !addquote (Quote to add)
  %a Adds the quote to a txt file
  %a ***********************************
  %a !readquote (Quote to read)
  %a Reads the quote from the quotes txt file
  %a ***********************************
}
;---------------------------------------------------------------------------------------------------------

Comments

Sign in to comment.
PuNkTuReD   -  Sep 11, 2008

lmao no problem,
and didnt update properly b4 so have now :)

 Respond  
napa182   -  Sep 11, 2008

hey PunkTuReD that person mircse is nothing but a comment spammer pay them no mind

 Respond  
PuNkTuReD   -  Sep 11, 2008

no problem any suggestions?

 Respond  
PuNkTuReD   -  Sep 10, 2008

sorry yes your right mountaindew i just didnt get the time to get back here.
cheers.
fixed.

 Respond  
guest598594   -  Sep 10, 2008
alias bot.list.commands.owner {
  sockwrite -nt $sockname NOTICE %respond.nick 4Available Commands For Bot Owner
  sockwrite -nt $sockname NOTICE %respond.nick 7+op 4and 7-op 4- 7syntax4:7 +op PuNkTuReD
  sockwrite -nt $sockname NOTICE %respond.nick 7+hop 4and 7-hop 4- 7syntax4:7 +hop PuNkTuReD
  sockwrite -nt $sockname NOTICE %respond.nick 7+vop 4and 7-vop 4- 7syntax4:7 +vop PuNkTuReD
}
;------------------------------------------------------------------------Notice Users Commands
alias bot.list.commands.users {
  sockwrite -nt $sockname NOTICE %respond.nick 4Available Commands For Bot Users
  sockwrite -nt $sockname NOTICE %respond.nick 7+vop 4and 7-vop 4- 7syntax4:7 +vop PuNkTuReD
  sockwrite -nt $sockname NOTICE %respond.nick 7!seen 4- 7syntax4:7 !seen PuNkTuReD
}

Wouldn't $sockname be $null in those aliases?

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.