1
0
Fork 0
forked from threeoh6000/joltik

Fix bug that causes some commands to crash when executed in DM

This commit is contained in:
abbie 2022-11-04 17:03:05 +00:00
parent 607b1c02bb
commit f7d23d620e
No known key found for this signature in database
GPG key ID: A575D2415E5E5B6D

View file

@ -11,6 +11,7 @@ string.startswith = function(self, str)
end end
function getnick(str, guild) function getnick(str, guild)
if guild ~= nil then
local b = str:gsub("<@",""):gsub(">","") local b = str:gsub("<@",""):gsub(">","")
local user = guild:getMember(b) local user = guild:getMember(b)
if user.nickname == nil then if user.nickname == nil then
@ -18,6 +19,11 @@ function getnick(str, guild)
else else
return user.nickname return user.nickname
end end
else
local b = str:gsub("<@",""):gsub(">","")
local user = client:getUser(b)
return user.name
end
end end
client:on('ready', function() client:on('ready', function()