Fixed some code, added argument to !roll

pull/1/head
Astoria Floyd 3 years ago
parent d26ecf2c63
commit fd21eaa448

@ -11,8 +11,12 @@ local commands = { -- Define commands its a table that will contain our commands
end
};
[prefix..'roll'] = { -- Rolls a d20, check RNG for more info.
exec = function (message)
exec = function (message, arg)
if not arg[2] then
message.channel:send(rng.d20())
else
message.channel:send(rng.roll(arg))
end
end
};
[prefix..'figlet'] = { -- Parrots input to figlet, then echos it to the same channel you are in.

@ -17,4 +17,21 @@ function rng.d20()
return message
end
function rng.roll(arg)
tools.seed()
local mathArgument = arg[2]
local compareNumber = tonumber(mathArgument)
local dice = math.random(mathArgument)
local messagePart1 = ('You rolled a ' .. dice .. ' out of '..mathArgument)
local messagepart2 = ''
if dice == compareNumber then
messagepart2 = ('Nat '..mathArgument..'! Crititcal Hit')
else if dice==1 then
messagepart2 = ('Nat 1! Critical Shit!')
end
end
local message = messagePart1 .. '\n' .. messagepart2
return message
end
return rng
Loading…
Cancel
Save