[fractionné] Bartender script (PHP)

namespace eval serveCommands {
    variable serve {
        "bar" { "This Bar have: !coffee !bang !cola !beer !joint !head !mix !whisky !pipe !pussy !coke !icecream" }
        "coke" { "Are you stupid? We doesn't do shit like this... GO SLAP YOURSELF IN THE NUTS! :P" }
        "coffee" { "Making a cup of coffee for {nick}, {today} made today of {total} ordered which make it the {sumtotal} time i make coffee" }
        "bang" { "fills a bang from stash and serves it to {nick} ({today}/{total}/{sumtotal})" }
        "cola" { 
            "Serves icecold cola ({today}/{total}/{sumtotal})"
            "Serves cola that been laying in pile of shit ~45c ({today}/{total}/{sumtotal})"
            "Serves cola been standing close to box of dryice ~1,3c ({today}/{total}/{sumtotal})"
            "Serves cola that been standing next to comp for few hrs ({today}/{total}/{sumtotal})"
        "beer" { "Serves icecold beer ({today}/{total}/{sumtotal))" }
        "joint" { "Grabs a joint to {nick} from the stash ({today}/{total}/{sumtotal))" }
        "head" { 
            ".h.e.a.d. ({total))" 
            "head for you sir. ({total))"
        "wine" {
            "pours up some fine stuff from the basement ({total))"
            "here you are, found something out back ({total))"
            "lucky you we just got one of this left enjoy ({total))"
            "so youre hit hard, where you want it ?, dont cry"
        "mix" {
            "grinding up some weed for a mix ({total))"
            "grabs some the good stuff for a mix ({total))"
            "sneaks into g2x3ks stash and steals for a mix, here you go ({total))"
            "goes strain hunting in india for some good shit for your mix ({total))"
            "goes strain hunting in morocco for some good shit for your mix ({total))"
        "pipe" {
            "goes strain hunting in morocco for some good shit for your pipe ({total))"
            "saw some shit in corner, fills a pipe ({total))"
            "skunky just arrieved peace all over ({total))"
        "whiskey" {
            "serves whiskey on the rocks ({total))"
            "found some weird looking bottle in corner, might hit gold cheers ({total))"
            "cola and bad whiskey for you ({total))"
        "pussy" {
            "slaps {nick} in face with a smelly pussy ({total))"
            "Sends some pussy {nick}`s way .. ({total))"
            "not enough money to supply you as well ... ({total))"
        "icecream" {
            "here {nick}... one ball for you only ({today}/{total}/{sumtotal))"
            "finds a big icecream for {nick} eat and you get for free (50$ to use toilet) ({today}/{total}/{sumtotal))"
            "dusts off something that look like icecream from the corner of fridge, here {nick} ({today}/{total}/{sumtotal))"
proc serveCommands::recordActivity {nick command} {
    set filename "${nick}.txt"
    set currentDate [clock format [clock seconds] -format "%Y-%m-%d"]
    set currentCount 0
    set totalCount 0
    set sumtotalFilename "sumtotal.db"
    if {[file exists $filename]} {
        set fileData [split [read [open $filename]] "\n"]
        foreach line $fileData {
            regexp {(.*) (\d+) (\d+)} $line _ date today total
            if {$date eq $currentDate} {
                set currentCount $today
            incr totalCount $total
    incr currentCount
    incr totalCount
    appendToFile $filename "${currentDate} ${currentCount} ${totalCount}"
    set sumtotal [lindex [readLines $sumtotalFilename] 0]
    incr sumtotal
    writeToFile $sumtotalFilename $sumtotal
    return [list $currentCount $totalCount $sumtotal]
bind pub - "!*" serveCommands::pubServe
proc serveCommands::pubServe {nick host hand chan text} {
    variable serve
    set command [string trimleft $text "!"]
    if {[dict exists $serve $command]} {
        set counts [recordActivity $nick $command]
        if {[string equal $command "bar"]} {
            putlog [dict get $serve $command]
        } else {
            set responseList [dict get $serve $command]
            set response [lindex $responseList [expr {int(rand() * [llength $responseList])}]]
            set response [subst -nocommands $response]
            putlog $response
proc serveCommands::appendToFile {filename data} {
    set fd [open $filename a]
    puts -nonewline $fd "$data\n"
    close $fd
proc serveCommands::writeToFile {filename data} {
    set fd [open $filename w]
    puts -nonewline $fd "$data\n"
    close $fd
proc serveCommands::readLines {filename} {
    if {[file exists $filename]} {
        return [split [read [open $filename]] "\n"]
    } else {
        return [list]

This code was generated by Generative Pre-trained Transformer Razz
Retrouvez les dernières modifications de mes scripts TCL (versions Alpha/Bêta) ainsi que d'autres de mes réalisations sur ma page GitHub et les versions stables dans la section scripts de ce site  8-)
Supprimé du fil de discussion initial: test amusant mais totalement inexploitable qui risque de perdre l'utilisateur
zeolia: tchat gratuit, sans inscription ni publicité
Merci de ne pas demander d'aide en MP

Forum Jump:

Users browsing this thread: 1 Guest(s)