Properties

blocked: Blocked[]

people you block

List of the client's friends

notifications: Notification[]

Notifications

online: number

The current number of people online

List of "pending" relationships (shows in other tab on TETR.IO)

Methods

  • Block a user

    Parameters

    • userID: string

    Returns Promise<undefined | false>

    false if the user is already blocked, true otherwise

    await client.social.block(client.social.resolve('halp'));
    
  • Send a message to a specified user (based on id)

    Parameters

    • userID: string
    • message: string

    Returns Promise<DM>

    await client.social.dm(client.social.resolve('halp'), 'what\'s up?');
    
  • Send a user a friend request

    Parameters

    • userID: string

    Returns Promise<boolean>

    false if the user is already friended, true otherwise

    await client.social.friend(client.social.resolve('halp'));
    

    If an error occurs (such as the user has blocked the client, etc)

  • Get a user + social data from the list of users and pending friends (OTHER tab in TETR.IO)

    Parameters

    • target: string

    Returns null | Classes.Relationship

    const user = await client.social.get('halp')
    
    const user = await client.social.get('646f633d276f42a80ba44304');
    
    const user = await client.social.get({ username: 'halp' });
    
    const user = await client.social.get({ id: '646f633d276f42a80ba44304 });
    
    // You can then use the object to read user data and interact with the user
    await user.dm('wanna play?');
    await user.invite();
  • Parameters

    • target: {
          id: string;
      }
      • id: string

    Returns null | Classes.Relationship

  • Parameters

    • target: {
          username: string;
      }
      • username: string

    Returns null | Classes.Relationship

  • Invite a user to your room

    Parameters

    • userID: string

    Returns Promise<void>

    await client.social.invite(client.social.resolve('halp'));
    
  • Marks all notifications as read

    Returns void

    client.social.markNotificationsAsRead();
    
  • Get the user id given a username

    Parameters

    • username: string

    Returns Promise<string>

  • Set the client's status

    Parameters

    Returns void

    client.social.status('online', 'lobby:X-QP');
    
  • Unblock a user. Note: unblocking a user will unfriend them if they are friended.

    Parameters

    • userID: string

    Returns Promise<void>

    false if the user is not unblocked, true otherwise

    await client.social.unblock(client.social.resolve('halp'));
    
  • Unfriend a user. Note: unfriending a user will unblock them if they are blocked.

    Parameters

    • userID: string

    Returns Promise<boolean>

    false if the user is not unfriended, true otherwise

    await client.social.unfriend(client.social.resolve('halp'));
    
  • Get a users' information based on their userid or username

    Parameters

    • id: string

    Returns Promise<Utils.APITypes.Users.User>

    const user = await client.social.who(client.social.resolve('halp'));
    
  • Parameters

    • client: Client
    • initData: {
          notifications: Notification[];
          presences: {
              [userId: string]: {
                  detail: string;
                  invitable: boolean;
                  status: string;
              };
          };
          relationships: Types.Social.Relationship[];
          total_online: number;
      }
      • notifications: Notification[]
      • presences: {
            [userId: string]: {
                detail: string;
                invitable: boolean;
                status: string;
            };
        }
        • [userId: string]: {
              detail: string;
              invitable: boolean;
              status: string;
          }
          • detail: string
          • invitable: boolean
          • status: string
      • relationships: Types.Social.Relationship[]
      • total_online: number

    Returns Promise<Classes.Social>