diff --git a/plugins/hackerspace.lua b/plugins/hackerspace.lua index 4adc256..54d437f 100644 --- a/plugins/hackerspace.lua +++ b/plugins/hackerspace.lua @@ -44,12 +44,12 @@ plugin.AddCommand('at', 0, function(Username, Channel) local Last = Parts[#Parts] Parts[#Parts] = nil - Line = table.concat(Parts, ", ") .. " and " .. Last + Line = table.concat(Parts, ", ") .. ", " .. Last end if #Users == 0 then Line = Line:gsub("^%l", string.upper) .. "." else - Line = Line .. "." + Line = Line .. " and five lathes." end end @@ -423,8 +423,8 @@ plugin.AddCommand('gimbaza', 1, function(Username, Channel, Target) end end, "Remove gimbaza") -plugin.AddCommand('play', 1, function(Username, Channel) - Channel:Say("ɴᴏᴡ ᴘʟᴀʏɪɴɢ: Despacito") +plugin.AddCommand('play', -1, function(Username, Channel, Song) + Channel:Say("ɴᴏᴡ ᴘʟᴀʏɪɴɢ: " .. Song) Channel:Say("───────────────⚪────────────────────────────") Channel:Say("◄◄⠀▐▐ ⠀►►⠀⠀ ⠀ 1:17 / 3:48 ⠀ ───○ 🔊⠀ ᴴᴰ ⚙ ❐ ⊏⊐") end) diff --git a/plugins/paczkomate.lua b/plugins/paczkomate.lua index 59797eb..02a9c32 100644 --- a/plugins/paczkomate.lua +++ b/plugins/paczkomate.lua @@ -44,29 +44,47 @@ local function CheckMate(IRC, Force) for _, ID in pairs(Redis:smembers("paczkomate:ids")) do local LastChecked = tonumber(Redis:hget("paczkomate:objects:" .. ID, "lastchecked")) local LastStatus = Redis:hget("paczkomate:objects:" .. ID, "status") + local Channel = Redis:hget("paczkomate:objects:" .. ID, "channel") + if Channel == nil then + Channel = "#hackerspace-pl-members" + end + local User = Redis:hget("paczkomate:objects:" .. ID, "user") if Now > LastChecked + 600 or Force then Redis:hset("paczkomate:objects:" .. ID, "lastchecked", Now) local NewStatus = GetPackStatus(ID) - if NewStatus ~= LastStatus then + if NewStatus ~= nil and NewStatus ~= LastStatus then Redis:hset("paczkomate:objects:" .. ID, "status", NewStatus) local Message = string.format("Paczkomate %s status changed (%s -> %s)", ID, LastStatus, NewStatus) - IRC:Say("#hackerspace-pl-members", Message) + if User ~= nil then + Message = User .. ": " .. Message + end + IRC:Say(Channel, Message) + end + if NewStatus == "Delivered" then + local Message = string.format("Paczkomate %s done, removing.", ID) + if User ~= nil then + Message = User .. ": " .. Message + end + IRC:Say(Channel, Message) + Redis:srem("paczkomate:ids", ID) + Redis:del("paczkomate:objects:" .. ID) end - if NewStatus == "Delivered" then - local Message = string.format("Paczkomate %s done, removing.", ID) - IRC:Say("#hackerspace-pl-members", Message) - Redis:srem("paczkomate:ids", ID) - Redis:del("paczkomate:objects:" .. ID) - end end end Redis:quit() end plugin.AddCommand('add-paczkomate', 1, function(Username, Channel, ID) + local Status = GetPackStatus(ID) + if Status == nil then + Channel:Say(Username .. ": i am not aware of such rubber") + return + end local Redis = GetRedisClient() Redis:transaction(function(t) t:sadd('paczkomate:ids', ID) + t:hset("paczkomate:objects:" .. ID, "channel", Channel.Name) + t:hset("paczkomate:objects:" .. ID, "user", Username) t:hset("paczkomate:objects:" .. ID, "lastchecked", 0) t:hset("paczkomate:objects:" .. ID, "status", "none") end)