Set arkadaşımızın 2010 yılında yaptığı botun çalışır halidir. Veri aldığı site güncellendiğinden çalışmıyordu.
Kod:
######################## CityBOT Ayarlari ###############
alias botnick return CityBot
alias nickpass return 123456
alias opers return Deneme 123456
alias supass return 123456
alias ident return CBot
alias operchan return #opers
alias sunucu return 185.93.71.36 6667
alias sunucuismi return Nevarline.Com
alias hostum return $+(SehirBot,.,$sunucuismi)
############### Ayar The End ############
alias city {
if ($1 == bagla) {
sockclose city | sockopen city $sunucu
}
if ($1 == kapat) {
sockclose city
}
}
alias swcity {
if $sock(city).status == active {
sockwrite -nt city $1-
}
}
on *:SOCKOPEN:city: {
swcity nick $+(Services,$r(0,99))
swcity USER $ident " " : $+ $+([,,CityBOT,,]) (System v1 by Aeg)
}
on *:sockread:city: {
if !$sock($sockname) { echo -a Baglanti Koptu! | halt }
var %q
sockread %q
tokenize 32 %q
if $1 == error && $2 == :closing {
city bagla
}
if $1 == PING {
swcity PONG $2
}
if $2 == 376 {
swcity oper $opers
swcity join 0,
swcity nick $botnick
swcity sethost $hostum
swcity setident $ident
swcity join $operchan
swcity mode $botnick +p
}
if ($2 == NICK) {
if $right($3,-1) == $botnick { swcity nickserv identify $nickpass }
}
if ($2 == 352) && (%kontrol.nick [ $+ [ $8 ] ] == $8) {
nerden $6 $8
swcity who +I $+(*,$6,*)
unset %kontrol.nick [ $+ [ $8 ] ]
halt
}
if ($2 == 352) {
%clone. [ $+ [ $6 ] ] = $addtok( %clone. [ $+ [ $6 ] ] ,$8,32)
}
if $2 == notice {
if $regex(sn,$4-,/client connecting.+\x3A\s(.+)\s\x28(\S+)@(\S+)\x29/Si) && (%city == on) {
set %kontrol.nick [ $+ [ $regml(sn,1) ] ] $regml(sn,1)
swcity who +I $regml(sn,1)
}
}
if ($2 == privmsg) {
var %n = $gettok($gettok($1,1,33),1,58), %m = $4,%text = $right($4-,-1), %k = $3
if (.city isin %m) && (%k == $operchan) {
if ($5 == on) {
if (%city == on) { swcity privmsg %k CityBot Zaten Aktif! | halt }
set %city on | swcity privmsg %k CityBot Aktif!
halt
}
if ($5 == off) {
if (%city == off) { swcity privmsg %k CityBot DEAktif! | halt }
set %city off | swcity privmsg %k CityBot DEAktif!
halt
}
}
}
}
alias nerden {
var %:r2 = $r(1,999999999999)
set -u6 %nick [ $+ [ $1 ] ] $2
sockopen $+(nerden,%:r2) www.ipaddresslocation.org 80
sockmark $+(nerden,%:r2) $+($1,¿,$2)
}
on *:sockopen:nerden*:{
sockwrite -nt $sockname GET $+(/ip-address-locator.php?lookup=,$token($sock($sockname).mark,1,191)) HTTP/1.1
sockwrite -nt $sockname Host: www.ipaddresslocation.org
sockwrite -nt $sockname Connection: keep-alive
sockwrite -nt $sockname Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
sockwrite -nt $sockname User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36
sockwrite -nt $sockname $crlf
}
on *:sockread:nerden*:{
var %shrytbl
sockread %shrytbl
if (IP City: isin %shrytbl) {
.hadd -m $token($sock($sockname).mark,2,191) Sehir $iif($token($htmlfree(%shrytbl),2,58) == $null,Belirsiz,$token($htmlfree(%shrytbl),2,58))
var %nick = $token($sock($sockname).mark,2,191), %ip = $token($sock($sockname).mark,1,191), %sehir = $hget(%nick,sehir)
swcity sajoin %nick $+($chr(35),%sehir)
swcity privmsg $operchan [GIRIS] Nick: %nick IP: %ip Sehir: %sehir $iif($numtok(%clone. [ $+ [ $sock($sockname).mark ] ],32) != 1 ,Kanaldaki Cloneleri: %clone. [ $+ [ %ip ] ])
swcity privmsg %nick CityBot Tarafindan OTO JOIN : $+($chr(35),%sehir)
hava %sehir %nick
unset %clone. [ $+ [ %ip ] ]
}
}
on *:sockclose:nerden*: {
.hfree $token($sock($sockname).mark,2,191)
}
alias htmlfree {
var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/gi,$null,%x), %x = $remove(%x, )
return %x
}
alias hava {
var %:r3 = $r(1,999999999999)
set -u5 %hava [ $+ [ $1 ] ] $2
sockopen $+(hava,%:r3) havadurumu.mynet.com 80
sockmark $+(hava,%:r3) $replace($1,urfa,sanliurfa)
}
on *:sockopen:hava*:{
sockwrite -n $sockname GET /asya/turkiye/ $+ $sock($sockname).mark HTTP/1.1
sockwrite -n $sockname Host: havadurumu.mynet.com
sockwrite -n $sockname User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0
sockwrite -n $sockname Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
sockwrite -n $sockname Accept-Language: tr-TR,tr;q=0.8,en-US;q=0.5,en;q=0.3
sockwrite -n $sockname Connection: keep-alive
sockwrite -n $sockname Upgrade-Insecure-Requests: 1
sockwrite -n $sockname $crlf + $crlf
}
on *:sockread:hava*:{
var %hava
sockread %hava
if (*title*MYNET*Hava*durumu*-*T*rkiye* iswm %hava) {
swcity privmsg %hava [ $+ [ $sock($sockname).mark ] ] Sorgulanan: $remove($htmlfree(%hava), ,MYNET)
}
if (*hvDate* iswm %hava) {
swcity privmsg %hava [ $+ [ $sock($sockname).mark ] ] Tarih: $remove($htmlfree(%hava), )
}
if (*hvDay* iswm %hava) {
swcity privmsg %hava [ $+ [ $sock($sockname).mark ] ] Gun: $remove($htmlfree(%hava), )
}
if (*hvMood* iswm %hava) {
swcity privmsg %hava [ $+ [ $sock($sockname).mark ] ] Durum: $remove($htmlfree(%hava), )
}
if (*hvDeg1* iswm %hava) {
swcity privmsg %hava [ $+ [ $sock($sockname).mark ] ] En Yuksek Sicaklik: $remove($htmlfree(%hava), )
}
if (*hvDeg2* iswm %hava) {
swcity privmsg %hava [ $+ [ $sock($sockname).mark ] ] En Dusuk Sicaklik: $remove($htmlfree(%hava), )
}
}
alias htmlfree {
var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, )
return %x
}
İşlevi: Giriş yapan userin şehir bilgisini verir ve useri geldiği şehirin kanalına sajoin işlemi uygular. Ek olarak gelen userin özeline geldiği şehirin hava durumu bilgisini verir. Belirlediğiniz yönetici kanalına giriş bilgisinde şehir bilgisi ve clone bilgisini verir.
Ayarlamanız gereken yerleri kırmızı renkte belirttim. Kodu ekledikten sonra /city bagla yazmanız yeterlidir.