diff options
| author | ilotterytea <iltsu@alright.party> | 2025-07-23 18:39:12 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-07-23 18:39:12 +0500 |
| commit | 157a102b10aa481c1423a91360e8b5d90015b512 (patch) | |
| tree | 37e75da94a1e57867e117cc8902f159ed514ce38 | |
| parent | d9713c9184741a00c9d15f3ae50c96a5695afd92 (diff) | |
fix: !event and !notify couldnt parse http links
| -rw-r--r-- | luamods/event.lua | 23 | ||||
| -rw-r--r-- | luamods/notify.lua | 17 |
2 files changed, 32 insertions, 8 deletions
diff --git a/luamods/event.lua b/luamods/event.lua index 71d199c..b43e1d8 100644 --- a/luamods/event.lua +++ b/luamods/event.lua @@ -1,15 +1,24 @@ local function parse_target(value) local parts = str_split(value, ':') - if #parts ~= 2 then + if #parts < 2 then return nil end + local type = parts[#parts] + local target = "" + for i = 1, #parts - 1, 1 do + target = target .. parts[i] + if i + 1 < #parts then + target = target .. ":" + end + end + local data = { - target = parts[1], - type = str_to_event_type(parts[2]) + target = target, + type = str_to_event_type(type) } - if event_type_to_str(data.type) ~= parts[2] then + if event_type_to_str(data.type) ~= type then data.type = nil end @@ -106,6 +115,9 @@ The `!event` command gives the ability to manage events. + 7tv_new_emote *(`{emote}` - emote name, `{old_emote}` - original emote name, `{author}` - name of the person who added it)* + 7tv_deleted_emote *(`{emote}` - emote name, `{old_emote}` - original emote name, `{author}` - name of the person who added it)* + 7tv_updated_emote *(`{emote}` - new emote name, `{old_emote}` - previous emote name, `{author}` - name of the person who added it)* ++ rss *(`{channel_name}` - channel name, `{title}` - message title, `{message}` - message content, `{link}` - message link)* ++ twitter *(`{channel_name}` - account name, `{title}` - post title, `{message}` - post content, `{link}` - post link)* ++ telegram *(`{channel_name}` - channel name, `{title}` - post title, `{message}` - post content, `{link}` - post link)* + custom ## How to use placeholders? @@ -117,6 +129,9 @@ Here are some basic examples to inspire you: + `!event on torvalds/linux:github {author} made a new commit in linux kernel: {msg} (ID {sha})` - Please also note that the event name has the following format: **username/repository** *(https://github.com/ **username/repository**)* + `!event on forsen:7tv_new_emote {author} added a new 7TV emote: {emote}` + `!event on forsen:7tv_updated_emote {author} renamed a 7TV emote from {old_emote} to {emote}` ++ `!event on https://ilt.su/rss.php:rss new post on ilt.su: {title} ({link}) ++ `!event on durov:telegram Durov posted a new Telegram post: {title} ({link}) ++ `!event on forsen:twitter New post ({channel_name}): {title} ({link}) ## Syntax diff --git a/luamods/notify.lua b/luamods/notify.lua index 26540e7..cf34619 100644 --- a/luamods/notify.lua +++ b/luamods/notify.lua @@ -1,15 +1,24 @@ local function parse_target(value) local parts = str_split(value, ':') - if #parts ~= 2 then + if #parts < 2 then return nil end + local type = parts[#parts] + local target = "" + for i = 1, #parts - 1, 1 do + target = target .. parts[i] + if i + 1 < #parts then + target = target .. ":" + end + end + local data = { - target = parts[1], - type = str_to_event_type(parts[2]) + target = target, + type = str_to_event_type(type) } - if event_type_to_str(data.type) ~= parts[2] then + if event_type_to_str(data.type) ~= type then data.type = nil end |
