));
$heap->{connector} = POE::Component::IRC::Plugin::Connector->new(
- servers => [['irc.netgamers.org'], ['underworld.no.eu.netgamers.org']
- ,['firefly.no.eu.netgamers.org'], ['underworld.ca.us.netgamers.org'] ]
+ servers => [['chronos.fr.eu.netgamers.org'], ['underworld.no.eu.netgamers.org']]
);
$irc->plugin_add( 'Connector' => $heap->{connector} );
$irc->yield( register => 'all' );
- $irc->yield( connect => { server => 'irc.netgamers.org' } );
+ #$irc->yield( connect => { server => 'chronos.fr.eu.netgamers.org' } );
$kernel->delay( refresh => 60 );
'name' => $user,
'url' => 'https://nd.ruin.nu',
'version' => '1.0',
- 'callbacks' => {
- 'READY' => sub { $self->discord_ready(@_) },
- 'MESSAGE_CREATE' => sub { $self->discord_message_create(@_) },
- 'GUILD_CREATE' => sub { $self->discord_guild_create(@_) },
- 'CHANNEL_CREATE' => sub { $self->discord_channel_create(@_) },
- },
'reconnect' => 1,
'verbose' => 1,
+ 'logdir' => '/tmp',
));
+
+ $self->discord->gw->on('MESSAGE_CREATE' => sub { $self->discord_message_create(@_) });
+ $self->discord->gw->on('READY' => sub { $self->discord_ready(@_) });
+ $self->discord->gw->on('GUILD_CREATE' => sub { $self->discord_guild_create(@_) });
+ $self->discord->gw->on('CHANNEL_CREATE' => sub { $self->discord_channel_create(@_) });
+
$self->discord->init();
}
return;
}
sub discord_ready {
- my $self = shift;
- my $hash = shift;
+ my ($self, $gw, $hash) = @_;
+
$self->discord_id($hash->{user}{id});
$self->discord_name($hash->{user}{username});
}
sub discord_guild_create {
- my $self = shift;
- my $hash = shift;
+ my ($self, $gw, $hash) = @_;
for my $chan (@{$hash->{channels}}) {
say localtime(time) . " - $chan->{id} - $chan->{name}";
}
sub discord_channel_create {
- my $self = shift;
- my $chan = shift;
+ my ($self, $gw, $chan) = @_;
for my $key (keys %{$chan}) {
say localtime(time) . " - $key - $chan->{$key}";