Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. loadNotifications(type) {
  2. global userID
  3. global token
  4. global oldPosts
  5. global loadCount
  6. result := URLDownloadToVar("https://lyd-roleplay.de/" . type . "/?at=" . userID . "-" . token)
  7. if (result == "ERROR_CONNECTION")
  8. return
  9. try {
  10. xmlDoc := new xml(result)
  11. items := xmlDoc.getChildren("//rss/channel")
  12. newPosts := []
  13. for index, item in items {
  14. if (newPosts.Length() >= loadCount) {
  15. break
  16. } else {
  17. if (item.nodeName == "item") {
  18. post := []
  19. children := xmlDoc.getChildren(item)
  20. for i, child in children {
  21. name := child.nodeName
  22. if (name == "title" || name == "dc:creator" || name == "slash:comments" || name == "category" || name == "description" || name == "pubDate") {
  23. post[name] := child.text
  24. }
  25. }
  26. newPosts.Push(post)
  27. }
  28. }
  29. }
  30. equal := true
  31. if (newPosts.Length() == oldPosts[type].Length()) {
  32. for index, post in newPosts {
  33. contained := false
  34. Loop, %loadCount%
  35. {
  36. i := loadCount + 1 - A_Index
  37. if (post["title"] == oldPosts[type][i]["title"] && post["dc:creator"] == oldPosts[type][i]["dc:creator"] && post["slash:comments"] == oldPosts[type][i]["slash:comments"] && post["pubDate"] == oldPosts[type][i]["pubDate"]) {
  38. contained := true
  39. }
  40. }
  41. if (!contained) {
  42. if (type == "forum/board-feed") {
  43. SendClientMessage(PREFIX . "Neuer Beitrag von " . SECCOL . post["dc:creator"] . " {FFFFFF}im Thread " . SECCOL . post["title"])
  44. } else if (type == "conversation-feed") {
  45. SendClientMessage(PREFIX . "Neue Konversationen von " . SECCOL . post["dc:creator"] . " {FFFFFF}mit dem Betreff: " . SECCOL . post["title"])
  46. } else if (type == "notification-feed") {
  47. if (post["category"] == "com.woltlab.wbb.post") {
  48. RegExMatch(post["description"], "(.+) auf das Thema <a href=""(\S+)"">(.+)<\/a> geantwortet\.", description_)
  49. if (RegExMatch(post["title"], "(\d+) neue Beiträge in abonniertem Thema", title_)) {
  50. SendClientMessage(PREFIX . "Du hast " . SECCOL . title_1 . " {FFFFFF}neue Beiträge im Thema " . SECCOL . description_3 . "{FFFFFF}.")
  51. } else if (RegExMatch(post["title"], "Du wurdest zitiert")) {
  52. RegExMatch(post["description"], "(.+) hat dich im Thema <a href=""(\S+)"">(.+)<\/a> zitiert\.", description_)
  53. SendClientMessage(PREFIX . SECCOL . post["dc:creator"] . " {FFFFFF}hat dich im Thema " . SECCOL . description_3 . " {FFFFFF}zitiert.")
  54. } else if (RegExMatch(post["title"], "Du wurdest erwähnt")) {
  55. RegExMatch(post["description"], "(.+) hat dich im Thema <a href=""(\S+)"">(.+)<\/a> erwähnt\.", description_)
  56. SendClientMessage(PREFIX . SECCOL . post["dc:creator"] . " {FFFFFF}hat dich im Thema " . SECCOL . description_3 . " {FFFFFF}erwähnt.")
  57. } else {
  58. SendClientMessage(PREFIX . SECCOL . post["dc:creator"] . " {FFFFFF}hat auf das Thema " . SECCOL . description_3 . " {FFFFFF}geantwortet.")
  59. }
  60. } else if (post["category"] == "com.woltlab.wcf.user.follow") {
  61. SendClientMessage(PREFIX . SECCOL . post["dc:creator"] . " {FFFFFF}folgt dir nun.")
  62. } else if (post["category"] == "com.woltlab.wbb.thread") {
  63. RegExMatch(post["description"], "(.+) hat das Thema <a href=""(\S+)"">(.+)<\/a> im Forum <a href=""(\S+)"">(.+)<\/a> erstellt\.", description_)
  64. SendClientMessage(PREFIX . SECCOL . post["dc:creator"] . " {FFFFFF}hat das Thema " . SECCOL . description_3 . " {FFFFFF}im Forum " . SECCOL . description_5 . " {FFFFFF}erstellt.")
  65. } else if (post["category"] == "com.woltlab.wbb.likeablePost.notification") {
  66. RegExMatch(post["description"], "(.+) gefällt dein Beitrag im Thema <a href=""(\S+)"">(.+)<\/a>\.", description_)
  67. if (RegExMatch(post["title"], "(\d+) Benutzern gefällt dein Beitrag", title_)) {
  68. SendClientMessage(PREFIX . SECCOL . title_1 . " {FFFFFF}Benutzern gefällt dein Beitrag im Thema " . SECCOL . description_3 . "{FFFFFF}.")
  69. } else {
  70. SendClientMessage(PREFIX . SECCOL . post["dc:creator"] . " {FFFFFF}gefällt dein Beitrag im Thema " . SECCOL . description_3 . "{FFFFFF}.")
  71. }
  72. } else if (post["category"] == "com.woltlab.wcf.conversation.notification") {
  73. RegExMatch(post["description"], "(.+) hat die Konversation <a href=""(\S+)"">(.+)<\/a> gestartet\.", description_)
  74. SendClientMessage(PREFIX . SECCOL . post["dc:creator"] . " {FFFFFF}hat die Konversation " . SECCOL . description_3 . " {FFFFFF}gestartet.")
  75. } else if (post["category"] == "com.woltlab.wcf.conversation.message.notification") {
  76. RegExMatch(post["description"], "(.+) auf die Konversation <a href=""(\S+)"">(.+)<\/a> geantwortet\.", description_)
  77. if (RegExMatch(post["title"], "(\d+) Teilnehmer haben auf eine Konversation geantwortet", title_)) {
  78. SendClientMessage(PREFIX . SECCOL . title_1 . " {FFFFFF}Teilnehmer haben auf die Konversation " . SECCOL . description_3 . " {FFFFFF}geantwortet.")
  79. } else {
  80. SendClientMessage(PREFIX . SECCOL . post["dc:creator"] . " {FFFFFF}hat auf die Konversation " . SECCOL . description_3 . " {FFFFFF}geantwortet.")
  81. }
  82. } else if (post["category"] == "com.woltlab.wcf.user.profileComment.notification") {
  83. SendClientMessage(PREFIX . SECCOL . post["dc:creator"] . " {FFFFFF}hat einen Kommentar an deiner Pinnwand verfasst.")
  84. } else if (post["category"] == "com.woltlab.wcf.user.profileComment.response.notification") {
  85. wall := "??? "
  86. if (RegExMatch(post["description"], "(.+) hat eine Antwort zu deinem Kommentar an <a href=""(\S+)#wall"">(.+)<\/a> verfasst\.", description_)) {
  87. wall := "zu deinem Kommentar an deiner Pinnwand "
  88. } else if (RegExMatch(post["description"], "(.+) haben auf deinen Kommentar an <a href=""(\S+)#wall"">(.+)<\/a> geantwortet\.", description_)) {
  89. wall := "deinen Kommentar an deiner Pinnwand "
  90. } else if (RegExMatch(post["description"], "(.+) hat eine Antwort zu deinem Kommentar an der <a href=""(\S+)#wall"">Pinnwand von (.+)<\/a> verfasst\.", description_)) {
  91. wall := "zu deinem Kommentar an der Pinnwand von " . SECCOL . description_3 . " {FFFFFF}"
  92. } else if (RegExMatch(post["description"], "(.+) haben auf deinen Kommentar an der <a href=""(\S+)#wall"">Pinnwand von (.+)<\/a> geantwortet\.", description_)) {
  93. wall := "deinen Kommentar an der Pinnwand von " . SECCOL . description_3 . " {FFFFFF}"
  94. } else if (RegExMatch(post["description"], "(.+) hat eine Antwort zum Kommentar von <a href=""(.+)"">(.+)<\/a> an <a href=""(\S+)#wall"">(.+)<\/a> verfasst\.", description_)) {
  95. wall := "zum Kommentar von " . SECCOL . description_3 . " {FFFFFF}an deiner Pinnwand "
  96. } else if (RegExMatch(post["description"], "(.+) haben auf den Kommentar von <a href=""(.+)"">(.+)<\/a> an <a href=""(\S+)#wall"">(.+)<\/a> geantwortet\.", description_)) {
  97. wall := "den Kommentar von " . SECCOL . description_3 . " {FFFFFF}an deiner Pinnwand "
  98. }
  99. if (RegExMatch(post["title"], "(\d+) neue Antworten \(Pinnwand\)", title_)) {
  100. SendClientMessage(PREFIX . SECCOL . title_1 . " {FFFFFF}Benutzer haben auf " . wall . "geantwortet.")
  101. } else {
  102. SendClientMessage(PREFIX . SECCOL . post["dc:creator"] . " {FFFFFF}hat eine Antwort " . wall . "verfasst.")
  103. }
  104. } else if (post["category"] == "com.woltlab.wcf.user.profileComment.like.notification") {
  105. wall := "???"
  106. if (RegExMatch(post["description"], "(.+) gefällt dein Kommentar an <a href=""(\S+)#wall"">(.+)<\/a>\.", description_)) {
  107. wall := "deiner Pinnwand"
  108. } else if (RegExMatch(post["description"], "(.+) gefällt dein Kommentar an der <a href=""(\S+)#wall"">Pinnwand von (.+)<\/a>\.", description_)) {
  109. wall := "der Pinnwand von " . SECCOL . description_3 . "{FFFFFF}"
  110. }
  111. if (RegExMatch(post["title"], "(\d+) Benutzern gefällt dein Kommentar \(Pinnwand\)", title_)) {
  112. SendClientMessage(PREFIX . SECCOL . title_1 . " {FFFFFF}Benutzern gefällt dein Kommentar an " . wall . ".")
  113. } else {
  114. SendClientMessage(PREFIX . SECCOL . post["dc:creator"] . " {FFFFFF}gefällt dein Kommentar an " . wall . ".")
  115. }
  116. } else if (post["category"] == "com.woltlab.wcf.user.profileComment.response.like.notification") {
  117. wall := "???"
  118. if (RegExMatch(post["description"], "(.+) gefällt deine Antwort auf einen Kommentar an <a href=""(\S+)#wall"">(.+)<\/a>\.", description_)) {
  119. wall := "deiner Pinnwand"
  120. } else if (RegExMatch(post["description"], "(.+) gefällt deine Antwort auf einen Kommentar an der <a href=""(\S+)#wall"">Pinnwand von (.+)<\/a>\.", description_)) {
  121. wall := "der Pinnwand von " . SECCOL . description_3 . "{FFFFFF}"
  122. }
  123. if (RegExMatch(post["title"], "(\d+) Benutzern (.+) Antwort auf einen Kommentar \(Pinnwand\)", title_)) {
  124. SendClientMessage(PREFIX . SECCOL . title_1 . " {FFFFFF}Benutzern gefällt deine Antwort auf einen Kommentar an " . wall . ".")
  125. } else {
  126. SendClientMessage(PREFIX . SECCOL . post["dc:creator"] . " {FFFFFF}gefällt deine Antwort auf einen Kommentar an " . wall . ".")
  127. }
  128. } else {
  129. SendClientMessage(post["category"] . "-" . post["dc:creator"] . "-" . post["title"])
  130. }
  131. FormatTime, date, , dd.MM.yyyy
  132. FormatTime, time, , HH:mm:ss
  133. FileAppend, % "[" . time . "] " . post["category"] . "-" . post["dc:creator"] . "-" . post["title"] . "-" . post["description"] . "`n", logs\log-%date%.txt
  134. } else {
  135. SendClientMessage(type)
  136. }
  137. equal := false
  138. }
  139. }
  140. } else {
  141. equal := false
  142. }
  143. if (!equal) {
  144. oldPosts[type] := newPosts
  145. }
  146. } catch e {
  147. FormatTime, date, , dd.MM.yyyy
  148. FormatTime, time, , HH:mm:ss
  149. message := e.message
  150. line := e.line
  151. extra := e.what
  152. FileAppend, [%time%] Fehler: %message% in Zeile %line% - %extra%`n, logs\log-%date%.txt
  153. SendClientMessage(PREFIX . "Fehler: " . e.message)
  154. }
  155. }
  156. SendClientMessage(message) {
  157. if (StrLen(message) > 144) {
  158. subMessage := SubStr(message, 1, 141)
  159. if (RegExMatch(subMessage, "(.+)({\S{6}})(\s*)$", message_)) {
  160. AddChatMessage(message_1 . "...")
  161. SendClientMessage(message_2 . "..." . message_3 . SubStr(message, 142))
  162. } else if (RegExMatch(subMessage, "(.+)({\S{0,6})$", message_)) {
  163. AddChatMessage(message_1 . "...")
  164. subMessage2 := SubStr(message, 142)
  165. if (RegExMatch(subMessage2, "^(\S{0,6}})(.+)", message2_)) {
  166. SendClientMessage(message_2 . message2_1 . "..." . message2_2)
  167. } else {
  168. SendClientMessage("..." . subMessage2)
  169. }
  170. } else {
  171. AddChatMessage(subMessage . "...")
  172. color := ""
  173. if (RegExMatch(subMessage, "(.*)({\S{6}})(.*)", message_)) {
  174. color := message_2
  175. }
  176. SendClientMessage(color . "..." . SubStr(message, 142))
  177. }
  178. } else {
  179. AddChatMessage(message)
  180. }
  181. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement