#Difference between position and rawPosition? ( as in how are they positioned)

110 messages · Page 1 of 1 (latest)

hybrid apex
#

channels and roles have this and i don't know what's what, help!!!!

storm stag
#

no

iron steppe
#

Closed: marked as duplicate

random path
#

marked as duplicate skull

#

this isn't github issues

storm stag
#

tristan stop shitposting in djs-questions

dawn stirrup
hybrid apex
#

i know what raw means, i just don't know how discord's api positions it and how djs does it

#

Difference between position and rawPosition? ( as in how are they positioned)

dawn stirrup
#

well position is what position the channel has in the category (this forum channel would be 0)
rawPosition seems to be the position of the channel from top to bottom

categories and text/voice channels are separated

hybrid apex
#

so for rawPositions, there are three categories of positions?
category, text and voice?

#

do stage channels count as voice?

#

hmm, this makes sense since voice channels are always on the bottom in the category

#

i don't know about stages though

solar goblet
#

what is this new feature?

#

posts?

hybrid apex
#

not something to ask on my thread, it's a forum, go ask on #archive-offtopic 😡

dawn stirrup
#

rawPosition on voice/stage seems absolutely fucked

woven sphinx
#

(does this still need answers?)

dawn stirrup
#

yes

storm stag
#

yes

dawn stirrup
#

at least for rawPosition

hybrid apex
#

djs positions are just like from top to bottom, right? neat

#

after we're done with that, i got two words for you, role positions 🤨

woven sphinx
#

the rawPosition is the position as sent by discord, as single number, nonexclusive to other channels or roles
when the discord client recieves roles or channels with the same position, it orders them based on id, ascending for channels, descending for roles

#

each type of channel is sorted seperately

#

the library's position follows the order as shown in the discord client

hybrid apex
#

ah role positions seem simpler, just "id sorting -> position sorting" right?

woven sphinx
#

both role and channel positions are generated in the same way, each type of channel is sorted seperately

#

both the first text channel and the first voice channel in a category will have the position 0 (or 1 i don't remember)

hybrid apex
#

let me check

#

why did i try to enable developer mode dogeHaHa

#

okay that bit is irrelevant for now, each type?

#

not just categories, text-based types and voice?

woven sphinx
#

not sure about that, haven't tested that much

hybrid apex
#

it doesn't make sense to have sort categories for each type

woven sphinx
#

categories are seperate, and text and voice are seperate, but i don't know if news and stage are grouped with text and voice respectively

hybrid apex
#

only voice and everything else (categories ofc) make sense because voice channels are always on the bottom of the category

woven sphinx
#

makes sense for the news channels to be sorted along with text channels, but i haven't used stages so i can't comment on that

#

that was phrased badly, mb

hybrid apex
#

my understanding is, if are allowed to be placed anywhere and not just some specific position (like on the top of the other channels or on the bottom), stages would be sorted with text channels

#

for some reason now i can't find a single stage in all 70 of my servers

#

@dawn stirrup did stages get removed or something?

woven sphinx
#

stage is sorted among voice channels so they would share the sorting i believe

hybrid apex
#

they are? i think i saw stages being on top

woven sphinx
#

so there's 4 groups for the rawPosition, roles, categories, text-based (for each category) and voice-based (for each category)

woven sphinx
hybrid apex
#

no i think it was inside
but again i can't really confirm
because i can't find a single stage

woven sphinx
#

im testing in the client rn, can't get it above text

hybrid apex
#

okay so it's with voice channels

woven sphinx
hybrid apex
#

they can be placed above voice channels, right?

woven sphinx
#

yes

hybrid apex
#

now just confirm rawPosition for roles for me

woven sphinx
hybrid apex
#

confused

woven sphinx
#

channel with position 0 is at the top, role with position 0 is at the bottom (<@&222078108977594368>)

hybrid apex
#

so djs just makes it ascending -> descending?

woven sphinx
#

yeah

#

the position is resolved through the Util#discordSort method

hybrid apex
#

dogeHaHa that's very useful

vast lightBOT
woven sphinx
#

(lib stays consistent with descending thing but the order of ids changes)

hybrid apex
#

okay so summary of this thread correct me if i'm wrong
Roles

rawPosition -> discord sends the roles in an ascending order
position -> discordjs makes it descending

channels

rawPosition -> three groups with their own descending sorting, categories, voice channels (including stages) and everything else
position -> all the channels in descending order as they appear in the ui

woven sphinx
#

channels are ascending

#

not sure what you mean by this part

discord sends the roles as ascending

hybrid apex
#

in an ascending order

woven sphinx
#

<@&222078108977594368>, the bottom role, is always (raw)pos 0 (afaik)

#

djs keeps that

hybrid apex
#

and then the role above is 1, the one above is 2 and so on?

woven sphinx
#

for position, yes

#

for rawPos they just go up, not necessarily sequential/distinct as mentioned before

hybrid apex
#

so wait djs makes it from top to bottom but in the end they have everyone as 0?

woven sphinx
#

bottom to top

#

hm

hybrid apex
#

uhhhhhh

woven sphinx
#

suppose uh, this server ig
mod, contrib, everyone

#

for djs position, it's 2 1 0 in that order

#

for raw position, afaik everyone is always 0, and then contrib is something above that, and then mod is something above that

hybrid apex
#

so what's the difference

woven sphinx
#

or it could be that everyone is 0, both mod and contrib are 1, and mod has a later id than contrib

woven sphinx
hybrid apex
#

noooo i mean what's the difference between djs position and rawPosition for roles specifically
forget channels

woven sphinx
#

djs position resolves the rawPosition into indexes

#

rawPosition can have duplicates or gaps, position doesn't

hybrid apex
#

how does it have duplicates

woven sphinx
#

rawPosition doesn't require distinct positions

hybrid apex
#

then what the fuck is it for

#

oh my god

woven sphinx
#

to avoid extra updates i guess
if you have a channel in position 1, and you edit another channel to have position 1, then those 2 channels will be sorted by id and the first channel won't get updated

hybrid apex
#

i get that instead of editting the positions of all the roles just for one update is wasteful but then what is it for

woven sphinx
#

what is what for exactly?

#

the field or?

hybrid apex
#

rawPositions

woven sphinx
#

as in the value discord sends or the field exposed on Roles/GuildChannels

hybrid apex
#

dogeHaHa well now i have to sleep
i'll do some testing later on
thanks a lot

woven sphinx
#

mild confusion

#

gnight

hybrid apex
#

i'm left with extreme confusion

woven sphinx
#

im confused on what you're confused on

hybrid apex
#

right now just how discord roles' raw position works

woven sphinx
#

i feel like it just barely does tbh

hybrid apex
#

and i wanna know how madThoonk

young dock
#

Roles is easy, first rawPosition is sorted highest first, then by the id’s createdAt lowest first, then the nonce of the id lowest first iirc (not sure abt order for this)

#

For channels, the parent and type have to be considered beforehand.