Skip to content

Relationships

YYBartT edited this page Mar 29, 2023 · 7 revisions

Relationships

Functions

Data Types

Constants

Functions

Back To Top

Discord_Relationships_Filter

This function performs a query over the relationships of the current user selection only the ones that match the given type.

Syntax

Discord_Relationships_Filter(type)
Argument Type Description
type Discord_RelationshipType The type of relationship to filter when performing the query

Returns

N/A

Example

Discord_Relationship_Filter(Discord_RelationshipType_Friend);
count = Discord_Relationships_Count();
for(var a = 0 ; a < count ; a++)
{
    var structDiscord_Relationships_GetAt(a);
    type = struct.type;
    username = struct.username;
    avatar = struct.avatar;
    id = struct.id;
    bot = struct.bot;
    discriminator = struct.discriminator;
    //Do something each loop with this information..
}



Back To Top

Discord_Relationships_Count

Get the number of relationships that match your previous query.

Syntax

Discord_Relationships_Count()

Returns

real

Example

Discord_Relationships_Filter(Discord_Relationship_Filter_Friend);
count = Discord_Relationships_Count();
for(var a = 0 ; a < count ; a++)
{
    var structDiscord_Relationships_GetAt(a);
    type = struct.type;
    username = struct.username;
    avatar = struct.avatar;
    id = struct.id;
    bot = struct.bot;
    discriminator = struct.discriminator;
    //Do something each loop with this information..
}



Back To Top

Discord_Relationships_Get

Get the relationship between the current user and a given user by id.

Syntax

Discord_Relationships_Get(userId)
Argument Type Description
userId int64 User identifier

Returns

Relationship struct

Example

var struct = Discord_Relationships_getAt(userId);
type = struct.type;
username = struct.username;
avatar = struct.avatar;
userId = struct.userId;
bot = struct.bot;
discriminator = struct.discriminator;



Back To Top

Discord_Relationships_GetAt

Get the relationship at a given index when iterating over a list of relationships.

⚠️ REQUIRES This function requires a previous call the function Discord_Relationships_Filter.

Syntax

Discord_Relationships_GetAt(index)
Argument Type Description
indx int Index of the relationship

Returns

Relationship struct

Example

Discord_Relationships_Filter(Discord_RelationshipType_Friend);
count = Discord_Relationship_Count()
for(var a = 0 ; a < count ; a++)
{
    var structDiscord_Relationship_GetAt(a)
    type = struct.type
    username = struct.username
    avatar = struct.avatar
    userId = struct.id
    bot = struct.bot
    discriminator = struct.discriminator
   
    //Do something each loop with this information..
}


Data Types

Relationship

The Relationship structure returned by the following functions:

contains information about the user with whom the connected user has a relationship. The structure includes the user's username, avatar, user ID, whether they are a bot or not, and their discriminator.

The "username" field contains the username of the user, which is the name displayed on their profile and in chat messages. The "avatar" field contains the URL of the user's avatar image. The "userId" field contains the unique user ID assigned by Discord. The "bot" field is a boolean value indicating whether the user is a bot account or a human user. The "discriminator" field contains the four-digit number that appears after the username, used to distinguish between users with the same username.

Here is a table summarizing the fields in the "relationship" structure and their meanings:

Field Type Description
type Discord_RelationshipType The username of the user, which is the name displayed on their profile and in chat messages.
user [User](Users#user The user the relationship is for.
presence Presence That user's current presence


Constants

Back To Top

Discord_RelationshipType

Constant Value Description
Discord_RelationshipType_None 0 User has no intrinsic relationship on Discord.
Discord_RelationshipType_Friend 1 User is a friend of the connected user, and they can see each other's online status, send direct messages, etc.
Discord_RelationshipType_Blocked 2 User is blocked by the connected user and cannot interact with them on Discord.
Discord_RelationshipType_PendingIncoming 3 User has sent a friend request to the connected user, but it has not yet been accepted.
Discord_RelationshipType_PendingOutgoing 4 Connected user has sent a friend request to the other user, but it has not yet been accepted.
Discord_RelationshipType_Implicit 5 Users are not friends but interact with each other often, based on frequency and recency of interactions.


Clone this wiki locally