### ----------------------------------------------------
### -- API::Discord
### -- Licenses: BSD-3-Clause
### -- Authors: Alastair 'altreus' Douglas <altreus@altre.us>, Jonathan 'jnthn' Worthington <jnthn@jnthn.net>, Kane 'kawaii' Valentine <kane@cute.im>
### -- File: examples/sort-of-bot.raku
### ----------------------------------------------------
#!perl6

use API::Discord;

sub MAIN($token) {
    my $discord = API::Discord.new(:$token);

    await $discord.connect;

    react {
        whenever $discord.messages -> $message {
            if $message.addressed {
                my $c = $message.content;
                my Str $id = $discord.user.real-id;
                $c ~~ s/^ '<@' $id '>' \s+//;

                given $c {
                    when 'pin' {
                        await $message.pin;
                    }
                }
            }
        }
    }
}



