Skip to content

Commit

Permalink
stufffffffs
Browse files Browse the repository at this point in the history
  • Loading branch information
emmachase committed May 21, 2018
1 parent 2118223 commit 38decd6
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 5 deletions.
10 changes: 10 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## 0.0.7 - 2018-05-20
### Added
- Added sanity checks for peripheral wraps

### Fixed
- Discord webhooks now work

### Changed
- Updated examples

## 0.0.6 - 2018-05-20
### Fixed
- Fixed a bug with message templates
Expand Down
2 changes: 1 addition & 1 deletion examples/.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-- slackURL = "<url>", -- The slack webhook url for logging to a slack channel
-- slackName = "myUsername" -- Your username in slack for mentions
-- discordURL = "<url>", -- The discord webhook url for logging to a discord channel
-- discordName = "myUser#123" -- Your username in discord for mentions
-- discordName = "123456789012345678" -- Your discord user id for mentions (Find this by typing '\@yourUsernameHere' in Discord)
logger = { -- Which events are worthy of a message/mention in slack / discord
-- Valid values are false = no message, true = message, "important" = mention
purchase = true, -- When someone purchases anything
Expand Down
4 changes: 2 additions & 2 deletions src/logger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ function logger.externMention(text)

if discordURL then
if discordName then
http.post(discordURL, [[payload={"username": "]] .. externName .. [[", "content":"<@]] .. discordName .. [[> ]] .. textutils.urlEncode(text) .. [["}]])
http.post(discordURL, [[{"username": "]] .. externName .. [[", "content":"<@]] .. discordName .. [[> ]] .. textutils.urlEncode(text) .. [["}]])
else
http.post(discordURL, [[payload={"username": "]] .. externName .. [[", "content":"]] .. textutils.urlEncode(text) .. [["}]])
http.post(discordURL, [[{"username": "]] .. externName .. [[", "content":"]] .. textutils.urlEncode(text) .. [["}]])
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/main.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- vim: syntax=lua
-- luacheck: globals loadRemote getRemote fs loadstring peripheral

local versionTag = "v0.0.6"
local versionTag = "v0.0.7"

local args = {...}
local layoutMode = args[1] == "--layout" or args[1] == "-l"
Expand Down
13 changes: 13 additions & 0 deletions src/sections/peripherals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ end
local chestPeriphs = {}
for i = 1, #config.chests do
chestPeriphs[#chestPeriphs + 1] = peripheral.wrap(config.chests[i])

if not chestPeriphs[#chestPeriphs] then
chestPeriphs[#chestPeriphs] = nil
logger.error("No chest by name '" .. config.chests[i] .. "'")
end
end

if #chestPeriphs == 0 then
error("No valid chest(s) could be found")
end

if not config.self then
Expand Down Expand Up @@ -57,6 +66,10 @@ if not config.monitor then
end
else
monPeriph = peripheral.wrap(config.monitor)

if not (monPeriph and monPeriph.setPaletteColor) then
error("No monitor by name '" .. monPeriph .. "' could be found")
end
end

monPeriph.setTextScale(0.5)
Expand Down
2 changes: 1 addition & 1 deletion src/sections/requires.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ local util = require("util.lua")
--#require "vendor/jua.lua" as jua

--#require "src/logger.lua" as logger
logger.init(true)
logger.init(true, config.title)
successTools.logger = logger

--#require "src/util.lua" as util
Expand Down

0 comments on commit 38decd6

Please sign in to comment.