Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. var OnlyIf = SimpleRegexpCommand{
  2. Tag: "onlyIf",
  3. Regex: `\$onlyIf\[.*?]`,
  4. Function: func(msg *string, command *string, info *MessageInfo, src *SimpleRegexpCommand) (pauseExecution bool) {
  5. val := strings.Split((*command)[8:len(*command)-1], ";")
  6. if len(val) != 2 {
  7. if !info.IgnoreErr {
  8. _, _ = info.Session.ChannelMessageSend(info.Message.ChannelID, "❌ Wrong number of arguments!")
  9. }
  10. return true
  11. }
  12.  
  13. val[1] = strings.TrimSpace(val[1])
  14.  
  15. if strings.Contains(val[0], "==") {
  16. toCompare := strings.Split(val[0], "==")
  17. if len(toCompare) != 2 {
  18. if !info.IgnoreErr {
  19. _, _ = info.Session.ChannelMessageSend(info.Message.ChannelID, "❌ Wrong number of arguments!")
  20. }
  21. return true
  22. }
  23.  
  24. if toCompare[0] != toCompare[1] {
  25. if val[1] != "" {
  26. _, _ = info.Session.ChannelMessageSend(info.Channel, val[1])
  27. }
  28.  
  29. return true
  30. }
  31. } else if strings.Contains(val[0], ">") {
  32. toCompare := strings.Split(val[0], ">")
  33. if len(toCompare) != 2 {
  34. if !info.IgnoreErr {
  35. _, _ = info.Session.ChannelMessageSend(info.Message.ChannelID, "❌ Wrong number of arguments!")
  36. }
  37. return true
  38. }
  39.  
  40. if toCompare[0] <= toCompare[1] {
  41. if val[1] != "" {
  42. _, _ = info.Session.ChannelMessageSend(info.Channel, val[1])
  43. }
  44.  
  45. return true
  46. }
  47. } else if strings.Contains(val[0], "<") {
  48. toCompare := strings.Split(val[0], "<")
  49. if len(toCompare) != 2 {
  50. if !info.IgnoreErr {
  51. _, _ = info.Session.ChannelMessageSend(info.Message.ChannelID, "❌ Wrong number of arguments!")
  52. }
  53. return true
  54. }
  55.  
  56. if toCompare[0] >= toCompare[1] {
  57. if val[1] != "" {
  58. _, _ = info.Session.ChannelMessageSend(info.Channel, val[1])
  59. }
  60.  
  61. return true
  62. }
  63. }
  64.  
  65. return false
  66. },
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement