×
Create a new article
Write your page title here:
We currently have 3,189 articles on s23. Type your article name above or create one of the articles listed here!



    s23
    3,189Articles

    TclScripts/Mediawiki: Difference between revisions

    Content added Content deleted
    imported>mutante
    No edit summary
     
    (2 intermediate revisions by one other user not shown)
    Line 17: Line 17:
    *.teach <page> - Bonus Trigger: TEACH padma (infobot) about <page> ;)
    *.teach <page> - Bonus Trigger: TEACH padma (infobot) about <page> ;)
    *.help - SHOW this HELP message
    *.help - SHOW this HELP message
    The <span class="plainlinks">[http://www.hilongosnon.com/ <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">Hilongos</span>]</span> <span class="plainlinks">[http://www.hilongosnon.com/ <span style="color:#000000;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">Hilongos Leyte</span>]</span>

    === Source ===
    === Source ===
    <pre>
    <pre>
    Line 26: Line 26:
    # |___/_____|____/.org/wiki/
    # |___/_____|____/.org/wiki/
    #
    #
    # mediawiki.tcl v0.23
    # mediawiki.tcl v0.5
    # A Mediawiki <-> IRC - Eggdrop TCL script
    # A Mediawiki <-> IRC - Eggdrop TCL script
    # tested on mediawiki 1.4/1.5 and eggdrop 1.6.13/1.6.16
    # tested on mediawiki 1.4/1.5 and eggdrop 1.6.13/1.6.16
    Line 36: Line 36:
    # licensed under "Attribution-NonCommercial-ShareAlike 2.0"
    # licensed under "Attribution-NonCommercial-ShareAlike 2.0"
    # http://creativecommons.org/licenses/by-nc-sa/2.0/
    # http://creativecommons.org/licenses/by-nc-sa/2.0/
    # v.05 completely updated mysql queries due to mediawiki 1.5 upgrade


    # this script uses "libmysqltcl" for the TCL<->Mysql connection
    # this script uses "libmysqltcl" for the TCL<->Mysql connection
    # you can get it from http://rufus.o-town.de/eggdrop/
    # you can get it from http://rufus.o-town.de/eggdrop/
    set file /usr/local/lib/mysqltcl-2.40/libmysqltcl2.40
    # set file /usr/lib/mysqltcl-2.30/libmysqltcl2.30
    # newer version of libmysqltcl since Debian etch stable
    set file /usr/lib/mysqltcl-3.02/libmysqltcl3.02

    load ${file}[info sharedlibextension]
    load ${file}[info sharedlibextension]
    ##
    ##
    Line 53: Line 57:
    # database name
    # database name
    set mydb "wikidb"
    set mydb "wikidb"
    # database password
    # database password
    set mypass "yourpassword"
    set mypass "xxxxxxx"


    # BASIC
    # BASIC
    Line 65: Line 69:


    # number of recent changes displayed on .rc
    # number of recent changes displayed on .rc
    set myrcnum "7"
    set myrcnum "5"
    # max number of results shown on .find and .content
    # max number of results shown on .find and .content
    set myfindlimit "5"
    set myfindlimit "5"
    Line 73: Line 77:
    set myotherbot "padma"
    set myotherbot "padma"
    # number of popular pages displayed on .popular
    # number of popular pages displayed on .popular
    set mypopnum "4"
    set mypopnum "5"
    # the date your wiki was setup ,used on .stats
    # the date your wiki was setup ,used on .stats
    set mysetupdate "Feb,04 2005"
    set mysetupdate "Feb,04 2005"
    # number of characters shown of a wikipage content on .display
    # number of characters shown of a wikipage content on .display
    set mydisplaychars "120"
    set mydisplaychars "180"


    ####
    ####
    Line 106: Line 110:
    bind pub - .stats wikistats
    bind pub - .stats wikistats


    # Show Sysops
    # Show Sysops (disabled because broken since 1.5 upgrade / database change)
    # bind pub - .sysops sysops
    bind pub - .sysops sysops

    # Show discordian quote
    bind pub - .quote quote
    bind pub - !orakel specialquote
    bind pub - .23c3quote specialquote


    # add / remove IP bans (only for users with +W flag)
    # add / remove IP bans (only for users with +W flag)
    Line 113: Line 122:
    bind pub W .ban ban
    bind pub W .ban ban
    bind pub W .unban unban
    bind pub W .unban unban

    # search for wikis in wikistats
    bind pub - !wikisearch wikisearch


    # help
    # help
    bind pub - .help help
    bind pub - .help help





    Line 127: Line 140:
    puthelp "privmsg $chan : .rc - SHOWs the last 5 CHANGES on the Wiki (Recent Changes)"
    puthelp "privmsg $chan : .rc - SHOWs the last 5 CHANGES on the Wiki (Recent Changes)"
    puthelp "privmsg $chan : .popular - SHOW the most POPULAR wiki pages (hit count)"
    puthelp "privmsg $chan : .popular - SHOW the most POPULAR wiki pages (hit count)"
    # puthelp "privmsg $chan : .sysops - SHOW the wiki SYSOPS"
    puthelp "privmsg $chan : .sysops - SHOW the wiki SYSOPS"
    puthelp "privmsg $chan : .stats - SHOW the wiki STATISTICS"
    puthelp "privmsg $chan : .stats - SHOW the wiki STATISTICS"
    puthelp "privmsg $chan : .ban <IP> - ADD an IP BAN from the Wiki (for 5 days with reason 'spammer')"
    puthelp "privmsg $chan : .ban <IP> - ADD an IP BAN from the Wiki (for 5 days with reason 'spammer')"
    puthelp "privmsg $chan : .unban <page> - REMOVE an IP BAN from the Wiki."
    puthelp "privmsg $chan : .unban <page> - REMOVE an IP BAN from the Wiki."
    puthelp "privmsg $chan : .teach <page> - Bonus Trigger: TEACH padma (infobot) about <page> ;)"
    puthelp "privmsg $chan : .teach <page> - Bonus Trigger: TEACH padma (infobot) about <page> ;)"
    puthelp "privmsg $chan : .quote - Display a random discordian quote."
    puthelp "privmsg $chan : .help - SHOW this HELP message"
    puthelp "privmsg $chan : .help - SHOW this HELP message"
    puthelp "privmsg $chan : (K)2005 The S23-Cabal - visit us on http://s23.org/wiki/"
    puthelp "privmsg $chan : (K)2006 The S23-Cabal - visit us on http://s23.org/wiki/"
    }
    }


    Line 150: Line 164:
    global myhost,myuser,mypass,mydb
    global myhost,myuser,mypass,mydb
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]

    mysqlsel $db {SELECT user_name,user_email FROM user WHERE user_rights LIKE "%sysop%"}
    # mysqlsel $db {SELECT user_name,user_email FROM user WHERE user_rights LIKE "%sysop%"}
    puthelp "privmsg $chan :$::mywiki Sysops"
    # changes due to mediawiki 1.5 upgrade

    # set query "select user_name,user_email from user_rights join user on user_id=ur_user where ur_rights!='' order by user_name"
    set query "SELECT user_name,user_email from `user` LEFT JOIN `user_groups` ON user_id=ug_user WHERE ug_group = 'sysop' GROUP BY user_name"

    mysqlsel $db $query
    puthelp "privmsg $chan :$::mywiki Sysops (alphabetical order)"
    mysqlmap $db {user_name user_email} {
    mysqlmap $db {user_name user_email} {
    puthelp "privmsg $chan :$user_name - $user_email"
    puthelp "privmsg $chan :$user_name - $user_email"
    Line 158: Line 179:
    mysqlclose $db
    mysqlclose $db
    }
    }


    proc wikisearch {nick host hand chan args} {
    global myhost,myuser,mypass,mydb
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]

    set query "select name,mainurl from mediawikis where name like '%$args%' or statsurl like '%args%' limit 5"

    mysqlsel $db $query
    puthelp "privmsg $chan :$::mywiki Searching for a Wiki matching '$args'..."
    mysqlmap $db {name mainurl} {
    set name [string trim $name]

    puthelp "privmsg $chan :Found '$name' ($mainurl)"
    }
    mysqlendquery $db
    mysqlclose $db
    }


    proc quote {nick host hand chan args} {
    global myhost,myuser,mypass,mydb
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]

    set query "select quote from quotes order by rand() limit 1"

    mysqlsel $db $query
    puthelp "privmsg $chan :$::mywiki Random discordian quote:"
    mysqlmap $db {quote} {
    puthelp "privmsg $chan :$quote"
    }
    mysqlendquery $db
    mysqlclose $db
    }



    proc specialquote {nick host hand chan args} {
    global myhost,myuser,mypass,mydb
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]

    set query "select quote from quotes order by rand() limit 1"

    mysqlsel $db $query
    mysqlmap $db {quote} {
    # http::formatQuery quote "$quote"

    puthelp "privmsg $chan :The Oracle says to $nick: '$quote'"
    }
    mysqlendquery $db
    mysqlclose $db
    }



    proc display {nick host hand chan args} {
    proc display {nick host hand chan args} {
    global myhost,myuser,mypass,mydb
    global myhost,myuser,mypass,mydb
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]
    set query "SELECT left(cur_text,120) as cur_sum FROM cur WHERE cur_title='$args'"
    # set query "SELECT left(cur_text,120) as cur_sum FROM cur WHERE cur_title='$args'"
    # changes due to mediawiki 1.5 upgrade

    set query "select left(si_text,$::mydisplaychars) as si_sum from searchindex join page on page_id=si_page where page_title='$args'"

    mysqlsel $db $query
    mysqlsel $db $query
    puthelp "privmsg $chan :$::mywiki - Displaying page '$args' (first 120 chars)"
    puthelp "privmsg $chan :$::mywiki - Displaying page '$args' (first $::mydisplaychars chars)"
    mysqlmap $db {cur_sum} {
    mysqlmap $db {si_sum} {
    puthelp "privmsg $chan :$cur_sum ... continued on $::mybaseurl/$args"
    puthelp "privmsg $chan :$si_sum ... continued on $::mybaseurl/$args"
    }
    }
    mysqlendquery $db
    mysqlendquery $db
    Line 196: Line 274:
    global myhost,myuser,mypass,mydb
    global myhost,myuser,mypass,mydb
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]
    set query "SELECT left(cur_text,120) as cur_sum FROM cur WHERE cur_title='$args'"
    # set query "SELECT left(cur_text,120) as cur_sum FROM cur WHERE cur_title='$args'"
    # changes due to mediawiki 1.5 upgrade

    set query "select left(si_text,180) as si_sum from searchindex join page on page_id=si_page where page_title='$args'"

    mysqlsel $db $query
    mysqlsel $db $query
    mysqlmap $db {cur_sum} {
    mysqlmap $db {si_sum} {
    puthelp "privmsg $chan :$::myotherbot, $args is $cur_sum ... $::mybaseurl/$args"
    puthelp "privmsg $chan :$::myotherbot, $args is $si_sum ... $::mybaseurl/$args"
    }
    }
    mysqlendquery $db
    mysqlendquery $db
    Line 221: Line 303:
    global myhost,myuser,mypass,mydb
    global myhost,myuser,mypass,mydb
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]

    set query "SELECT cur_title FROM cur WHERE cur_title LIKE '%$args%' LIMIT 0,$::myfindlimit"
    # set query "SELECT cur_title FROM cur WHERE cur_title LIKE '%$args%' LIMIT 0,$::myfindlimit"
    # changes due to mediawiki 1.5 upgrade

    # set query "select page_id,page_title,page_counter from page join revision on rev_id = page_id where page_title LIKE '%$args%' limit 0,$::myfindlimit"

    set lsearchstring [string tolower $args]
    set query "select page_title from page where page_title like '%$args%' or page_title like '%$lsearchstring%' LIMIT 0,$::myfindlimit"

    mysqlsel $db $query
    mysqlsel $db $query
    puthelp "privmsg $chan :$::mywiki - Searching for page titles containing '$args'"
    puthelp "privmsg $chan :$::mywiki - Searching for page titles containing '$args'"
    mysqlmap $db {cur_title} {
    mysqlmap $db {page_title} {
    puthelp "privmsg $chan :Found page $cur_title ($::mybaseurl/$cur_title)"
    # puthelp "privmsg $chan :Query: $query"
    puthelp "privmsg $chan :Found page $page_title ($::mybaseurl/$page_title)"
    }
    }
    mysqlendquery $db
    mysqlendquery $db
    Line 234: Line 325:
    global myhost,myuser,mypass,mydb
    global myhost,myuser,mypass,mydb
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]

    set query "SELECT cur_title FROM cur WHERE cur_text LIKE '%$args%' LIMIT 0,$::myfindlimit"
    # set query "SELECT cur_title FROM cur WHERE cur_text LIKE '%$args%' LIMIT 0,$::myfindlimit"
    # changes due to mediawiki 1.5 upgrade

    set query "select page_title from searchindex join page on page_id=si_page where si_text LIKE '%$args%' LIMIT 0,$::myfindlimit"

    # puthelp "privmsg $chan :$query"
    mysqlsel $db $query
    mysqlsel $db $query
    puthelp "privmsg $chan :$::mywiki - Searching for pages fulltext containing $args"
    puthelp "privmsg $chan :$::mywiki - Searching full text for pages containing $args"
    mysqlmap $db {cur_title} {
    mysqlmap $db {page_title} {
    puthelp "privmsg $chan :Found page $cur_title ($::mybaseurl/$cur_title)"
    puthelp "privmsg $chan :Found page $page_title ($::mybaseurl/$page_title)"
    }
    }
    mysqlendquery $db
    mysqlendquery $db
    mysqlclose $db
    mysqlclose $db
    }
    }


    Line 248: Line 345:
    global myhost,myuser,mypass,mydb
    global myhost,myuser,mypass,mydb
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]
    set query "select cur_title,cur_counter from cur ORDER by cur_counter DESC LIMIT 1,$::mypopnum"
    # set query "select cur_title,cur_counter from cur ORDER by cur_counter DESC LIMIT 1,$::mypopnum"
    # changes due to mediawiki 1.5 upgrade
    set query "select page_title,page_counter from page order by page_counter desc limit 1,$::mypopnum"

    mysqlsel $db $query
    mysqlsel $db $query
    puthelp "privmsg $chan :$::mywiki Top $::mypopnum popular pages"
    puthelp "privmsg $chan :$::mywiki Top $::mypopnum popular pages"
    mysqlmap $db {cur_title cur_counter} {
    mysqlmap $db {page_title page_counter} {
    puthelp "privmsg $chan :$cur_title ($cur_counter hits) - ($::mybaseurl/$cur_title)"
    puthelp "privmsg $chan :$page_title ($page_counter hits) - ($::mybaseurl/$page_title)"
    }
    }
    mysqlendquery $db
    mysqlendquery $db
    Line 262: Line 362:
    # mutante@s23.org
    # mutante@s23.org
    </pre>
    </pre>

    {{UnderConstruction}}


    [[Category:Scripts]]
    [[Category:Scripts]]

    Latest revision as of 06:30, 21 December 2010

    A tcl script for eggdrop and mediawiki.

    by mutante 01:49, 25 October 2005 (CEST)

    Features[edit]

    Mediawiki.tcl

    • .title <string> - SEARCHes for a string in page TITLE (Alias .find)
    • .content <string> - SEARCHes for a string in the page CONTENT (Alias .full)
    • .display <page> - SHOWs the CONTENT of a wiki page (currently first 120 chars)
    • .rc - SHOWs the last x CHANGES on the Wiki (Recent Changes)
    • .popular - SHOW the most POPULAR wiki pages (hit count)
    • .stats - SHOW the wiki STATISTICS
    • .ban <IP> - ADD an IP BAN from the Wiki (for x days with reason 'spammer')
    • .unban <page> - REMOVE an IP BAN from the Wiki.
    • .teach <page> - Bonus Trigger: TEACH padma (infobot) about <page> ;)
    • .help - SHOW this HELP message

    The Hilongos Hilongos Leyte

    Source[edit]

    #      ____  ____       
    #  ___|___ \|___ /             
    # / __| __) | |_ \
    # \__ \/ __/ ___) |
    # |___/_____|____/.org/wiki/
    #
    # mediawiki.tcl v0.5   
    # A Mediawiki <-> IRC - Eggdrop TCL script
    # tested on mediawiki 1.4/1.5 and eggdrop 1.6.13/1.6.16
    # Mediawiki: http://meta.wikimedia.org/wiki/Mediawiki | #mediawiki on Freenode
    # Eggdrop: http://eggheads.org/ | http://egghelp.org/ | #egghelp on Efnet
    # by mutante (http://s23.org/wiki/User:mutante) (mutante@s23.org) of
    # the S23 Cabal (http://s23.org/wiki/) | #wiki,#bots on Efnet
    # v0.23 pre-release by [Hyarion]'s request. 25.Okt.2005
    # licensed under "Attribution-NonCommercial-ShareAlike 2.0"
    # http://creativecommons.org/licenses/by-nc-sa/2.0/
    # v.05 completely updated mysql queries due to mediawiki 1.5 upgrade 
    
    # this script uses "libmysqltcl" for the TCL<->Mysql connection
    # you can get it from http://rufus.o-town.de/eggdrop/
    # set file /usr/lib/mysqltcl-2.30/libmysqltcl2.30
    # newer version of libmysqltcl since Debian etch stable
    set file /usr/lib/mysqltcl-3.02/libmysqltcl3.02
    
    load ${file}[info sharedlibextension]
    ##
    
    ####
    # config
    
    # MYSQL
    # database host
    set myhost "localhost"
    # database user
    set myuser "wikiuser"
    # database name
    set mydb "wikidb"
    # database password
    set mypass "xxxxxxx"
    
    # BASIC
    # Name of your Wiki
    set mywiki "S23-Wiki"
    # (All Your Base..) URL (the part before the wiki page name)
    set mybaseurl "http://s23.org/wiki"
    
    # MISC
    
    # number of recent changes displayed on .rc
    set myrcnum "5"
    # max number of results shown on .find and .content
    set myfindlimit "5"
    # number of days a spammer is blocked on .ban
    set myspamdays "5"
    # name of another (infobot) bot used on .teach
    set myotherbot "padma"
    # number of popular pages displayed on .popular
    set mypopnum "5"
    # the date your wiki was setup ,used on .stats
    set mysetupdate "Feb,04 2005"
    # number of characters shown of a wikipage content on .display
    set mydisplaychars "180"
    
    ####
    
    ### the (public) triggers
    
    # Recent changes
    bind pub - .rc wikirc
    
    # Search in titles
    bind pub - .find findpage
    bind pub - .title findpage
    
    # Search fulltext
    bind pub - .content findcontent
    bind pub - .full findcontent
    
    # Show popular pages
    bind pub - .popular popular
    
    # Display page content (first x chars)
    bind pub - .display display
    
    # Teach other (info)bot
    bind pub - .teach teach
    
    # Show Statistics
    bind pub - .stats wikistats
    
    # Show Sysops
    bind pub - .sysops sysops
    
    # Show discordian quote
    bind pub - .quote quote
    bind pub - !orakel specialquote
    bind pub - .23c3quote specialquote
    
    # add / remove IP bans (only for users with +W flag)
    
    bind pub W .ban ban
    bind pub W .unban unban
    
    # search for wikis in wikistats
    bind pub - !wikisearch wikisearch
    
    # help
    bind pub - .help help
    
    
    
    # the procs
    
    proc help {nick host hand chan args} {
    puthelp "privmsg $chan :  Mediawiki.tcl script by S23/mutante. Here are the triggers, $nick"
    puthelp "privmsg $chan : .title <string> - SEARCHes for a string in page TITLE (Alias .find)"
    puthelp "privmsg $chan : .content <string> - SEARCHes for a string in the page CONTENT (Alias .full)"
    puthelp "privmsg $chan : .display <page> - SHOWs the CONTENT of a wiki page (currently first $::mydisplaychars chars)"
    puthelp "privmsg $chan : .rc - SHOWs the last 5 CHANGES on the Wiki (Recent Changes)"
    puthelp "privmsg $chan : .popular - SHOW the most POPULAR wiki pages (hit count)"
    puthelp "privmsg $chan : .sysops - SHOW the wiki SYSOPS"
    puthelp "privmsg $chan : .stats - SHOW the wiki STATISTICS"
    puthelp "privmsg $chan : .ban <IP> - ADD an IP BAN from the Wiki (for 5 days with reason 'spammer')"
    puthelp "privmsg $chan : .unban <page> - REMOVE an IP BAN from the Wiki."
    puthelp "privmsg $chan : .teach <page> - Bonus Trigger: TEACH padma (infobot) about <page> ;)"
    puthelp "privmsg $chan : .quote - Display a random discordian quote."
    puthelp "privmsg $chan : .help - SHOW this HELP message"
    puthelp "privmsg $chan : (K)2006 The S23-Cabal - visit us on http://s23.org/wiki/"
    }
    
    proc wikistats {nick host hand chan args} {
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]
    mysqlsel $db {SELECT ss_total_views,ss_total_edits,ss_good_articles from site_stats}
    putquick "privmsg $chan :$::mywiki Site-Stats"
    mysqlmap $db {ss_total_views ss_total_edits ss_good_articles} {
    putquick "privmsg $chan :Total Views: $ss_total_views Total Edits: $ss_total_edits Good Articles: $ss_good_articles (since mediawiki setup on $::mysetupdate)"
    }
    mysqlendquery $db
    mysqlclose $db
    }
    
    proc sysops {nick host hand chan args} {
    global myhost,myuser,mypass,mydb
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]
    
    # mysqlsel $db {SELECT user_name,user_email FROM user WHERE user_rights LIKE "%sysop%"}
    # changes due to mediawiki 1.5 upgrade
    
    # set query "select user_name,user_email from user_rights join user on user_id=ur_user where ur_rights!='' order by user_name"
    set query "SELECT user_name,user_email from `user` LEFT JOIN `user_groups` ON user_id=ug_user WHERE ug_group = 'sysop' GROUP BY user_name"
    
    mysqlsel $db $query
    puthelp "privmsg $chan :$::mywiki Sysops (alphabetical order)"
    mysqlmap $db {user_name user_email} {
    puthelp "privmsg $chan :$user_name - $user_email"
    }
    mysqlendquery $db
    mysqlclose $db
    }
    
    
    proc wikisearch {nick host hand chan args} {
    global myhost,myuser,mypass,mydb
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]
    
    set query "select name,mainurl from mediawikis where name like '%$args%' or statsurl like '%args%' limit 5"
    
    mysqlsel $db $query
    puthelp "privmsg $chan :$::mywiki Searching for a Wiki matching '$args'..."
    mysqlmap $db {name mainurl} {
    set name [string trim $name]
    
    puthelp "privmsg $chan :Found '$name' ($mainurl)"
    }
    mysqlendquery $db
    mysqlclose $db
    }
    
    
    proc quote {nick host hand chan args} {
    global myhost,myuser,mypass,mydb
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]
    
    set query "select quote from quotes order by rand() limit 1"
    
    mysqlsel $db $query
    puthelp "privmsg $chan :$::mywiki Random discordian quote:"
    mysqlmap $db {quote} {
    puthelp "privmsg $chan :$quote"
    }
    mysqlendquery $db
    mysqlclose $db
    }
    
    
    
    proc specialquote {nick host hand chan args} {
    global myhost,myuser,mypass,mydb
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]
    
    set query "select quote from quotes order by rand() limit 1"
    
    mysqlsel $db $query
    mysqlmap $db {quote} {
    # http::formatQuery quote "$quote"
    
    puthelp "privmsg $chan :The Oracle says to $nick: '$quote'"
    }
    mysqlendquery $db
    mysqlclose $db
    }
    
    
    proc display {nick host hand chan args} {
    global myhost,myuser,mypass,mydb
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]
    # set query "SELECT left(cur_text,120) as cur_sum FROM cur WHERE cur_title='$args'"
    # changes due to mediawiki 1.5 upgrade
    
    set query "select left(si_text,$::mydisplaychars) as si_sum from searchindex join page on page_id=si_page where page_title='$args'"
    
    mysqlsel $db $query
    puthelp "privmsg $chan :$::mywiki - Displaying page '$args' (first $::mydisplaychars chars)"
    mysqlmap $db {si_sum} {
    puthelp "privmsg $chan :$si_sum ... continued on $::mybaseurl/$args"
    }
    mysqlendquery $db
    mysqlclose $db
    }
    
    
    proc ban {nick host hand chan args} {
    global myhost,myuser,mypass,mydb
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]
    set query "INSERT into ipblocks (ipb_address,ipb_user,ipb_by,ipb_reason,ipb_timestamp,ipb_auto,ipb_expiry) values ('$args','0','74','spammer (banned via IRC)',NOW()+0,'0',ADDDATE(NOW(),INTERVAL 1 DAY)+0);"
    mysqlsel $db $query
    puthelp "privmsg $chan :Ok, $nick, blocked '$args' for $::myspamdays days with reason 'spammer'"
    mysqlendquery $db
    mysqlclose $db
    }
    
    proc unban {nick host hand chan args} {
    global myhost,myuser,mypass,mydb
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]
    set query "DELETE from ipblocks WHERE ipb_address='$args';"
    mysqlsel $db $query
    puthelp "privmsg $chan :Ok, $nick, removed block on '$args'"
    mysqlendquery $db
    mysqlclose $db
    }
    
    proc teach {nick host hand chan args} {
    global myhost,myuser,mypass,mydb
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]
    # set query "SELECT left(cur_text,120) as cur_sum FROM cur WHERE cur_title='$args'"
    # changes due to mediawiki 1.5 upgrade
    
    set query "select left(si_text,180) as si_sum from searchindex join page on page_id=si_page where page_title='$args'"
    
    mysqlsel $db $query
    mysqlmap $db {si_sum} {
    puthelp "privmsg $chan :$::myotherbot, $args is $si_sum ... $::mybaseurl/$args"
    }
    mysqlendquery $db
    mysqlclose $db
    }
    
    proc wikirc {nick host hand chan args} {
    global myhost,myuser,mypass,mydb
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]
    set query "select rc_id,rc_title,rc_comment,rc_user_text from recentchanges order by rc_id desc LIMIT 0,$::myrcnum"
    mysqlsel $db $query
    puthelp "privmsg $chan :$::mywiki - Last $::myrcnum changes"
    mysqlmap $db {rc_id rc_title rc_comment rc_user_text} {
    puthelp "privmsg $chan :#$rc_id '$rc_title' $rc_comment by $rc_user_text ($::mybaseurl/$rc_title)"
    }
    mysqlendquery $db
    mysqlclose $db
    }
    
    proc findpage {nick host hand chan args} {
    global myhost,myuser,mypass,mydb
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]
    
    # set query "SELECT cur_title FROM cur WHERE cur_title LIKE '%$args%' LIMIT 0,$::myfindlimit"
    # changes due to mediawiki 1.5 upgrade
    
    # set query "select page_id,page_title,page_counter from page join revision on rev_id = page_id where page_title LIKE '%$args%' limit 0,$::myfindlimit"
    
    set lsearchstring [string tolower $args]
    set query "select page_title from page where page_title like '%$args%' or page_title like '%$lsearchstring%' LIMIT 0,$::myfindlimit"
    
    mysqlsel $db $query
    puthelp "privmsg $chan :$::mywiki - Searching for page titles containing '$args'"
    mysqlmap $db {page_title} {
    # puthelp "privmsg $chan :Query: $query"
    puthelp "privmsg $chan :Found page $page_title ($::mybaseurl/$page_title)"
    }
    mysqlendquery $db
    mysqlclose $db
    }
    
    proc findcontent {nick host hand chan args} {
    global myhost,myuser,mypass,mydb
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]
    
    # set query "SELECT cur_title FROM cur WHERE cur_text LIKE '%$args%' LIMIT 0,$::myfindlimit"
    # changes due to mediawiki 1.5 upgrade
    
    set query "select page_title from searchindex join page on page_id=si_page where si_text LIKE '%$args%' LIMIT 0,$::myfindlimit"
    
    # puthelp "privmsg $chan :$query"
    mysqlsel $db $query
    puthelp "privmsg $chan :$::mywiki - Searching full text for pages containing $args"
    mysqlmap $db {page_title} {
     puthelp "privmsg $chan :Found page $page_title ($::mybaseurl/$page_title)"
    }
     mysqlendquery $db
     mysqlclose $db
    }
    
    
    proc popular {nick host hand chan args} {
    global myhost,myuser,mypass,mydb
    set db [mysqlconnect -host $::myhost -user $::myuser -password $::mypass -db $::mydb]
    # set query "select cur_title,cur_counter from cur ORDER by cur_counter DESC LIMIT 1,$::mypopnum"
    # changes due to mediawiki 1.5 upgrade
    set query "select page_title,page_counter from page order by page_counter desc limit 1,$::mypopnum"
    
    mysqlsel $db $query
    puthelp "privmsg $chan :$::mywiki Top $::mypopnum popular pages"
    mysqlmap $db {page_title page_counter} {
    puthelp "privmsg $chan :$page_title ($page_counter hits) - ($::mybaseurl/$page_title)"
    }
    mysqlendquery $db
    mysqlclose $db
    }
    
    putlog "Mediawiki.tcl by S23 loaded. Fnord. http://s23.org/wiki/"
    # fnord
    # mutante@s23.org
    
    This page is still under construction.
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.

    Recent changes

  • BruderSpektrum • 18 hours ago
  • BruderSpektrum • 22 hours ago
  • BruderSpektrum • 22 hours ago
  • BruderSpektrum • 22 hours ago
  • Cookies help us deliver our services. By using our services, you agree to our use of cookies.