|
Joined: Apr 2003
Posts: 300
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2003
Posts: 300 |
how do i make one? i need one to connect to an irc server, but there is a **** load of stuff u need to send in an on logon, i also need to like do commands with it to that irc server and send em back, some how, can anyone help me? i have not done sockets before
|
|
|
|
Joined: Jan 2003
Posts: 423
Fjord artisan
|
Fjord artisan
Joined: Jan 2003
Posts: 423 |
You can find a tutorial on writing socket bots here, an example socket bot here and a brand new framework for a socket bot here ! These should be more than enough to get you started!  PM
|
|
|
|
Joined: Apr 2003
Posts: 300
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2003
Posts: 300 |
ok all 3 of them dont connect, help?
|
|
|
|
Joined: Apr 2003
Posts: 300
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2003
Posts: 300 |
ok take this one cos i understand it more, i type /sbot -o irc.server.net, then after a while it does, Socket opened on sbot, then i do /sbot -w bleh anything, and it does nothing, help? also say i do a command with a socket bot, how is it returned? like say i do a whois on someone how do i see the return from it?
alias sbot {
if (!$isfile(sbot.ini)) {
writeini sbot.ini socket_bot nick sockbot
writeini sbot.ini socket_bot socket sbot
writeini sbot.ini socket_bot port 6667
}
if (-* iswm $1) {
if ($right($1,1) == c) {
run notepad.exe sbot.ini
halt
}
if ($right($1,1) == o) {
if (!$sock($sb(socket))) {
if ($2) {
sockopen $sb(socket) $2 $iif($3,$3,$sb(port))
halt
}
}
}
if ($right($1,1) == d) {
if ($sock($sb(socket))) {
sockclose $sb(socket)
halt
}
}
if ($right($1,1) == w) {
if ($sock($sb(socket))) {
if ($2-) {
sockwrite -n $sb(socket) $2-
}
}
}
}
}
on *:sockopen:$($sb(socket)):{
.signal sbot SOCK_OPENED $sockname
}
on *:sockclose:$($sb(socket)):{
.signal sbot SOCK_CLOSED $sockname
}
on *:sockwrite:$($sb(socket)):{
.signal sbot SOCK_WRITTEN $sockname
}
on *:sockread:$($sb(socket)):{
var %sr
sockread %sr
.signal sbot SOCK_READ $sockname %sr
}
on *:SIGNAL:sbot:{
if ($1 == SOCK_OPENED) {
echo -a Socket opened on $2
}
elseif ($1 == SOCK_CLOSED) {
echo -a Socket closed on $2
}
elseif ($1 == SOCK_WRITTEN) {
echo -a Wrote to socket $2
}
elseif ($1 == SOCK_READ) {
echo -a Read from socket $2 $+ : $3-
}
}
|
|
|
|
Joined: Sep 2003
Posts: 156
Vogon poet
|
Vogon poet
Joined: Sep 2003
Posts: 156 |
you can open a socket by using /sockopen command and you can use socket events for other stuff.. like;
sockopen mysocket irc.xxx.com 6667
on *:sockopen:mysocket:{
sockwrite -n mysocket USER username . . fullname
sockwrite -n mysocket nick socketsnick
}
on *:sockread:mysocket:{
sockread %mysocket
tokenize 32 %mysocket
if ($1 == PING) sockwrite -n mysocket PONG $2
}
for more help type: /help sockets
|
|
|
|
Joined: Jan 2003
Posts: 423
Fjord artisan
|
Fjord artisan
Joined: Jan 2003
Posts: 423 |
Mircscripts has more downtime than most - I've just checked all three links and they work... If you still can't get to them, open www.mircscripts.org and search for "socket bot" under "All" categories. PM
|
|
|
|
Joined: Apr 2003
Posts: 300
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2003
Posts: 300 |
no i meant the socket bots dont connect, on all 3 of em!
|
|
|
|
Joined: Jan 2003
Posts: 2,973
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,973 |
not as complete as I'd like it, but here is something that will connect to a server, and allows you to do different things with it. Also, i tried to replicate the "nromal" events like on JOIN, PART, TEXT, etc using a signal. See if it helps out any...
; -----------------------------------------------------------------------------
; /bot -s server [-p port] [-n nick] [-i ident] [-f full name]
alias bot {
var %p = 1, %argc = $0
if (%argc < 1) /echo -s * /bot: insufficient parameters
else {
/set %bot.server $server
/set %bot.port $port
/set %bot.nick $me $+ |BOT
/set %bot.ident $me
while ($gettok($1-, %p, 32) != $null) {
var %arg = $ifmatch
if (%arg == -f) {
/inc %p
while (-* !iswm $gettok($1-, %p, 32)) {
/set %bot.fullname %bot.fullname $gettok($1-, %p, 32)
/inc %p
}
/dec %p
}
else if (%arg == -i) {
/inc %p
/set %bot.ident $gettok($1-, %p, 32)
}
else if (%arg == -n) {
/inc %p
/set %bot.nick $gettok($1-, %p, 32)
}
else if (%arg == -p) {
/inc %p
/set %bot.port $gettok($1-, %p, 32)
}
else if (%arg == -s) {
/inc %p
/set %bot.server $gettok($1-, %p, 32)
}
/inc %p
}
if (!%bot.fullname) /set %bot.fullname $readini($mircini, mirc, user)
/bot_connect
}
}
; ctcp stuff (Not intergrated yet)
alias bot.ctcp {
if ($1 == VERSION) return mIRC $+(v,$version) Khaled Mardem-Bey
if ($1 == TIME) return $fulldate
if ($1 == PING) return PING $1
if ($1 == FINGER) return Put that finger away
}
alias bot_connect {
if ($sock(bot)) /sockclose bot
if ($window(@bot)) /clear @bot | else /window @bot
if ($window(@bot_chat)) /clear @bot_chat | else /window @bot_chat
/sockopen bot %bot.server %bot.port
}
alias bot_write {
if ($sock(bot)) {
/sockwrite -n bot $1-
.signal BOT WRITE $1-
if ($1 == NICK) /set %bot.nick $2
}
}
alias bot_disconnect {
if ($sock(bot)) {
/sock_write QUIT :SocketBot By KT
/sockclose bot
}
/unset %bot.*
if ($window(@bot)) /window -c @bot
if ($window(@bot_chat)) /window -c @bot_chan
}
; -----------------------------------------------------------------------------
on *:SOCKOPEN:bot: {
if ($sockerr) .signal BOT ERROR $sock(bot).wserr $sock(bot).wsmsg
else {
/sockwrite -n bot NICK %bot.nick
/sockwrite -n bot USER %bot.ident * * $+(:,%bot.fullname)
}
}
on *:SOCKREAD:bot: {
var %buffer
/sockread -f %buffer
.signal BOT %buffer
}
; -----------------------------------------------------------------------------
on *:SIGNAL:BOT: {
var %rawmsg = $1-
; --
; misc events
; --
; Error
if ($1 == ERROR) /echo -a Error while connecting to server: $2-
; Close event
else if ($1 == CLOSE) /echo @bot Bot Connection Closed
; ping
else if ($1 == PING) /bot_write PONG $right($2, -1)
; information written
else if ($1 == WRITE) /echo @bot <- $2-
; --
; Chatting
; --
; the normal mIRC "on" events
if ($1 == ON) {
; " on *:JOIN: "
if ($2 == JOIN) {
var %address = $3, %nick = $gettok($3, 1, $asc(!)), %chan = $4
}
; " on *:PART: "
else if ($2 == PART) {
var %address = $3, %nick = $gettok($3, 1, $asc(!)), %chan = $4
}
; " on *:KICK:#: "
else if ($2 == KICK) {
var %address = $3, %nick = $gettok($3, 1, $asc(!)), %chan = $4, %knick = $5
/tokenize 32 $6-
}
; " on *:TEXT:*:#: "
else if ($2 == CHANTEXT) {
var %address = $3, %nick = $gettok($3, 1, $asc(!)), %chan = $4
/tokenize 32 $5-
}
; " on *:TEXT:*:?: "
else if ($2 == QUERYTEXT) {
var %address = $3, %nick = $gettok($3, 1, $asc(!))
/tokenize 32 $4-
}
; " on *:ACTION:*:#: "
else if ($2 == CHANACTION) {
var %address = $3, %nick = $gettok($3, 1, $asc(!)), %chan = $4
/tokenize 32 $5-
}
; " on *:ACTION:*:?: "
else if ($2 == QUERYACTION) {
var %address = $3, %nick = $gettok($3, 1, $asc(!))
/tokenize 32 $4-
}
; " on *:NOTICE:*:*: "
; Take note, i didn't filter channel notices from private
else if ($2 == NOTICE) {
var %address = $3, %nick = $gettok($3, 1, $asc(!)), %target = $4
/tokenize 32 $5-
}
; "on *:RAWMODE:#: "
else if ($2 == RAWMODE) {
var %address = $3, %nick = $gettok($3, 1, $asc(!)), %chan = $4
/tokenize 32 $5-
}
}
; raw events
else if ($2 isnum 0-999) {
; make it like a "raw *:*: { }" event
var %numeric = $2
/tokenize 32 $3-
; don't touch these lines -- BEGIN
if (%numeric == 433) {
; this is the msg you get when you trying to connect with a bad
; name. the else .. is when you try to do /nick already on server.
if ($1 == %bot.nick) /sock_write NICK %bot.nick $+ $rand(1,999)
else /set %bot.nick $1
}
; don't touch these lines -- END
}
; --
; the below recalls the events above. It's more the "engine" of the bot. They call the above stuff.
; To make it easy on you, I made them all as similar to the actual events as possible. Use %nick
; instead of $nick, %chan for $chan, etc.
; --
; other messages
else {
if (:*!*@* iswm $1) {
var %nick = $right($gettok($1, 1, $asc(!)), -1), %address = $right($1, -1)
if ($2 == JOIN) .signal BOT ON JOIN %address $right($3, -1)
else if ($2 == KICK) .signal BOT ON KICK %address $3-4 $right($5-, -1)
else if ($2 == MODE) .signal BOT ON MODE %address $3-
else if ($2 == NOTICE) .signal BOT ON NOTICE %address $3 $right($4-, -1)
else if ($2 == PART) .signal BOT ON PART %address $3
else if ($2 == PRIVMSG) {
var %target = $3
/tokenize 32 $right($4-, -1)
if (#* iswm %target) {
if ($1 == $+($chr(1),ACTION)) .signal BOT ON CHANACTION %address %target $left($2-, -1)
else .signal BOT ON CHANTEXT %address %target $1-
}
else {
if ($1 == $+($chr(1),ACTION)) .signal BOT ON QUERYACTION %address %target $left($2-, -1)
else .signal BOT ON QUERYTEXT %address $1-
}
}
}
}
if ((WRITE * !iswm %rawmsg) && (ON * !iswm %rawmsg)) /echo @bot -> %rawmsg
}
; -----------------------------------------------------------------------------
menu channel {
Socket Bot
.$iif(!$sock(bot), Launch Connection): /bot $$?="Enter Settings: $crlf -s server [-p port] [-n nick] [-i ident] [-f full name]"
.$iif($sock(bot), Kill Connection): /bot_disconnect
.-
.$iif($sock(bot), Bot Stuff)
..Nickname: /bot_write NICK $$?="Enter New Name"
.$iif($sock(bot), Location)
..$iif(%bot.nick !ison $active, Join This Channel): /bot_write JOIN $active
..$iif(%bot.nick ison $active, Part This Channel): /bot_write PART $active
..-
..Join Channel ???: /bot_write JOIN $$?="Enter Channel Name"
..Part Channel ???: /bot_write PART $$?="Enter Channel Name"
.$iif($sock(bot), Messaging)
..Message Channel: /bot_write PRIVMSG $active $+(:,$$?="Enter Message")
}
menu nicklist {
Socket Bot
.$iif(!$sock(bot), Launch Connection): /bot $$?="Enter Settings: $crlf -s server [-p port] [-n nick] [-i ident] [-f full name]"
.$iif($sock(bot), Kill Connection): /bot_disconnect
.-
.$iif($sock(bot), User Control)
..$iif(%bot.nick isop $active && %bot.nick !isop $active, Op $$1): /bot_write MODE $active +o $1
..$iif(%bot.nick isop $active && %bot.nick isop $active, Deop $$1): /bot_write MODE $active -o $1
..$iif(%bot.nick isop $active && %bot.nick !ishop $active, Half-Op $$1): /bot_write MODE $active +h $1
..$iif(%bot.nick isop $active && %bot.nick ishop $active, Dehalf-op $$1): /bot_write MODE $active -h $1
..$iif(%bot.nick isop $active && %bot.nick !isvoice $active, Voice $$1): /bot_write MODE $active +v $1
..$iif(%bot.nick isop $active && %bot.nick isvoice $active, Devoice $$1): /bot_write MODE $active -v $1
..-
..$iif(%bot.nick isop $active, Kick $$1): /bot_write KICK $active $$1
..$iif(%bot.nick isop $active, Kick $$1 -Reason-): /bot_write KICK $active $$1 $+(:,$$?="Enter Reason")
..$iif(%bot.nick isop $active, Kick Ban $$1): /bot_write MODE $active +bb $$1 $address($$1, 11) | /bot_write KICK $active $$1
..$iif(%bot.nick isop $active, Kick Ban $$1 -Reason-): /bot_write MODE $active +bb $$1 $address($$1, 11) | /bot_write KICK $active $$1 $+(:,$$?="Enter Reason")
.$iif($sock(bot), Bot Stuff)
..Nickname: /bot_write NICK $$?="Enter New Name"
.$iif($sock(bot), Location)
..$iif(%bot.nick !ison $active, Join This Channel): /bot_write JOIN $active
..$iif(%bot.nick ison $active, Part This Channel): /bot_write PART $active
..-
..Join Channel ???: /bot_write JOIN $$?="Enter Channel Name"
..Part Channel ???: /bot_write PART $$?="Enter Channel Name"
.$iif($sock(bot), Messaging)
..Message Channel: /bot_write PRIVMSG $active $+(:,$$?="Enter Message")
..Message $$1: /bot_write PRIVMSG $$1 $+(:,$$?="Enter Message")
}
menu @bot {
Clear Window: /clear @bot
-
Location
.Join Channel ???: /bot_write JOIN $$?="Enter Channel Name"
.Part Channel ???: /bot_write PART $$?="Enter Channel Name"
-
Disconnect: /bot_disconnect
}
|
|
|
|
Joined: Apr 2003
Posts: 300
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2003
Posts: 300 |
oh no! -> ERROR 10060 [10060] Connection timed out help?  i get it all the time!
|
|
|
|
Joined: Apr 2003
Posts: 300
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2003
Posts: 300 |
btw im on a netword and need to use firewall settings, will it use the mirc ones or do i have to specify them?
|
|
|
|
|