mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
cleanup commands
This commit is contained in:
parent
704a6a9470
commit
f9b94de757
1 changed files with 206 additions and 150 deletions
|
@ -62,6 +62,187 @@ func (app *Application) handleCommand(message twitch.PrivateMessage) {
|
||||||
common.Send(target, "xd", app.TwitchClient)
|
common.Send(target, "xd", app.TwitchClient)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ()bttv <emote name>
|
||||||
|
case "bttv":
|
||||||
|
if msgLen < 2 {
|
||||||
|
common.Send(target, "Not enough arguments provided. Usage: ()bttv <emote name>", app.TwitchClient)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
commands.Bttv(target, cmdParams[1], app.TwitchClient)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Coinflip
|
||||||
|
case "coin":
|
||||||
|
commands.Coinflip(target, app.TwitchClient)
|
||||||
|
return
|
||||||
|
case "coinflip":
|
||||||
|
commands.Coinflip(target, app.TwitchClient)
|
||||||
|
return
|
||||||
|
case "cf":
|
||||||
|
commands.Coinflip(target, app.TwitchClient)
|
||||||
|
return
|
||||||
|
|
||||||
|
// ()currency <amount> <input currency> to <output currency>
|
||||||
|
case "currency":
|
||||||
|
if msgLen < 4 {
|
||||||
|
common.Send(target, "Not enough arguments provided. Usage: ()currency 10 USD to EUR", app.TwitchClient)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
commands.Currency(target, cmdParams[1], cmdParams[2], cmdParams[4], app.TwitchClient)
|
||||||
|
return
|
||||||
|
|
||||||
|
// ()ffz <emote name>
|
||||||
|
case "ffz":
|
||||||
|
if msgLen < 2 {
|
||||||
|
common.Send(target, "Not enough arguments provided. Usage: ()ffz <emote name>", app.TwitchClient)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
commands.Ffz(target, cmdParams[1], app.TwitchClient)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ()followage <channel> <username>
|
||||||
|
case "followage":
|
||||||
|
if msgLen == 1 { // ()followage
|
||||||
|
commands.Followage(target, target, message.User.Name, app.TwitchClient)
|
||||||
|
return
|
||||||
|
} else if msgLen == 2 { // ()followage forsen
|
||||||
|
commands.Followage(target, target, cmdParams[1], app.TwitchClient)
|
||||||
|
return
|
||||||
|
} else { // ()followage forsen pajlada
|
||||||
|
commands.Followage(target, cmdParams[1], cmdParams[2], app.TwitchClient)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// First Line
|
||||||
|
// ()firstline <channel> <username>
|
||||||
|
case "firstline":
|
||||||
|
if msgLen == 1 {
|
||||||
|
common.Send(target, "Usage: ()firstline <channel> <user>", app.TwitchClient)
|
||||||
|
return
|
||||||
|
} else if msgLen == 2 {
|
||||||
|
commands.FirstLine(target, target, cmdParams[1], app.TwitchClient)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
commands.FirstLine(target, cmdParams[1], cmdParams[2], app.TwitchClient)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// ()fl <channel> <username>
|
||||||
|
case "fl":
|
||||||
|
if msgLen == 1 {
|
||||||
|
common.Send(target, "Usage: ()firstline <channel> <user>", app.TwitchClient)
|
||||||
|
return
|
||||||
|
} else if msgLen == 2 {
|
||||||
|
commands.FirstLine(target, target, cmdParams[1], app.TwitchClient)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
commands.FirstLine(target, cmdParams[1], cmdParams[2], app.TwitchClient)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
case "ping":
|
||||||
|
commands.Ping(target, app.TwitchClient)
|
||||||
|
return
|
||||||
|
|
||||||
|
// Thumbnail
|
||||||
|
// ()preview <live channel>
|
||||||
|
case "preview":
|
||||||
|
if msgLen < 2 {
|
||||||
|
common.Send(target, "Not enough arguments provided. Usage: ()preview <username>", app.TwitchClient)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
commands.Preview(target, cmdParams[1], app.TwitchClient)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// ()thumbnail <live channel>
|
||||||
|
case "thumbnail":
|
||||||
|
if msgLen < 2 {
|
||||||
|
common.Send(target, "Not enough arguments provided. Usage: ()thumbnail <username>", app.TwitchClient)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
commands.Preview(target, cmdParams[1], app.TwitchClient)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// SevenTV
|
||||||
|
// ()seventv <emote name>
|
||||||
|
case "seventv":
|
||||||
|
if msgLen < 2 {
|
||||||
|
common.Send(target, "Not enough arguments provided. Usage: ()seventv <emote name>", app.TwitchClient)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
commands.Seventv(target, cmdParams[1], app.TwitchClient)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// ()7tv <emote name>
|
||||||
|
case "7tv":
|
||||||
|
if msgLen < 2 {
|
||||||
|
common.Send(target, "Not enough arguments provided. Usage: ()seventv <emote name>", app.TwitchClient)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
commands.Seventv(target, cmdParams[1], app.TwitchClient)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ()tweet <username>
|
||||||
|
case "tweet":
|
||||||
|
if msgLen < 2 {
|
||||||
|
common.Send(target, "Not enough arguments provided. Usage: ()tweet <username>", app.TwitchClient)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
commands.Tweet(target, cmdParams[1], app.TwitchClient)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Xkcd
|
||||||
|
case "rxkcd":
|
||||||
|
commands.RandomXkcd(target, app.TwitchClient)
|
||||||
|
return
|
||||||
|
case "randomxkcd":
|
||||||
|
commands.RandomXkcd(target, app.TwitchClient)
|
||||||
|
return
|
||||||
|
case "xkcd":
|
||||||
|
commands.Xkcd(target, app.TwitchClient)
|
||||||
|
return
|
||||||
|
|
||||||
|
// Commands with permission level or database from here on
|
||||||
|
|
||||||
|
//#################
|
||||||
|
// 250 - VIP only
|
||||||
|
//#################
|
||||||
|
case "debug":
|
||||||
|
if userLevel < 250 {
|
||||||
|
return
|
||||||
|
} else if msgLen < 3 {
|
||||||
|
common.Send(target, "Not enough arguments provided.", app.TwitchClient)
|
||||||
|
return
|
||||||
|
} else if cmdParams[1] == "user" {
|
||||||
|
app.DebugUser(cmdParams[2], message)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
case "echo":
|
||||||
|
if userLevel < 250 { // Limit to myself for now.
|
||||||
|
return
|
||||||
|
} else if msgLen < 2 {
|
||||||
|
common.Send(target, "Not enough arguments provided.", app.TwitchClient)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
commands.Echo(target, message.Message[7:len(message.Message)], app.TwitchClient)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//###################
|
||||||
|
// 1000- Admin only
|
||||||
|
//###################
|
||||||
|
|
||||||
|
// #####
|
||||||
|
// Add
|
||||||
|
// #####
|
||||||
case "addchannel":
|
case "addchannel":
|
||||||
if userLevel < 1000 { // Limit to myself for now.
|
if userLevel < 1000 { // Limit to myself for now.
|
||||||
return
|
return
|
||||||
|
@ -95,6 +276,10 @@ func (app *Application) handleCommand(message twitch.PrivateMessage) {
|
||||||
app.AddUser(cmdParams[1], cmdParams[2], message)
|
app.AddUser(cmdParams[1], cmdParams[2], message)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ######
|
||||||
|
// Edit
|
||||||
|
// ######
|
||||||
case "edituser": // ()edituser level nourylul 1000
|
case "edituser": // ()edituser level nourylul 1000
|
||||||
if userLevel < 1000 { // Limit to myself for now.
|
if userLevel < 1000 { // Limit to myself for now.
|
||||||
return
|
return
|
||||||
|
@ -119,18 +304,9 @@ func (app *Application) handleCommand(message twitch.PrivateMessage) {
|
||||||
} else {
|
} else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case "debug":
|
// ########
|
||||||
if userLevel < 1000 { // Limit to myself for now.
|
// Delete
|
||||||
return
|
// ########
|
||||||
} else if msgLen < 3 {
|
|
||||||
common.Send(target, "Not enough arguments provided.", app.TwitchClient)
|
|
||||||
return
|
|
||||||
} else if cmdParams[1] == "user" {
|
|
||||||
app.DebugUser(cmdParams[2], message)
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
case "deletechannel":
|
case "deletechannel":
|
||||||
if userLevel < 1000 { // Limit to myself for now.
|
if userLevel < 1000 { // Limit to myself for now.
|
||||||
return
|
return
|
||||||
|
@ -138,10 +314,21 @@ func (app *Application) handleCommand(message twitch.PrivateMessage) {
|
||||||
common.Send(target, "Not enough arguments provided.", app.TwitchClient)
|
common.Send(target, "Not enough arguments provided.", app.TwitchClient)
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
// ()addchannel noemience
|
// ()deletechannel noemience
|
||||||
app.DeleteChannel(cmdParams[1], message)
|
app.DeleteChannel(cmdParams[1], message)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
case "deletecommand":
|
||||||
|
if userLevel < 1000 { // Limit to myself for now.
|
||||||
|
return
|
||||||
|
} else if msgLen < 2 {
|
||||||
|
common.Send(target, "Not enough arguments provided.", app.TwitchClient)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
// ()deletechannel noemience
|
||||||
|
app.DeleteCommand(cmdParams[1], message)
|
||||||
|
return
|
||||||
|
}
|
||||||
case "deleteuser":
|
case "deleteuser":
|
||||||
if userLevel < 1000 { // Limit to myself for now.
|
if userLevel < 1000 { // Limit to myself for now.
|
||||||
return
|
return
|
||||||
|
@ -153,159 +340,28 @@ func (app *Application) handleCommand(message twitch.PrivateMessage) {
|
||||||
app.DeleteUser(cmdParams[1], message)
|
app.DeleteUser(cmdParams[1], message)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case "bttv":
|
|
||||||
if msgLen < 2 {
|
|
||||||
common.Send(target, "Not enough arguments provided. Usage: ()bttv <emote name>", app.TwitchClient)
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
commands.Bttv(target, cmdParams[1], app.TwitchClient)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
case "bttvemotes": // Pretty spammy command so it's limited to my own channel until elevated messages are implemented.
|
case "bttvemotes": // Pretty spammy command so it's limited to my own channel until elevated messages are implemented.
|
||||||
if target == "nourylul" || target == "nourybot" {
|
if userLevel < 1000 {
|
||||||
commands.Bttvemotes(target, app.TwitchClient)
|
commands.Bttvemotes(target, app.TwitchClient)
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case "coin":
|
|
||||||
commands.Coinflip(target, app.TwitchClient)
|
|
||||||
return
|
|
||||||
case "coinflip":
|
|
||||||
commands.Coinflip(target, app.TwitchClient)
|
|
||||||
return
|
|
||||||
case "cf":
|
|
||||||
commands.Coinflip(target, app.TwitchClient)
|
|
||||||
return
|
|
||||||
case "currency":
|
|
||||||
if msgLen < 4 {
|
|
||||||
common.Send(target, "Not enough arguments provided. Usage: ()currency 10 USD to EUR", app.TwitchClient)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
commands.Currency(target, cmdParams[1], cmdParams[2], cmdParams[4], app.TwitchClient)
|
|
||||||
return
|
|
||||||
case "echo":
|
|
||||||
if userLevel < 1000 { // Limit to myself for now.
|
|
||||||
return
|
|
||||||
} else if msgLen < 2 {
|
|
||||||
common.Send(target, "Not enough arguments provided.", app.TwitchClient)
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
commands.Echo(target, message.Message[7:len(message.Message)], app.TwitchClient)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
case "ffz":
|
|
||||||
if msgLen < 2 {
|
|
||||||
common.Send(target, "Not enough arguments provided. Usage: ()ffz <emote name>", app.TwitchClient)
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
commands.Ffz(target, cmdParams[1], app.TwitchClient)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
case "ffzemotes": // Pretty spammy command so it's limited to my own channel until elevated messages are implemented.
|
case "ffzemotes": // Pretty spammy command so it's limited to my own channel until elevated messages are implemented.
|
||||||
if target == "nourylul" || target == "nourybot" {
|
if userLevel < 1000 {
|
||||||
commands.Ffzemotes(target, app.TwitchClient)
|
commands.Ffzemotes(target, app.TwitchClient)
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Followage
|
// ##################
|
||||||
// ()followage channel username
|
// Database Command
|
||||||
case "followage":
|
|
||||||
if msgLen == 1 { // ()followage
|
|
||||||
commands.Followage(target, target, message.User.Name, app.TwitchClient)
|
|
||||||
return
|
|
||||||
} else if msgLen == 2 { // ()followage forsen
|
|
||||||
commands.Followage(target, target, cmdParams[1], app.TwitchClient)
|
|
||||||
return
|
|
||||||
} else { // ()followage forsen pajlada
|
|
||||||
commands.Followage(target, cmdParams[1], cmdParams[2], app.TwitchClient)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// First Line
|
|
||||||
case "firstline":
|
|
||||||
if msgLen == 1 {
|
|
||||||
common.Send(target, "Usage: ()firstline <channel> <user>", app.TwitchClient)
|
|
||||||
return
|
|
||||||
} else if msgLen == 2 {
|
|
||||||
commands.FirstLine(target, target, cmdParams[1], app.TwitchClient)
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
commands.FirstLine(target, cmdParams[1], cmdParams[2], app.TwitchClient)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
case "fl":
|
|
||||||
if msgLen == 1 {
|
|
||||||
common.Send(target, "Usage: ()firstline <channel> <user>", app.TwitchClient)
|
|
||||||
return
|
|
||||||
} else if msgLen == 2 {
|
|
||||||
commands.FirstLine(target, target, cmdParams[1], app.TwitchClient)
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
commands.FirstLine(target, cmdParams[1], cmdParams[2], app.TwitchClient)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
case "ping":
|
|
||||||
commands.Ping(target, app.TwitchClient)
|
|
||||||
return
|
|
||||||
case "preview":
|
|
||||||
if msgLen < 2 {
|
|
||||||
common.Send(target, "Not enough arguments provided. Usage: ()preview <username>", app.TwitchClient)
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
commands.Preview(target, cmdParams[1], app.TwitchClient)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
case "thumbnail":
|
|
||||||
if msgLen < 2 {
|
|
||||||
common.Send(target, "Not enough arguments provided. Usage: ()thumbnail <username>", app.TwitchClient)
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
commands.Preview(target, cmdParams[1], app.TwitchClient)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// SevenTV
|
|
||||||
case "seventv":
|
|
||||||
if msgLen < 2 {
|
|
||||||
common.Send(target, "Not enough arguments provided. Usage: ()seventv <emote name>", app.TwitchClient)
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
commands.Seventv(target, cmdParams[1], app.TwitchClient)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
case "7tv":
|
|
||||||
if msgLen < 2 {
|
|
||||||
common.Send(target, "Not enough arguments provided. Usage: ()seventv <emote name>", app.TwitchClient)
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
commands.Seventv(target, cmdParams[1], app.TwitchClient)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
case "tweet":
|
|
||||||
if msgLen < 2 {
|
|
||||||
common.Send(target, "Not enough arguments provided. Usage: ()tweet <username>", app.TwitchClient)
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
commands.Tweet(target, cmdParams[1], app.TwitchClient)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
case "rxkcd":
|
|
||||||
commands.RandomXkcd(target, app.TwitchClient)
|
|
||||||
return
|
|
||||||
case "randomxkcd":
|
|
||||||
commands.RandomXkcd(target, app.TwitchClient)
|
|
||||||
return
|
|
||||||
case "xkcd":
|
|
||||||
commands.Xkcd(target, app.TwitchClient)
|
|
||||||
return
|
|
||||||
|
|
||||||
// Check if the commandName exists as the "name" of a command in the database.
|
// Check if the commandName exists as the "name" of a command in the database.
|
||||||
// if it doesnt then ignore it.
|
// if it doesnt then ignore it.
|
||||||
|
// ##################
|
||||||
default:
|
default:
|
||||||
reply, err := app.GetCommand(commandName, message.User.Name)
|
reply, err := app.GetCommand(commandName, message.User.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue