AnyEvent-Discord
view release on metacpan or search on metacpan
AnyEvent::Discord:
file: lib/AnyEvent/Discord.pm
version: '0.7'
AnyEvent::Discord::Payload:
file: lib/AnyEvent/Discord/Payload.pm
version: '0.7'
requires:
Algorithm::Backoff::Exponential: '0.009'
AnyEvent::WebSocket::Client: '0.54'
HTTP::Headers: '0'
HTTP::Request: '0'
JSON: '0'
LWP::UserAgent: '0'
Moops: '0.038'
Test::More: '0'
perl: '5.014'
resources:
bugtracker: https://github.com/nmelnick/anyevent-discord/issues
homepage: https://github.com/nmelnick/anyevent-discord
repository: https://github.com/nmelnick/anyevent-discord.git
version: '0.7'
Makefile.PL view on Meta::CPAN
"EXE_FILES" => [
"bin/pod2markdown.sh"
],
"LICENSE" => "perl",
"MIN_PERL_VERSION" => "5.014",
"NAME" => "AnyEvent::Discord",
"PREREQ_PM" => {
"Algorithm::Backoff::Exponential" => "0.009",
"AnyEvent::WebSocket::Client" => "0.54",
"HTTP::Headers" => 0,
"HTTP::Request" => 0,
"JSON" => 0,
"LWP::UserAgent" => 0,
"Moops" => "0.038",
"Test::More" => 0
},
"VERSION" => "0.7",
"test" => {
"TESTS" => "t/*.t"
}
);
my %FallbackPrereqs = (
"Algorithm::Backoff::Exponential" => "0.009",
"AnyEvent::WebSocket::Client" => "0.54",
"HTTP::Headers" => 0,
"HTTP::Request" => 0,
"JSON" => 0,
"LWP::UserAgent" => 0,
"Moops" => "0.038",
"Test::More" => 0
);
unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
delete $WriteMakefileArgs{TEST_REQUIRES};
delete $WriteMakefileArgs{BUILD_REQUIRES};
[MetaProvides::Class]
[GithubMeta]
issues = 1
user  = nmelnick
[Prereqs]
Algorithm::Backoff::Exponential = 0.009
AnyEvent::WebSocket::Client = 0.54
LWP::UserAgent = 0
HTTP::Request = 0
HTTP::Headers = 0
JSON = 0
Moops = 0.038
Test::More = 0
lib/AnyEvent/Discord.pm view on Meta::CPAN
use v5.14;
use Moops;
class AnyEvent::Discord 0.7 {
use Algorithm::Backoff::Exponential;
use AnyEvent::Discord::Payload;
use AnyEvent::WebSocket::Client;
use Data::Dumper;
use JSON qw(decode_json encode_json);
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Headers;
our $VERSION = '0.7';
has version => ( is => 'ro', isa => Str, default => $VERSION );
has token => ( is => 'rw', isa => Str, required => 1 );
has base_uri => ( is => 'rw', isa => Str, default => 'https://discordapp.com/api' );
has socket_options => ( is => 'rw', isa => HashRef, default => sub { { max_payload_size => 1024 * 1024 } } );
has verbose => ( is => 'rw', isa => Num, default => 0 );
has user_agent => ( is => 'rw', isa => Str, default => sub { 'Perl-AnyEventDiscord/' . shift->VERSION } );
lib/AnyEvent/Discord.pm view on Meta::CPAN
$self->_socket->close();
}
# Make an HTTP request to the Discord API
method _discord_api(Str $method, Str $path, $payload?) {
my $headers = HTTP::Headers->new(
Authorization => 'Bot ' . $self->token,
User_Agent => $self->user_agent,
Content_Type => 'application/json',
);
my $request = HTTP::Request->new(
uc($method),
join('/', $self->base_uri, $path),
$headers,
$payload,
);
$self->_trace('api req: ' . $request->as_string());
my $res = $self->_ua->request($request);
$self->_trace('api res: ' . $res->as_string());
if ($res->is_success()) {
if ($res->header('Content-Type') eq 'application/json') {
( run in 0.428 second using v1.01-cache-2.11-cpan-de7293f3b23 )