Added a module to get information on packages in AUR.
This commit is contained in:
1 parent
e2d26e3982
commit
344ce60f00
3 files changed
+116
-1
No files matched your search
@@ -7,6 +7,7 @@ Auto IRC Bot 3.0: Change Log
|
||||
|
||||
3.0 Alpha 7
|
||||
===============================================================================
|
||||
* Added an AUR module.
|
||||
* Fixed a bug in UNO where rehashing during a game caused a crash.
|
||||
* Proto::IRC::umodes renamed to Proto::IRC::botinfo{svr}{modes}.
|
||||
* Fixed a bug where incoming PART's from ourselves were not parsed.
|
||||
|
||||
+1
-1
@@ -123,7 +123,7 @@ sub installmods
|
||||
chomp $response;
|
||||
if (lc $response eq 'y') {
|
||||
println 'What modules would you like to install? (separate by commas)';
|
||||
println 'Available modules: Badwords, Bitly, BotStats, Calc, ChanTopics, Dictionary, EightBall, Eval, FML, Greet, HelloChan, IsItUp, LinkTitle, Oper, QDB, SASLAuth, UNO, Weather';
|
||||
println 'Available modules: AUR, Badwords, Bitly, BotStats, Calc, ChanTopics, Dictionary, EightBall, Eval, FML, Greet, HelloChan, IsItUp, LinkTitle, Oper, QDB, SASLAuth, UNO, Weather';
|
||||
print '> ';
|
||||
my $modules = <STDIN>; chomp $modules;
|
||||
$modules =~ s/ //g;
|
||||
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
# Module: AUR. See below for documentation.
|
||||
# Copyright (C) 2010-2011 Xelhua Development Group, et al.
|
||||
# This program is free software; rights to this code are stated in doc/LICENSE.
|
||||
package M::AUR;
|
||||
use strict;
|
||||
use warnings;
|
||||
use WWW::AUR;
|
||||
use API::Std qw(cmd_add cmd_del trans);
|
||||
use API::IRC qw(notice privmsg);
|
||||
|
||||
# Initialization subroutine.
|
||||
sub _init
|
||||
{
|
||||
# Create the AUR command.
|
||||
cmd_add('AUR', 0, 0, \%M::AUR::HELP_AUR, \&M::AUR::cmd_aur) or return;
|
||||
# Success.
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Void subroutine.
|
||||
sub _void
|
||||
{
|
||||
# Delete the AUR command.
|
||||
cmd_del('AUR') or return;
|
||||
|
||||
# Success.
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
# Help hash for AUR. Spanish, French and German translations needed.
|
||||
our %HELP_AUR = (
|
||||
'en' => "This command allows you to lookup a module in the Arch Linux AUR. \002Syntax:\002 AUR <module>",
|
||||
);
|
||||
|
||||
# Callback for AUR command.
|
||||
sub cmd_aur
|
||||
{
|
||||
my ($src, ($mod)) = @_;
|
||||
|
||||
# Check for needed parameters.
|
||||
if (!defined $mod) {
|
||||
notice($src->{svr}, $src->{nick}, trans('Not enough parameters').q{.});
|
||||
return;
|
||||
}
|
||||
|
||||
# Create an instance of WWW::AUR.
|
||||
my $aur = WWW::AUR->new;
|
||||
# Create an instance of WWW::AUR::Package.
|
||||
my $pkg = $aur->find($mod);
|
||||
|
||||
# Check if there was a result.
|
||||
if (defined $pkg) {
|
||||
# Return the results.
|
||||
privmsg($src->{svr}, $src->{chan}, "Results for \2$mod\2:");
|
||||
privmsg($src->{svr}, $src->{chan}, "ID: ".$pkg->id." Name: ".$pkg->name." Version: ".$pkg->version);
|
||||
my $man = $pkg->maintainer;
|
||||
privmsg($src->{svr}, $src->{chan}, "Maintainer: ".$man->name);
|
||||
privmsg($src->{svr}, $src->{chan}, "URL: https://aur.archlinux.org/packages.php?ID=".$pkg->id);
|
||||
}
|
||||
else {
|
||||
# Else return no results.
|
||||
privmsg($src->{svr}, $src->{chan}, "No results for \2$mod\2.");
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('AUR', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
# build: cpan=WWW::AUR perl=5.010000
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
AUR - AUR package information module.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
1.00
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
<JohnSmith> !aur google-chrome
|
||||
<Auto> Results for google-chrome:
|
||||
<Auto> ID: 37469 Name: google-chrome Version: 10.0.648.133-1
|
||||
<Auto> Maintainer: t3ddy
|
||||
<Auto> URL: https://aur.archlinux.org/packages.php?ID=37469
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This module adds a command to allow getting information on a package
|
||||
in AUR.
|
||||
|
||||
=head1 INSTALL
|
||||
|
||||
Before using this module, you will need to get WWW::AUR from cpan.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
This module was written by Matthew Barksdale.
|
||||
|
||||
This module is maintained by Xelhua Development Group.
|
||||
|
||||
=head1 LICENSE AND COPYRIGHT
|
||||
|
||||
This module is Copyright 2010-2011 Xelhua Development Group.
|
||||
|
||||
Released under the same licensing terms as Auto itself.
|
||||
|
||||
=cut
|
||||
|
||||
# vim: set ai et sw=4 ts=4:
|
||||
Reference in new issue
Block a user