formatting and make it work with correct funciton calling

This commit is contained in:
tommy aka doge 2022-09-29 23:42:29 -04:00
parent b203958ff2
commit 25bd5a94e5

View File

@ -6,19 +6,27 @@ discordia.extensions()
commands:Add('rank',{},'rank <username|mention|"me"> <game> <style>', function(t)
local args=t.args
local message=t.message
if #args<3 then return message:reply('invalid arguments') end
local user=args[1]
local game=API.GAMES[args[2]]
local style=API.STYLES[args[3]]
if not game then return message:reply('invalid game') 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)
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
local rank = API:GetRank(user.id,game,style)
local rank_string = API:FormatRank(rank.Rank)
local skill = API:FormatSkill(rank.Skill)
local rank_string = API.FormatRank(rank.Rank)
local skill = API.FormatSkill(rank.Skill)
local formatted_message = '```'..
'Name: '..user.displayName..' ('..user.name..')\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'..
'State: '..API.STATES[sn_info.State]..'\n'..
'```'
message:reply(formatted_message)
end)