]> ruin.nu Git - NDIRC.git/blobdiff - Bot.pm
Channels and discord tag
[NDIRC.git] / Bot.pm
diff --git a/Bot.pm b/Bot.pm
index 89ec47d7c1e75ae9d7c3cb397b07e0b92b6a2026..9bf39f9ae09c612b88bdca9100558b1a4f505955 100644 (file)
--- a/Bot.pm
+++ b/Bot.pm
@@ -61,6 +61,12 @@ has discord_id => (
        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 .. $#_];
@@ -329,6 +335,13 @@ sub discord_message_create {
 }
 
 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->{name};
+       }
 }
 
 sub parseCommand {