Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- loadNotifications(type) {
- global userID
- global token
- global oldPosts
- global loadCount
- result := URLDownloadToVar("https://lyd-roleplay.de/" . type . "/?at=" . userID . "-" . token)
- if (result == "ERROR_CONNECTION")
- return
- try {
- xmlDoc := new xml(result)
- items := xmlDoc.getChildren("//rss/channel")
- newPosts := []
- for index, item in items {
- if (newPosts.Length() >= loadCount) {
- break
- } else {
- if (item.nodeName == "item") {
- post := []
- children := xmlDoc.getChildren(item)
- for i, child in children {
- name := child.nodeName
- if (name == "title" || name == "dc:creator" || name == "slash:comments" || name == "category" || name == "description" || name == "pubDate") {
- post[name] := child.text
- }
- }
- newPosts.Push(post)
- }
- }
- }
- equal := true
- if (newPosts.Length() == oldPosts[type].Length()) {
- for index, post in newPosts {
- contained := false
- Loop, %loadCount%
- {
- i := loadCount + 1 - A_Index
- 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"]) {
- contained := true
- }
- }
- if (!contained) {
- if (type == "forum/board-feed") {
- SendClientMessage(PREFIX . "Neuer Beitrag von " . SECCOL . post["dc:creator"] . " {FFFFFF}im Thread " . SECCOL . post["title"])
- } else if (type == "conversation-feed") {
- SendClientMessage(PREFIX . "Neue Konversationen von " . SECCOL . post["dc:creator"] . " {FFFFFF}mit dem Betreff: " . SECCOL . post["title"])
- } else if (type == "notification-feed") {
- if (post["category"] == "com.woltlab.wbb.post") {
- RegExMatch(post["description"], "(.+) auf das Thema <a href=""(\S+)"">(.+)<\/a> geantwortet\.", description_)
- if (RegExMatch(post["title"], "(\d+) neue Beiträge in abonniertem Thema", title_)) {
- SendClientMessage(PREFIX . "Du hast " . SECCOL . title_1 . " {FFFFFF}neue Beiträge im Thema " . SECCOL . description_3 . "{FFFFFF}.")
- } else if (RegExMatch(post["title"], "Du wurdest zitiert")) {
- RegExMatch(post["description"], "(.+) hat dich im Thema <a href=""(\S+)"">(.+)<\/a> zitiert\.", description_)
- SendClientMessage(PREFIX . SECCOL . post["dc:creator"] . " {FFFFFF}hat dich im Thema " . SECCOL . description_3 . " {FFFFFF}zitiert.")
- } else if (RegExMatch(post["title"], "Du wurdest erwähnt")) {
- RegExMatch(post["description"], "(.+) hat dich im Thema <a href=""(\S+)"">(.+)<\/a> erwähnt\.", description_)
- SendClientMessage(PREFIX . SECCOL . post["dc:creator"] . " {FFFFFF}hat dich im Thema " . SECCOL . description_3 . " {FFFFFF}erwähnt.")
- } else {
- SendClientMessage(PREFIX . SECCOL . post["dc:creator"] . " {FFFFFF}hat auf das Thema " . SECCOL . description_3 . " {FFFFFF}geantwortet.")
- }
- } else if (post["category"] == "com.woltlab.wcf.user.follow") {
- SendClientMessage(PREFIX . SECCOL . post["dc:creator"] . " {FFFFFF}folgt dir nun.")
- } else if (post["category"] == "com.woltlab.wbb.thread") {
- RegExMatch(post["description"], "(.+) hat das Thema <a href=""(\S+)"">(.+)<\/a> im Forum <a href=""(\S+)"">(.+)<\/a> erstellt\.", description_)
- SendClientMessage(PREFIX . SECCOL . post["dc:creator"] . " {FFFFFF}hat das Thema " . SECCOL . description_3 . " {FFFFFF}im Forum " . SECCOL . description_5 . " {FFFFFF}erstellt.")
- } else if (post["category"] == "com.woltlab.wbb.likeablePost.notification") {
- RegExMatch(post["description"], "(.+) gefällt dein Beitrag im Thema <a href=""(\S+)"">(.+)<\/a>\.", description_)
- if (RegExMatch(post["title"], "(\d+) Benutzern gefällt dein Beitrag", title_)) {
- SendClientMessage(PREFIX . SECCOL . title_1 . " {FFFFFF}Benutzern gefällt dein Beitrag im Thema " . SECCOL . description_3 . "{FFFFFF}.")
- } else {
- SendClientMessage(PREFIX . SECCOL . post["dc:creator"] . " {FFFFFF}gefällt dein Beitrag im Thema " . SECCOL . description_3 . "{FFFFFF}.")
- }
- } else if (post["category"] == "com.woltlab.wcf.conversation.notification") {
- RegExMatch(post["description"], "(.+) hat die Konversation <a href=""(\S+)"">(.+)<\/a> gestartet\.", description_)
- SendClientMessage(PREFIX . SECCOL . post["dc:creator"] . " {FFFFFF}hat die Konversation " . SECCOL . description_3 . " {FFFFFF}gestartet.")
- } else if (post["category"] == "com.woltlab.wcf.conversation.message.notification") {
- RegExMatch(post["description"], "(.+) auf die Konversation <a href=""(\S+)"">(.+)<\/a> geantwortet\.", description_)
- if (RegExMatch(post["title"], "(\d+) Teilnehmer haben auf eine Konversation geantwortet", title_)) {
- SendClientMessage(PREFIX . SECCOL . title_1 . " {FFFFFF}Teilnehmer haben auf die Konversation " . SECCOL . description_3 . " {FFFFFF}geantwortet.")
- } else {
- SendClientMessage(PREFIX . SECCOL . post["dc:creator"] . " {FFFFFF}hat auf die Konversation " . SECCOL . description_3 . " {FFFFFF}geantwortet.")
- }
- } else if (post["category"] == "com.woltlab.wcf.user.profileComment.notification") {
- SendClientMessage(PREFIX . SECCOL . post["dc:creator"] . " {FFFFFF}hat einen Kommentar an deiner Pinnwand verfasst.")
- } else if (post["category"] == "com.woltlab.wcf.user.profileComment.response.notification") {
- wall := "??? "
- if (RegExMatch(post["description"], "(.+) hat eine Antwort zu deinem Kommentar an <a href=""(\S+)#wall"">(.+)<\/a> verfasst\.", description_)) {
- wall := "zu deinem Kommentar an deiner Pinnwand "
- } else if (RegExMatch(post["description"], "(.+) haben auf deinen Kommentar an <a href=""(\S+)#wall"">(.+)<\/a> geantwortet\.", description_)) {
- wall := "deinen Kommentar an deiner Pinnwand "
- } else if (RegExMatch(post["description"], "(.+) hat eine Antwort zu deinem Kommentar an der <a href=""(\S+)#wall"">Pinnwand von (.+)<\/a> verfasst\.", description_)) {
- wall := "zu deinem Kommentar an der Pinnwand von " . SECCOL . description_3 . " {FFFFFF}"
- } else if (RegExMatch(post["description"], "(.+) haben auf deinen Kommentar an der <a href=""(\S+)#wall"">Pinnwand von (.+)<\/a> geantwortet\.", description_)) {
- wall := "deinen Kommentar an der Pinnwand von " . SECCOL . description_3 . " {FFFFFF}"
- } else if (RegExMatch(post["description"], "(.+) hat eine Antwort zum Kommentar von <a href=""(.+)"">(.+)<\/a> an <a href=""(\S+)#wall"">(.+)<\/a> verfasst\.", description_)) {
- wall := "zum Kommentar von " . SECCOL . description_3 . " {FFFFFF}an deiner Pinnwand "
- } else if (RegExMatch(post["description"], "(.+) haben auf den Kommentar von <a href=""(.+)"">(.+)<\/a> an <a href=""(\S+)#wall"">(.+)<\/a> geantwortet\.", description_)) {
- wall := "den Kommentar von " . SECCOL . description_3 . " {FFFFFF}an deiner Pinnwand "
- }
- if (RegExMatch(post["title"], "(\d+) neue Antworten \(Pinnwand\)", title_)) {
- SendClientMessage(PREFIX . SECCOL . title_1 . " {FFFFFF}Benutzer haben auf " . wall . "geantwortet.")
- } else {
- SendClientMessage(PREFIX . SECCOL . post["dc:creator"] . " {FFFFFF}hat eine Antwort " . wall . "verfasst.")
- }
- } else if (post["category"] == "com.woltlab.wcf.user.profileComment.like.notification") {
- wall := "???"
- if (RegExMatch(post["description"], "(.+) gefällt dein Kommentar an <a href=""(\S+)#wall"">(.+)<\/a>\.", description_)) {
- wall := "deiner Pinnwand"
- } else if (RegExMatch(post["description"], "(.+) gefällt dein Kommentar an der <a href=""(\S+)#wall"">Pinnwand von (.+)<\/a>\.", description_)) {
- wall := "der Pinnwand von " . SECCOL . description_3 . "{FFFFFF}"
- }
- if (RegExMatch(post["title"], "(\d+) Benutzern gefällt dein Kommentar \(Pinnwand\)", title_)) {
- SendClientMessage(PREFIX . SECCOL . title_1 . " {FFFFFF}Benutzern gefällt dein Kommentar an " . wall . ".")
- } else {
- SendClientMessage(PREFIX . SECCOL . post["dc:creator"] . " {FFFFFF}gefällt dein Kommentar an " . wall . ".")
- }
- } else if (post["category"] == "com.woltlab.wcf.user.profileComment.response.like.notification") {
- wall := "???"
- if (RegExMatch(post["description"], "(.+) gefällt deine Antwort auf einen Kommentar an <a href=""(\S+)#wall"">(.+)<\/a>\.", description_)) {
- wall := "deiner Pinnwand"
- } else if (RegExMatch(post["description"], "(.+) gefällt deine Antwort auf einen Kommentar an der <a href=""(\S+)#wall"">Pinnwand von (.+)<\/a>\.", description_)) {
- wall := "der Pinnwand von " . SECCOL . description_3 . "{FFFFFF}"
- }
- if (RegExMatch(post["title"], "(\d+) Benutzern (.+) Antwort auf einen Kommentar \(Pinnwand\)", title_)) {
- SendClientMessage(PREFIX . SECCOL . title_1 . " {FFFFFF}Benutzern gefällt deine Antwort auf einen Kommentar an " . wall . ".")
- } else {
- SendClientMessage(PREFIX . SECCOL . post["dc:creator"] . " {FFFFFF}gefällt deine Antwort auf einen Kommentar an " . wall . ".")
- }
- } else {
- SendClientMessage(post["category"] . "-" . post["dc:creator"] . "-" . post["title"])
- }
- FormatTime, date, , dd.MM.yyyy
- FormatTime, time, , HH:mm:ss
- FileAppend, % "[" . time . "] " . post["category"] . "-" . post["dc:creator"] . "-" . post["title"] . "-" . post["description"] . "`n", logs\log-%date%.txt
- } else {
- SendClientMessage(type)
- }
- equal := false
- }
- }
- } else {
- equal := false
- }
- if (!equal) {
- oldPosts[type] := newPosts
- }
- } catch e {
- FormatTime, date, , dd.MM.yyyy
- FormatTime, time, , HH:mm:ss
- message := e.message
- line := e.line
- extra := e.what
- FileAppend, [%time%] Fehler: %message% in Zeile %line% - %extra%`n, logs\log-%date%.txt
- SendClientMessage(PREFIX . "Fehler: " . e.message)
- }
- }
- SendClientMessage(message) {
- if (StrLen(message) > 144) {
- subMessage := SubStr(message, 1, 141)
- if (RegExMatch(subMessage, "(.+)({\S{6}})(\s*)$", message_)) {
- AddChatMessage(message_1 . "...")
- SendClientMessage(message_2 . "..." . message_3 . SubStr(message, 142))
- } else if (RegExMatch(subMessage, "(.+)({\S{0,6})$", message_)) {
- AddChatMessage(message_1 . "...")
- subMessage2 := SubStr(message, 142)
- if (RegExMatch(subMessage2, "^(\S{0,6}})(.+)", message2_)) {
- SendClientMessage(message_2 . message2_1 . "..." . message2_2)
- } else {
- SendClientMessage("..." . subMessage2)
- }
- } else {
- AddChatMessage(subMessage . "...")
- color := ""
- if (RegExMatch(subMessage, "(.*)({\S{6}})(.*)", message_)) {
- color := message_2
- }
- SendClientMessage(color . "..." . SubStr(message, 142))
- }
- } else {
- AddChatMessage(message)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement