How to shorten by specifying the number of characters

Sorry, I’m japanese, so my English is bad.

The command using $ (urlfetch url) answers too much, so I want to specify the number of characters and shorten it.

[now]
!stats $ (urlfetch url)

pleyer ID: [Level: 1,570 | Kills: 10,039 | Damage: 2,551,627 | Rank Score: 7,410 | Arena Rank Score: 5,823 | Season 6 Wins: 70 | Season 6 Kills: 2,156 | Season 7 Wins: 9 | Season 7 Kills: 1,788 | Season 8 Wins: 42 | Season 8 Kills: 2,023 | Season 10 Kills: 172]

[ideal]
!stats $ (urlfetch url)

pleyer ID: [Level: 1,570 | Kills: 10,039 | Damage: 2,551,627 | Rank Score: 7,410 | Arena Rank Score: 5,823 …

Hey @shinshu!

That would be useful if you shared the code of the command.

Hi, @Emily !
Thank you for your reply.

【add command】(about url : I can’t reply as it is, so I’m converting “https” to “:grinning:”)

!commands add !apex @$(user): $(urlfetch :grinning:://api.2g.be/games/apex?q=$(querystring))

【use command】
!apex stats kiiti_san3 origin

【result】
kiiti_san3: [Level: 1,572 | Kills: 10,039 | Damage: 2,551,627 | Rank Score: 7,752 | Arena Rank Score: 5,858 | Season 6 Wins: 70 | Season 6 Kills: 2,156 | Season 7 Wins: 9 | Season 7 Kills: 1,788 | Season 8 Wins: 42 | Season 8 Kills: 2,023 | Season 10 Kills: 172]
:arrow_double_down:
【ideal result】
kiiti_san3: [Level: 1,572 | Kills: 10,039 | Damage: 2,551,627 | Rank Score: 7,752 | Arena Rank Score: 5,858 | …

So if I understand you correctly, you just want to get rid of the Seasons data…

$(eval d=`$(urlfetch https://api.2g.be/games/apex?q=$(querystring))`.replace(/\[|\]/g,``).split(`|`); o=d.filter(e=>!e.includes(`Season`)); `$(user) — ${o.join(`|`)}`)

Also, if you wanted to only use it for your stats, here’s how you could do it:

$(eval d=`$(urlfetch https://api.2g.be/games/apex?q=stats%20kiiti_san3%20origin)`.replace(/\[|\]/g,``).split(`|`); o=d.filter(e=>!e.includes(`Season`)); `$(user) — ${o.join(`|`)}`)
2 Likes

@Emily

Oh my god, Emily :heart_eyes:

I’m very happy! I’m so bigginer :sob:

Lastly, please give me one more commands.

【ideal result】
kiiti_san3: [ Rank Score: 7,752 | Arena Rank Score: 5,858 | …

Furthermore, I want to remove , Level, Kills, and Damage.

1 Like

This should do the job:

$(eval d=`$(urlfetch https://api.2g.be/games/apex?q=$(querystring))`.replace(/\[|\]/g,``).split(`|`); o=d.filter(e=>e.includes(`Rank`)); u=d[0].split(`:`).shift(); `$(user) — ${u}: ${o.join(`|`)}`)

$(eval d=`$(urlfetch https://api.2g.be/games/apex?q=stats%20kiiti_san3%20origin)`.replace(/\[|\]/g,``).split(`|`); o=d.filter(e=>e.includes(`Rank`)); u=d[0].split(`:`).shift(); `$(user) — ${u}: ${o.join(`|`)}`)
2 Likes

Thank you so much!!

I don’t understand programming at all. And my English is bad. So it was really helpful!

How should i thank you. arigato :heart_eyes:

1 Like

@Emily

Sorry to keep bothering you.

【ideal result】
kiiti_san3: Rank Score: 7,752 …

Furthermore, I want to remove Arena Rank Score.

You should have told me from the beginning that you only wanted the rank score…

$(eval d=`$(urlfetch https://api.2g.be/games/apex?q=$(querystring))`.replace(/\[|\]/g,``).split(`|`); o=d.filter(e=>e.includes(`Rank`)); u=d[0].split(`:`).shift(); `$(user) — ${u}: ${o[0]}`)

$(eval d=`$(urlfetch https://api.2g.be/games/apex?q=stats%20kiiti_san3%20origin)`.replace(/\[|\]/g,``).split(`|`); o=d.filter(e=>e.includes(`Rank`)); u=d[0].split(`:`).shift(); `$(user) — ${u}: ${o[0]}`)
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.