Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var OnlyIf = SimpleRegexpCommand{
- Tag: "onlyIf",
- Regex: `\$onlyIf\[.*?]`,
- Function: func(msg *string, command *string, info *MessageInfo, src *SimpleRegexpCommand) (pauseExecution bool) {
- val := strings.Split((*command)[8:len(*command)-1], ";")
- if len(val) != 2 {
- if !info.IgnoreErr {
- _, _ = info.Session.ChannelMessageSend(info.Message.ChannelID, "❌ Wrong number of arguments!")
- }
- return true
- }
- val[1] = strings.TrimSpace(val[1])
- if strings.Contains(val[0], "==") {
- toCompare := strings.Split(val[0], "==")
- if len(toCompare) != 2 {
- if !info.IgnoreErr {
- _, _ = info.Session.ChannelMessageSend(info.Message.ChannelID, "❌ Wrong number of arguments!")
- }
- return true
- }
- if toCompare[0] != toCompare[1] {
- if val[1] != "" {
- _, _ = info.Session.ChannelMessageSend(info.Channel, val[1])
- }
- return true
- }
- } else if strings.Contains(val[0], ">") {
- toCompare := strings.Split(val[0], ">")
- if len(toCompare) != 2 {
- if !info.IgnoreErr {
- _, _ = info.Session.ChannelMessageSend(info.Message.ChannelID, "❌ Wrong number of arguments!")
- }
- return true
- }
- if toCompare[0] <= toCompare[1] {
- if val[1] != "" {
- _, _ = info.Session.ChannelMessageSend(info.Channel, val[1])
- }
- return true
- }
- } else if strings.Contains(val[0], "<") {
- toCompare := strings.Split(val[0], "<")
- if len(toCompare) != 2 {
- if !info.IgnoreErr {
- _, _ = info.Session.ChannelMessageSend(info.Message.ChannelID, "❌ Wrong number of arguments!")
- }
- return true
- }
- if toCompare[0] >= toCompare[1] {
- if val[1] != "" {
- _, _ = info.Session.ChannelMessageSend(info.Channel, val[1])
- }
- return true
- }
- }
- return false
- },
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement