- Portals
- The Current Year
- ED in the News
- Admins
- Help ED Rebuild
- Archive
- ED Bookmarklet
- Donate Bitcoin
Contact an admin on Discord or EDF if you want an account. Also fuck bots.
User:Meepsheep/ED FOR IRSSI.pl
Jump to navigation
Jump to search
THIS THIS DOES RIGHT NOW
- kittens
- sammich
- upload
- you can give any given template to any user
- mass rollback
#!/usr/bin/perl #lol use strict; use warnings; use Irssi; use vars qw($VERSION %IRSSI); use MediaWiki::API; use LWP::Simple; print CRAP "\00313NOTE THAT /rollback WORKS IN INCREMENTS OF 10 - IE 1 = 10, 2 = 20, ETC"; # /!\ SETTINGS /!\ # ACCOUNT IS YOUR ACCOUNT NAME # PASS IS YOUR PASSWORD DUMBASS my $url = 'https://encyclopediadramatica.se'; my $account = 'Meepsheep'; my $pass = 'LOL NO'; my $mw = MediaWiki::API->new(); $mw->{config}->{api_url} = "$url/api.php"; $mw->login( { lgname => $account, lgpassword => $pass } ); $mw->{config}->{upload_url} = "$url/Special:Upload"; $VERSION = "2"; %IRSSI = ( authors => 'Meepsheep', name => 'ED_FOR_IRSSI.pl', contact => '[email protected]', url => 'https://encyclopediadramatica.se/User:Meepsheep/ED_FOR_IRSSI.pl', description => 'ED toolz 4 irssi', license => 'BPL' ); sub sammich { my ($data,$server,$witem) = @_; my $user = shift; print CRAP "\00313Giving sammich to ".$user."..."; my $ref = $mw->get_page( { title => 'User talk:'.$user } ); $mw->edit( { action => 'edit', title => 'User talk:'.$user, nocreate => 1, text => $ref->{'*'} . "\n==A sammich for you==\n[[File:Dancing sandwich.gif]]\n~~~~", } ); print CRAP "\00313sammich given!"; } sub kittens { my ($data,$server,$witem) = @_; my $user = shift; print CRAP "\00313Kittensing ".$user."..."; $mw->edit( { action =>'edit', title => "User:".$user, text => "{{kittens}}", } ); print CRAP "\00313lol owned"; } sub upload { my ($data,$server,$witem) = @_; my ($url, $image) = split(/ /, shift); getstore($url, $image); open FILE, $image; binmode FILE; my ($buffer, $data2); while ( read(FILE, $buffer, 65536) ) { $data2 .= $buffer; } close(FILE); $mw->upload( { title => $image, data => $data2, ignorewarnings => 1 } ); unlink($image); print CRAP "\00313uploaded ".$image."!"; } sub template { my ($data,$server,$witem) = @_; my ($user, $template) = split(/-/, shift); $user =~ s/\s+$//; print CRAP "\00313Giving template".$template." to ".$user."..."; my $ref = $mw->get_page( { title => 'User talk:'.$user } ); $mw->edit( { action =>'edit', title => "User talk:".$user, nocreate => 1, text => $ref->{'*'} . "\n".$template."\n~~~~", } ); print CRAP "\00313".$template." given!"; } sub rollback { my ($data,$server,$witem) = @_; our ($null, $user, $amount) = split(/-/, shift); $user =~ s/\s+$//; my $pages = $mw->list ( { action => 'query', list => 'usercontribs', ucuser => $user }, {max => $amount, hook => \&pages }); return $user; sub pages { my ($ref) = @_; foreach (@$ref) { my $title = "$_->{title}"; print CRAP "\00313rollbacking $user at $title\n"; $mw->edit( { action => 'rollback', title => $title, user => $user, } ); } } } Irssi::command_bind('sammich', 'sammich'); Irssi::command_bind('kittens', 'kittens'); Irssi::command_bind('upload', 'upload'); Irssi::command_bind('template', 'template'); Irssi::command_bind('rollback', 'rollback');