SRL Archive - Senior News and General

IRC Dicing Bot


HyperSecret

2012-01-30 19:32:08

Hey guys,

I was wondering if there was anyone here that has ever made an IRC bot (-.-, I know many of you have).

I wanting to know if any of you could make me a simple IRC dicing bot for rs, one that simple just does what the old 100 percentile did. I will write all the code and stuff for wagers and parsing that sort of stuff.

I cba atm w/ classes and other life stuff to learn how to correctly get information from irc and that sort of stuff.

If anyone could help me out that would be great, a couple friends and I are thinking of starting a dicing clan. If you make this we would probably let you join at no cost.

Thanks to anyone who says yes :D

inb4noob :p

Gu3st...

2012-01-31 09:28:30

I made a bot in scar once, and I still have the (working) code for it, I can make it into simba code if you'd like?

E: Join #zybot on irc.rizon.net and type !DICE

Markus

2012-01-31 09:32:32

lol inb4 that guy who posted thread here about it. I'm blind

IRC client is easy, but no one knows how sockets really work in Simba. Just be sure to auth, respond to PING and then handle Privmsg. Look up the RFC, it's a simple protocol.

HyperSecret

2012-01-31 09:53:37

I honestly could care less about the language it is in. I am fine with C,C++,Java. Any other languages it could possibly be written in I would assume wouldn't be to hard for me to learn what I need.

Like I said, I just cba to learn the whole IRC communication stuff atm.

Gu3st...

2012-01-31 16:05:45

Here's the (old) code of mine:
type
TIRC = record
Masters : TStringArray;
Name : String;
Server : String;
Channel : String;
Port : Integer;
Chan : Integer;
end;

const
CRLF = #13#10;

var
IRC : TIRC;

procedure Declare;
begin
IRC.Name := 'ZyBot';
IRC.Server := 'irc.rizon.net';
IRC.Port := 6667;
IRC.Channel := '#srl';
IRC.Masters := ['Zyt3x'];
end;

function Connect : Integer;
var
P : Integer;
begin
Result := -1;
P := IRC.Port;
repeat
Result := OpenConnection(IRC.Server, P, 0);
if Result >= 0 then
Break
else
Inc(P);
until (P = 7000);
if Result < 0 then exit;
end;

procedure Setup;
begin
if SendConnectionData(IRC.Chan, 'USER ' + IRC.Name + ' * * :' + IRC.Name + CRLF) then
if SendConnectionData(IRC.Chan, 'NICK ' + IRC.Name + CRLF) then
if SendConnectionData(IRC.Chan, 'JOIN ' + IRC.Channel + CRLF) then
Exit;
WriteLn('Error connecting to server.');
TerminateScript;
end;

procedure Ping;
begin
SendConnectionData(IRC.Chan, 'PONG ' + IRC.Channel + CRLF);
end;

procedure Send(Txt : String);
begin
WriteLn('Trying to send "' + Txt + '"...');
if not SendConnectionData(IRC.Chan, 'PRIVMSG ' + IRC.Channel + ' :' + Txt + CRLF) then
WriteLn('Sending failed.');
end;

function AI_Respond(MSG : String) : String;
var
S, TheMsg : String;
begin
TheMsg := Replace(MSG, ' ', '+');
WriteLn(TheMsg);
S := Between('<B>splotchy ==> ', '</B>', GetPage('http://www.cooldictionary.com/splotchy.mpl?input=' + TheMsg + '&session_id=1239.1239&Submit=Submit'));
S := Replace(S, '&#'+'39;', '''');
Send(S);
end;

procedure HandleData(Str : String);
var
S : String;
begin
WriteLn(Str);
if Pos(LowerCase(Between(':', '!', Str)), LowerCase(Implode(', ', IRC.Masters))) <> 0 then
begin
S := LowerCase(Copy(Str, Pos('PRIVMSG ' + IRC.Channel + ' :', Str), Length(Str)));
case Between(':', ' ', S + ' ') of
'!quit': TerminateScript;
'!dice': Send(IntToStr(Random(100)) + CRLF);
'!zy': AI_Respond(Copy(S, Pos('!zy', S) + 3, Length(S)));
end;
end;
end;

var
T : Integer;
S : String;

begin
Declare;
if Connect < 0 then TerminateScript;
Setup;
Ping;
repeat
SendConnectionData(IRC.Chan, 'JOIN ' + IRC.Channel + CRLF);
T := GetSystemTime;
repeat
if not IsConnectionOpen(IRC.Chan) then TerminateScript;
ReadConnectionData(IRC.Chan, S);
if S <> '' then
HandleData(S);
until GetSystemTime - T > 10000;
Ping;
until False;
end.

Shitty standards and a lot of room for improvement, but it does the trick

The Simba version I can't get to stay online… I made it answer to PINGs and whatnot, but after 10s or so it dces, no matter what I do

n3ss3s

2012-01-31 20:47:13

Look up "java pircbot tutorial" (or example). pircbot is a Java IRC bot framework, just include the jar in your project -> override the onMessage method.

Btw, starting up a new dicing clan won't be easy, in P2P there's already Dragon Dyce, SM Dicing, First, Win All Day (sort of), and in F2P there are some clans aswell…

noidea

2012-01-31 21:03:20

From: n3ss3s
Look up "java pircbot tutorial" (or example). pircbot is a Java IRC bot framework, just include the jar in your project -> override the onMessage method.

Btw, (if that's what on your mind) starting up a new dicing clan won't be easy, in P2P there's already Dragon Dyce, SM Dicing, First, Win All Day (sort of), and in F2P there are some clans aswell…


my god. pircbot is such a waste. Use what Zytex made or I can help or even a couple others on the irc can.

HyperSecret

2012-02-01 00:27:07

From: n3ss3s
Look up "java pircbot tutorial" (or example). pircbot is a Java IRC bot framework, just include the jar in your project -> override the onMessage method.

Btw, starting up a new dicing clan won't be easy, in P2P there's already Dragon Dyce, SM Dicing, First, Win All Day (sort of), and in F2P there are some clans aswell…


I have a friend that has 2-3k subs on youtube that use to be a dicer, he has torva, pernix, virtus, divine, ely, arcane, spectral, blue phat and max cash atm.

He said he would be interested in starting his fc back up as a dicing clan.

n3ss3s

2012-02-01 15:31:22

Thing is, all the prime spots are taken, so he'd have to have it at varrock square or something…

weequ

2012-02-02 07:17:07

Your best bet would probably me making a friends chat spammer bot to advertise but that would also give some negative reputation to your clan. + I'm not sure if this works anymore or would it get you muted in minutes.

SKy Scripter

2012-02-02 12:10:44

I once made one in delphi, it had a client as well… pretty simple stuff.

n3ss3s

2012-02-02 15:21:31

Your best bet would probably me making a friends chat spammer bot to advertise but that would also give some negative reputation to your clan. + I'm not sure if this works anymore or would it get you muted in minutes.


Thing is, if they do that they'll literally get shit on unless they'll base themselves in the middle of nowhere… "First" planted a cannon or two in the wrong place and this went down for about 4 hours, while Dragon Dyce's business kept running normally,

http://www.youtube.com/watch?v=4N8U2ZEgFZA