Compare commits
2 Commits
aaa4b992f8
...
29a21a2f8f
Author | SHA1 | Date |
---|---|---|
Yessiest | 29a21a2f8f | |
Yessiest | 8f90345b96 |
|
@ -1,7 +1,7 @@
|
||||||
return function(message,overrides)
|
return function(message,overrides)
|
||||||
assert(type(message) == "table","table expected, got "..type(message))
|
assert(type(message) == "table","table expected, got "..type(message))
|
||||||
assert(type(overrides) == "table","table expected for arg#2, got "..type(overrides))
|
assert(type(overrides) == "table","table expected for arg#2, got "..type(overrides))
|
||||||
local fake = {content = message.content,
|
--[[local fake = {content = message.content,
|
||||||
author = message.author,
|
author = message.author,
|
||||||
member = message.guild:getMember(message.author.id),
|
member = message.guild:getMember(message.author.id),
|
||||||
channel = message.channel,
|
channel = message.channel,
|
||||||
|
@ -40,9 +40,28 @@ return function(message,overrides)
|
||||||
message:removeReaction(...)
|
message:removeReaction(...)
|
||||||
end,
|
end,
|
||||||
emulated = true
|
emulated = true
|
||||||
}
|
}]]
|
||||||
|
local fake = {}
|
||||||
for k,v in pairs(overrides) do
|
for k,v in pairs(overrides) do
|
||||||
fake[k] = v
|
fake[k] = v
|
||||||
end
|
end
|
||||||
|
fake = setmetatable(fake, {
|
||||||
|
__index = function(self,k)
|
||||||
|
local value = rawget(self,k)
|
||||||
|
if not value then
|
||||||
|
value = message[k]
|
||||||
|
if type(value) == "function" then
|
||||||
|
return function(x,...)
|
||||||
|
if not x then error("self expected, got nil") end
|
||||||
|
return value(message,...)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return value
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
return fake
|
return fake
|
||||||
end
|
end
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 8a1906df7a402349ff7b083e59cf17223363f59b
|
Subproject commit 4c796978eb2ca1e54d0ed357820610e09f30e8ef
|
Loading…
Reference in New Issue