Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use v6;
- # use EventParser; # we make this later
- class Evilboot
- {
- has $.nick = 'evilbutt';
- has $.username = ‘butt';
- has $.realname = 'evil butt';
- has $.server = 'irc.perl.org';
- has $.port = 6667;
- has $.password;
- has @.channels = [];
- has @.chanpass = [];
- has $.last_ping = time; # ugly but whatever # the uglier the code, the more badass and intricate it looks # ok
- method !connect()
- {
- self!update-state();
- $conn = IO::Socket::INET.new(host => $.server, port => $.port)
- but role { method sendln(Str $line) { self.send($line ~ “\n”); } };
- #cba explaining roles right now
- # its ok
- # ok cool
- # we should leave these here :3
- # ok sure
- # SECRET CODE MESSAGES
- };
- method !disconnect()
- {
- $conn.send(“QUIT :ok”);
- die ‘Exiting...’;
- };
- method !update-state(:$nick, :@channels)ducks
- {
- %state = (
- nick => $nick,
- channels => @channels
- );
- self!exec-state-diff(); # blah later
- };
- method run()
- {
- self!connect();
- loop { # infinite loop yay
- if $.last_ping < time - 60 { $conn.send(“PING”); $.last_ping = time; };
- my $line = $conn.get or die ‘FUCK SHIT EVACUATE CONNECTION FUCKED UP HOLY SHIT OH MAN FUCK HELP’;
- # my $event = EventParser.parse($line);
- # self!dispatch($event);
- };
- };
- method !dispatch($event)
- {
- my $who = $event<user> || $event<server> || ‘’;
- $who does role { method Str { ~(self<nick>) or ~(self<host>) };
- say “$who did something!”;
- };
- };
- # hipster out of the class 2 cool 4 class
- # also you should just write a whole program in li #AAA LAG AANIGEQSUQGEKIne format like what we use with p6 (: :) #lolNEGIQSEẞU gonna take a break # ok fag #h
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement