adjust user and command level values

This commit is contained in:
lyx0 2023-10-11 21:35:47 +02:00
parent 65837b55ce
commit ee15ec9c1b
2 changed files with 50 additions and 43 deletions

View file

@ -182,37 +182,72 @@ func (app *application) handleCommand(message twitch.PrivateMessage) {
}
// --------------------------------
// 250 user level
// 100 user level
// trusted
// vip
// --------------------------------
case "debug":
switch cmdParams[1] {
case "user":
if userLevel >= 250 {
if userLevel >= 100 {
app.DebugUser(cmdParams[2], message)
}
case "command":
if userLevel >= 250 {
if userLevel >= 100 {
app.DebugCommand(cmdParams[2], message)
}
}
// --------------------------------
// 250 user level
// twitch mod/broadcaster
// --------------------------------
// empty for now
// --------------------------------
// 420 user level
// dank
// --------------------------------
case "catbox":
if userLevel >= 420 {
go app.NewDownload("catbox", target, cmdParams[1], message)
}
case "kappa":
if userLevel >= 420 {
go app.NewDownload("kappa", target, cmdParams[1], message)
}
case "yaf":
if userLevel >= 420 {
go app.NewDownload("yaf", target, cmdParams[1], message)
}
case "gofile":
if userLevel >= 420 {
go app.NewDownload("gofile", target, cmdParams[1], message)
}
//----------------------------------
// 500 User Level
// trusted
//---------------------------------
case "timer":
switch cmdParams[1] {
case "add":
if userLevel >= 250 {
if userLevel >= 500 {
app.AddTimer(cmdParams[2], cmdParams[3], message)
}
case "edit":
if userLevel >= 250 {
if userLevel >= 500 {
app.EditTimer(cmdParams[2], cmdParams[3], message)
}
case "delete":
if userLevel >= 250 {
if userLevel >= 500 {
app.DeleteTimer(cmdParams[2], message)
}
case "list":
if userLevel >= 250 {
if userLevel >= 500 {
reply = app.ListTimers()
}
}
@ -220,51 +255,29 @@ func (app *application) handleCommand(message twitch.PrivateMessage) {
case "command":
switch cmdParams[1] {
case "add":
if userLevel >= 250 {
if userLevel >= 500 {
app.AddCommand(cmdParams[2], message)
}
case "delete":
if userLevel >= 250 {
if userLevel >= 500 {
app.DeleteCommand(cmdParams[2], message)
}
case "edit":
switch cmdParams[2] {
case "level":
if userLevel >= 250 {
if userLevel >= 500 {
app.EditCommandLevel(cmdParams[3], cmdParams[4], message)
}
case "category":
if userLevel >= 250 {
if userLevel >= 500 {
app.EditCommandCategory(cmdParams[3], cmdParams[4], message)
}
}
}
//----------------------------------
// 500 User Level
//---------------------------------
case "catbox":
if userLevel >= 500 {
go app.NewDownload("catbox", target, cmdParams[1], message)
}
case "kappa":
if userLevel >= 500 {
go app.NewDownload("kappa", target, cmdParams[1], message)
}
case "yaf":
if userLevel >= 500 {
go app.NewDownload("yaf", target, cmdParams[1], message)
}
case "gofile":
if userLevel >= 500 {
go app.NewDownload("gofile", target, cmdParams[1], message)
}
//------------------------------------
// 1000 User Level
// Admin
//------------------------------------
case "join":
if userLevel >= 1000 {

View file

@ -146,24 +146,18 @@ func (app *application) GetUserLevel(msg twitch.PrivateMessage) int {
}
if msg.User.Badges["moderator"] == 1 ||
msg.User.Badges["broadcaster"] == 1 {
twitchUserLevel = 500
} else if msg.User.Badges["vip"] == 1 {
twitchUserLevel = 250
} else if msg.User.Badges["vip"] == 1 {
twitchUserLevel = 100
} else {
twitchUserLevel = 0
}
app.Log.Infow("Userlevel:",
"dbUserLevel", dbUserLevel,
"twitchUserLevel", twitchUserLevel,
)
if dbUserLevel > twitchUserLevel {
return dbUserLevel
} else {
return twitchUserLevel
}
}
func (app *application) UserCheckWeather(message twitch.PrivateMessage) {