use Mojo::IOLoop;
use NDIRC::Dispatcher;
-use NDIRC::Context;
+use NDIRC::IrcContext;
use IO::File;
isa => 'Str'
);
+has discord_channels => (
+ is => 'rw',
+ isa => 'HashRef',
+ default => sub { {} }
+);
+
# We registered for all events, this will produce some debug info.
sub _default {
my ($event, $args) = @_[ARG0 .. $#_];
'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,
}
sub discord_guild_create {
+ my $self = shift;
+ my $hash = shift;
+
+ for my $chan (@{$hash->{channels}}) {
+ say localtime(time) . " - $chan->{id} - $chan->{name}";
+ $self->discord_channels->{$chan->{id}} = $chan;
+ }
+}
+
+sub discord_channel_create {
+ my $self = shift;
+ my $chan = shift;
+
+ for my $key (keys %{$chan}) {
+ say localtime(time) . " - $key - $chan->{$key}";
+ }
+ $self->discord_channels->{$chan->{id}} = $chan;
}
sub parseCommand {
}
$address =~ s/.*@(.*)/$1/;
- my $c = NDIRC::Context->new({
+ my $c = NDIRC::IrcContext->new({
host => $address,
nick => $nick,
channel => $channel,