mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
fix out of bounds crash for meme and conv command
This commit is contained in:
parent
003addc2d8
commit
e9c9118321
1 changed files with 18 additions and 10 deletions
|
@ -227,16 +227,6 @@ func (app *application) handleCommand(message twitch.PrivateMessage) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
case "conv":
|
|
||||||
if userLevel >= 100 {
|
|
||||||
app.ConvertToMP4(cmdParams[1], message)
|
|
||||||
}
|
|
||||||
|
|
||||||
case "meme":
|
|
||||||
if userLevel >= 100 {
|
|
||||||
app.ConvertAndSave(cmdParams[1], cmdParams[2], message)
|
|
||||||
}
|
|
||||||
|
|
||||||
case "set":
|
case "set":
|
||||||
switch cmdParams[1] {
|
switch cmdParams[1] {
|
||||||
case "lastfm":
|
case "lastfm":
|
||||||
|
@ -380,6 +370,24 @@ func (app *application) handleCommand(message twitch.PrivateMessage) {
|
||||||
// 1000 User Level
|
// 1000 User Level
|
||||||
// Admin
|
// Admin
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
|
case "conv":
|
||||||
|
if userLevel >= 1000 {
|
||||||
|
if msgLen > 1 {
|
||||||
|
reply = "Not enough arguments provided"
|
||||||
|
} else if msgLen == 2 {
|
||||||
|
app.ConvertToMP4(cmdParams[1], message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
case "meme":
|
||||||
|
if userLevel < 1000 { // Unauthorized
|
||||||
|
return
|
||||||
|
} else if userLevel >= 1000 && msgLen <= 2 { // Authorized but not enough args.
|
||||||
|
reply = "Not enough arguments provided."
|
||||||
|
} else if userLevel >= 1000 && msgLen >= 3 {
|
||||||
|
app.ConvertAndSave(cmdParams[1], cmdParams[2], message)
|
||||||
|
}
|
||||||
|
|
||||||
case "say":
|
case "say":
|
||||||
if userLevel >= 1000 {
|
if userLevel >= 1000 {
|
||||||
reply = message.Message[6:len(message.Message)]
|
reply = message.Message[6:len(message.Message)]
|
||||||
|
|
Loading…
Reference in a new issue