don't know what changed, but there's something ;-)

This commit is contained in:
lookshe 2012-09-09 21:02:03 +02:00
parent e92f4f4425
commit 009a87ffad
6 changed files with 194 additions and 1 deletions

View file

@ -72,6 +72,9 @@ if {[info exists do_dec($nick:$chan)]} {
}
set allargs [string map {" " _} $arguments]
set allargs [string map {"\[" _} $allargs]
set allargs [string map {"]" _} $allargs]
#putlog "all: $allargs"
set arguments [split $arguments]
set count 1
set klammer_count 0
@ -97,7 +100,7 @@ if {[info exists do_dec($nick:$chan)]} {
set myrand [rand $klammer_count]
if {[info exists do_dec($allargs)]} {
set myrand $do_dec($allargs)
timer 60 "unset do_dec($allargs)"
#timer 1 "unset do_dec($allargs)"
} else {
set do_dec($allargs) $myrand
timer 60 "unset do_dec($allargs)"

47
eggdrop-pisg_mff.tcl Normal file
View file

@ -0,0 +1,47 @@
#pisg.tcl v0.15 by HM2K - auto stats script for pisg (perl irc statistics generator)
#based on a script by Arganan
# WARNING - READ THIS
#
# If you use this script, PLEASE read the documentation about the "Silent"
# option. If you get the message "an error occured: Pisg v0.67 - perl irc
# statistics generator" in the channel, you are NOT running silent. Fix it.
set pisgver "0.15"
#Location of pisg execuitable perl script
set pisgexe "/home/eggdrop/eggdrop/pisg/pisg"
#URL of the generated stats
set pisgurl "http://www.thehappy.de/~lookshe/pub/logs"
#channel that the stats are generated for
set pisgchan "#mitsu_caht_runde"
#Users with these flags can operate this function
set pisgflags "nm"
#How often the stats will be updated in minutes, ie: 30 - stats will be updated every 30 minutes
set pisgtime "1440"
bind pub $pisgflags !stats pub:pisgcmd
proc pub:pisgcmd {nick host hand chan arg} {
global pisgexe pisgurl pisgchan
append out "PRIVMSG $pisgchan :" ; if {[catch {exec $pisgexe} error]} { append out "$pisgexe an error occured: [string totitle $error]" } else { append out "Stats Updated: $pisgurl" }
# puthelp $out
}
proc pisgcmd_timer {} {
global pisgexe pisgurl pisgchan pisgtime
append out "PRIVMSG $pisgchan :" ; if {[catch {exec $pisgexe} error]} { append out "$pisgexe an error occured: [string totitle $error]" } else { append out "Stats Updated: $pisgurl" }
# puthelp $out
timer $pisgtime pisgcmd_timer
}
if {![info exists {pisgset}]} {
set pisgset 1
timer 2 pisgcmd_timer
}
putlog "pisg.tcl $pisgver loaded"

11
join_mitsu.tcl Normal file
View file

@ -0,0 +1,11 @@
bind join - "#mitsu_chat_runde" join_help
proc join_help {nick host hand chan} {
global botnick
if {$botnick == $nick} {
return 0
}
putserv "PRIVMSG $chan :Willkommen im MFF-Chat $nick, stelle einfach deine Frage oder sag einfach nur Hallo. Warte bitte eine Weile auf Antwort, da die User auch ein Privatleben haben ;-) (PS: Ich bin nur ein Bot)"
}
putlog "join_mitsu by lookshe loaded"

View file

@ -3,6 +3,7 @@
bind pub - !wiki wiki
bind pub - !ewiki ewiki
#bind pub - !say say
bind pub - !mitsu mitsu
bind pub - !google say
proc say {nick host hand chan arg} {
@ -10,6 +11,11 @@ proc say {nick host hand chan arg} {
# putserv "PRIVMSG $chan :das hier ist [string trimleft $chan #]";
}
proc mitsu {nick host hand chan arg} {
putserv "PRIVMSG $chan :www.mitsu-talk.de";
# putserv "PRIVMSG $chan :das hier ist [string trimleft $chan #]";
}
proc wiki {nick host hand chan arg} {
global do_wiki
if {[info exists do_wiki($nick:$chan)]} {

100
wiki_export.pl Normal file
View file

@ -0,0 +1,100 @@
#!/usr/bin/perl
#use strict;
#use warnings;
use Web::Scraper;
use URI;
use HTML::Entities;
use Encode;
use URI::Escape;
use LWP::UserAgent;
my $scrap;
my $lang = $ARGV[1];
if (!$lang) {
$lang = "de";
}
my $wikiurl = "http://$lang.wikipedia.org/wiki/Special:Search?search=$ARGV[0]&go=Go";
my $ua = new LWP::UserAgent;
my $req = HTTP::Request->new('GET', $wikiurl);
my $res = $ua->request($req);
my $url = $res->request->uri;
my $origurl = $url;
$url =~ s/.*\/wiki\///;
binmode(STDOUT, ":utf8");
if ($url !~ m/Special:Search/) {
#artikel
$scrap = scraper {
process '//div[@id="bodyContent"]/p', 'text[]' => 'TEXT';
process '//img', 'img[]' => '@src';
process '//div[@id="bodyContent"]/ul/li', 'list[]' => 'TEXT';
process '//table/tr/td', 'table[]' => 'TEXT';
};
$url = URI->new($wikiurl);
my $res = $scrap->scrape($url);
my $text = $res->{'text'};
my $img = $res->{'img'};
my $list = $res->{'list'};
my $table = $res->{'table'};
my $isDis = 0;
if ($#$table > 0) {
foreach (@$img) {
#print "$_\n";
# if ($_ =~ m/^http:\/\/upload\.wikimedia\.org\/wikipedia\/commons\/thumb\/.*\/.*\/Disambig/) {
if ($_ =~ m/Disambig/i) {
$isDis = 1;
last;
}
}
}
if (!$isDis) {
$text = decode_entities($$text[0]);
$text =~ s/\([^\(\)]*\)||\[[^\[\]]*\]//g;
$text =~ s/\([^\(\)]*\)||\[[^\[\]]*\]//g;
$text =~ s/\([^\(\)]*\)||\[[^\[\]]*\]//g;
$text =~ s/\([^\(\)]*\)||\[[^\[\]]*\]//g;
$text =~ s/\s+/ /g;
$text =~ s/\s([,.\?!])/$1/g;
if ($text =~ m/.{448}.*/) {
$text =~ s/^(.{448}).*$/$1/;
$text =~ s/^(.*[\.!\?])[^\.!\?]*$/$1 (...)/;
}
print $text, "\n";
} else {
for ($count = 0; $count < 3 && $count <= $#$list; $count++) {
print "$$list[$count]\n";
}
print "For more see $origurl\n";
}
} else {
#kein artikel
$scrap = scraper {
process '//div[@class="searchresult"]', 'text[]' => 'TEXT';
process '//ul[@class="mw-search-results"]/li/div/a', 'href[]' => '@href';
};
$url = URI->new($wikiurl);
my $res = $scrap->scrape($url);
if (keys(%$res)) {
my $text = $res->{'text'};
my $href = $res->{'href'};
my $result = "";
for ($count = 0; $count < 5 && $count <= $#$text; $count++) {
$result = ($result?"$result || ":"").$$href[$count], "\n";
}
print "$result\n";
} else {
print "No matches with $ARGV[0]\n";
}
}

26
youtube.pl Normal file
View file

@ -0,0 +1,26 @@
#!/usr/bin/perl
use LWP::Simple;
if ($#ARGV != 0)
{
exit;
}
my ($url, $content, $title);
$url = $ARGV[0];
$content = get($url);
if (!defined $content)
{
exit;
}
if ($content =~ m/<title>(.*?)<\/title>/s)
{
$title = $1;
$title =~ s/^\s+//;
$title =~ s/\s+- YouTube\s+$//;
print "$title";
}