formatting and make it work with correct funciton calling
This commit is contained in:
parent
b203958ff2
commit
25bd5a94e5
@ -6,19 +6,27 @@ discordia.extensions()
|
|||||||
commands:Add('rank',{},'rank <username|mention|"me"> <game> <style>', function(t)
|
commands:Add('rank',{},'rank <username|mention|"me"> <game> <style>', function(t)
|
||||||
local args=t.args
|
local args=t.args
|
||||||
local message=t.message
|
local message=t.message
|
||||||
|
|
||||||
if #args<3 then return message:reply('invalid arguments') end
|
if #args<3 then return message:reply('invalid arguments') end
|
||||||
|
|
||||||
local user=args[1]
|
local user=args[1]
|
||||||
local game=API.GAMES[args[2]]
|
local game=API.GAMES[args[2]]
|
||||||
local style=API.STYLES[args[3]]
|
local style=API.STYLES[args[3]]
|
||||||
|
|
||||||
if not game then return message:reply('invalid game') end
|
if not game then return message:reply('invalid game') end
|
||||||
if not style then return message:reply('invalid style') end
|
if not style then return message:reply('invalid style') end
|
||||||
user = API:GetUserFromAny(user)
|
|
||||||
|
user = API:GetUserFromAny(user,message)
|
||||||
|
|
||||||
local sn_info = API:GetUser(user.id)
|
local sn_info = API:GetUser(user.id)
|
||||||
|
|
||||||
if not sn_info.ID then return message:reply('```No data with StrafesNET is associated with that user.```') end
|
if not sn_info.ID then return message:reply('```No data with StrafesNET is associated with that user.```') end
|
||||||
if sn_info.State==2 then return message:reply('```This user is currently blacklisted```') end
|
if sn_info.State==2 then return message:reply('```This user is currently blacklisted```') end
|
||||||
|
|
||||||
local rank = API:GetRank(user.id,game,style)
|
local rank = API:GetRank(user.id,game,style)
|
||||||
local rank_string = API:FormatRank(rank.Rank)
|
local rank_string = API.FormatRank(rank.Rank)
|
||||||
local skill = API:FormatSkill(rank.Skill)
|
local skill = API.FormatSkill(rank.Skill)
|
||||||
|
|
||||||
local formatted_message = '```'..
|
local formatted_message = '```'..
|
||||||
'Name: '..user.displayName..' ('..user.name..')\n'..
|
'Name: '..user.displayName..' ('..user.name..')\n'..
|
||||||
'Style: '..API.STYLES_LIST[rank.Style]..'\n'..
|
'Style: '..API.STYLES_LIST[rank.Style]..'\n'..
|
||||||
@ -27,5 +35,6 @@ commands:Add('rank',{},'rank <username|mention|"me"> <game> <style>', function(t
|
|||||||
'Placement: '..rank.Placement..'\n'..
|
'Placement: '..rank.Placement..'\n'..
|
||||||
'State: '..API.STATES[sn_info.State]..'\n'..
|
'State: '..API.STATES[sn_info.State]..'\n'..
|
||||||
'```'
|
'```'
|
||||||
|
|
||||||
message:reply(formatted_message)
|
message:reply(formatted_message)
|
||||||
end)
|
end)
|
Loading…
Reference in New Issue
Block a user