updating art and stuff

This commit is contained in:
freqy 2021-03-27 02:49:29 -07:00
förälder eb5d1f1df0
incheckning f149c4e750
3 ändrade filer med 101 tillägg och 30 borttagningar

8
go.mod Normal file
Visa fil

@ -0,0 +1,8 @@
module git.tcp.direct/freqy/blvck-hat-go-RAT
go 1.16
require (
github.com/fatih/color v1.10.0
github.com/patrickmn/go-cache v2.1.0+incompatible
)

11
go.sum Normal file
Visa fil

@ -0,0 +1,11 @@
github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg=
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=

Visa fil

@ -1,40 +1,43 @@
package main
import (
"time"
"fmt"
"strconv"
"time"
"github.com/fatih/color"
cache "github.com/patrickmn/go-cache"
)
//Patrons sets caches for the various user vices
type Patrons struct {
// alcohol
Drunks *cache.Cache
Drunks *cache.Cache
// weed
Trees *cache.Cache
Trees *cache.Cache
// uppers
Sonics *cache.Cache
Sonics *cache.Cache
// opis
Junkies *cache.Cache
Junkies *cache.Cache
// empathogens
Ravers *cache.Cache
Ravers *cache.Cache
// psychedelics
Trippers *cache.Cache
Trippers *cache.Cache
}
var p *Patrons
//init the go-cache expiration times for each vice
func init() {
p = &Patrons{
Drunks: cache.New(240*time.Minute, cache.DefaultExpiration),
Trees: cache.New(60*time.Minute, cache.DefaultExpiration),
Sonics: cache.New(45*time.Minute, cache.DefaultExpiration),
Junkies: cache.New(120*time.Minute, cache.DefaultExpiration),
Drunks: cache.New(240*time.Minute, cache.DefaultExpiration),
Trees: cache.New(60*time.Minute, cache.DefaultExpiration),
Sonics: cache.New(45*time.Minute, cache.DefaultExpiration),
Junkies: cache.New(120*time.Minute, cache.DefaultExpiration),
Trippers: cache.New(240*time.Minute, cache.DefaultExpiration),
}
}
/*
func soSober(nick string){
Patrons.Set(nick, 1, cache.NoExpiration)
@ -43,29 +46,29 @@ Patrons.Set(nick, 1, cache.NoExpiration)
}
*/
// takes the user nick and user vice aka "poison" outputs int val
func (p *Patrons) getFaded(nick string, poison string) int {
// var count int
// var faded bool = false
// var count int
// var faded bool = false
var target *cache.Cache
switch poison {
case "drink":
target = p.Drunks
case "smoke":
target = p.Trees
case "speed":
target = p.Sonics
case "nod":
target = p.Junkies
case "trip":
target = p.Trippers
default:
fmt.Println("Wtf?!")
panic("!??!!?!?")
case "drink":
target = p.Drunks
case "smoke":
target = p.Trees
case "speed":
target = p.Sonics
case "nod":
target = p.Junkies
case "trip":
target = p.Trippers
default:
fmt.Println("Wtf?!")
panic("!??!!?!?")
}
cacheresult, faded := target.Get(nick)
if !faded {
@ -76,12 +79,61 @@ func (p *Patrons) getFaded(nick string, poison string) int {
count := cacheresult.(int)
endresult, err := target.IncrementInt(nick, count)
if err != nil { panic("you're fucked bud") }
if err != nil {
panic("you're fucked bud")
}
return endresult
}
func art(poison string) string {
switch poison {
default:
fmt.Printf("┎┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┒\n")
fmt.Printf("┋this\n")
fmt.Printf("┋this\n")
fmt.Printf("┋this\n")
fmt.Printf("┖┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┚\n")
case "drink":
color.Red("┎┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┒\n")
fmt.Printf("┋this\n")
fmt.Printf("┋this\n")
fmt.Printf("┋this\n")
fmt.Printf("┖┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┚\n")
case "smoke":
color.Red("┎┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┒\n")
color.Red("┋ ``; \n")
color.Red("┋ ◀ ▓▓▓▓▓▓▒░\n")
color.Red("┋this\n")
color.Red("┖┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┚\n")
case "speed":
fmt.Printf("┎┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┒\n")
fmt.Printf("┋this\n")
fmt.Printf("┋this\n")
fmt.Printf("┋this\n")
fmt.Printf("┖┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┚\n")
case "nod":
fmt.Printf("┎┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┒\n")
fmt.Printf("┋this\n")
fmt.Printf("┋this\n")
fmt.Printf("┋this\n")
fmt.Printf("┖┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┚\n")
case "trip":
fmt.Printf("┎┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┒\n")
fmt.Printf("┋this\n")
fmt.Printf("┋this\n")
fmt.Printf("┋this\n")
fmt.Printf("┖┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┚\n")
}
return "nil"
}
func main() {
var howmanybeers int
@ -91,5 +143,5 @@ func main() {
fmt.Println("another round pls")
howmanybeers = p.getFaded("bob", "drink")
fmt.Println("bob has drank " + strconv.Itoa(howmanybeers) + "brews")
art("smoke")
}