forked from threeoh6000/joltik
Fix bug that causes some commands to crash when executed in DM
This commit is contained in:
parent
607b1c02bb
commit
f7d23d620e
1 changed files with 11 additions and 5 deletions
6
bot.lua
6
bot.lua
|
@ -11,6 +11,7 @@ string.startswith = function(self, str)
|
|||
end
|
||||
|
||||
function getnick(str, guild)
|
||||
if guild ~= nil then
|
||||
local b = str:gsub("<@",""):gsub(">","")
|
||||
local user = guild:getMember(b)
|
||||
if user.nickname == nil then
|
||||
|
@ -18,6 +19,11 @@ function getnick(str, guild)
|
|||
else
|
||||
return user.nickname
|
||||
end
|
||||
else
|
||||
local b = str:gsub("<@",""):gsub(">","")
|
||||
local user = client:getUser(b)
|
||||
return user.name
|
||||
end
|
||||
end
|
||||
|
||||
client:on('ready', function()
|
||||
|
|
Reference in a new issue