Server Exports

Misc

GetConfig

local config = exports["lb-phone"]:GetConfig()

FormatNumber

-- phoneNumber: string
local formattedNumber = exports["lb-phone"]:FormatNumber(phoneNumber)

AirShare

-- sender: number - The source of the player sending the share
-- target: number - The source of the player receiving the share
-- shareType: "image" | "contact" | "location" | "note" | "voicememo"
-- shareData: table
exports["lb-phone"]:AirShare(sender, target, shareType, shareData)

The shareData should be:

image
{
    isVideo: boolean;
    src: string; // link to the image/video
    timestamp?: number; // timestamp in ms, defaults to current time
}
contact
{
    number: string;
    firstname: string;
    lastname?: string;
    email?: string;
    address?: string;
    avatar?: string;
}
location
{
    name: string;
    location: [number, number]; // [y, x]
}
note
{
    title: string;
    content: string;
}
voicememo
{
    title: string;
    src: string; // link to the audio file
    duration: string; // audio file duration in seconds
}

ContainsBlacklistedWord

Checks if a string contains a blacklisted word defined in the config.

-- source: number
-- text: string
-- return: boolean
local containsBlacklistedWord = exports["lb-phone"]:ContainsBlacklistedWord(source, text)

Social media

ToggleVerified

-- app: "birdy" | "instapic" | "trendy"
-- username: string
-- verified: boolean
exports["lb-phone"]:ToggleVerified(app, username, verified)

IsVerified

-- app: "birdy" | "instapic" | "trendy"
-- username: string
-- return: boolean
exports["lb-phone"]:IsVerified(app, username)

ChangePassword

-- app: "birdy" | "instapic" | "trendy" | "mail" | "darkchat"
-- username: string
-- password: string
-- return: boolean
local success = exports["lb-phone"]:ChangePassword(app, username, password)

GetTweet

Used to get a post on birdy

-- id: string
-- return: table
local post = exports["lb-phone"]:GetTweet(id)

Handle phone & user

FactoryReset

-- phoneNumber: string
exports["lb-phone"]:FactoryReset(phoneNumber)

GetEquippedPhoneNumber

-- source: number | string - the player source or identifier
-- return: string?
local phoneNumber = exports["lb-phone"]:GetEquippedPhoneNumber(source)

GetSourceFromNumber

-- phoneNumber: string
-- return: number?
local source = exports["lb-phone"]:GetSourceFromNumber(phoneNumber)

SendNotification

-- sourceOrNumber: string | number - The player source or phone number
-- data: { app?: string, title: string, content?: string, thumbnail?: string, avatar?: string, showAvatar?: boolean }
-- app: string - Identifier of the app that sent the notification, optional
-- title: string - Title of the notification
-- content: string - Content of the notification, optional
-- thumbnail: string - Thumbnail URL, optional
-- avatar: string - Avatar URL, optional
-- showAvatar: boolean - Whether to show an avatar placeholder if no avatar was sent, optional
exports["lb-phone"]:SendNotification(sourceOrNumber, {
    app = "Settings",
    title = "Test",
    content = "This is a test notification",
})

NotifyEveryone

-- data: { app: string, title: string, content?: string, thumbnail?: string, avatar?: string, showAvatar?: boolean }
-- app: string - Identifier of the app that sent the notification
-- title: string - Title of the notification
-- content: string - Content of the notification, optional
-- thumbnail: string - Thumbnail URL, optional
-- avatar: string - Avatar URL, optional
-- showAvatar: boolean - Whether to show an avatar placeholder if no avatar was sent, optional
exports["lb-phone"]:NotifyEveryone({
    app = "Settings",
    title = "Test",
    content = "This is a test notification",
})

EmergencyNotification

-- sourceOrNumber: number - The player source
-- data: table, the notification data
exports["lb-phone"]:EmergencyNotification(source, {
    title = "Emergency Alert",
    content = "This is a test emergency alert",
    icon = "warning", -- the icon of the notification (optional), "warning" or "danger"
})

AddContact

-- phoneNumber: string - the phone number to add the contact to
-- data: { number: string, firstname: string, lastname?: string, avatar?: string, email?: string, address?: string }
exports["lb-phone"]:AddContact(phoneNumber, {
    number = "01234567890",
    firstname = "John",
    lastname = "Doe", -- optional
    avatar = "https://example.com/avatar", -- optional
    email =  "[email protected]", -- optional
    address = "Eclipse Towers, Penthouse Suite 1", -- optional
})

Wallet app

AddTransaction

-- source: number | string - the player source or identifier
-- amount: number - the amount of the transaction
-- title: string - the title of the transaction
-- image: string? - the image URL of the transaction
exports["lb-phone"]:AddTransaction(source, amount, title, image)

Security

GetPin

-- phoneNumber: string
-- return: string
local pin = exports["lb-phone"]:GetPin(phoneNumber)

ResetSecurity

-- phoneNumber: string
exports["lb-phone"]:ResetSecurity(phoneNumber)

Mail

CreateMailAccount

-- address: string
-- password: string
-- cb?: function
-- return: { success: boolean, error?: string }
local result = exports["lb-phone"]:CreateMailAccount(address, password)
 
if not result.success then
    return print("Failed to create mail account:", result.error)
end

GetEmailAddress

-- phoneNumber: string
-- return?: string
exports["lb-phone"]:GetEmailAddress(phoneNumber)

SendMail

-- data: { to: string, sender?: string, subject: string, message: string, attachments?: string[], actions?: { label: string, data: { event: string, isServer: boolean, data: any } }[] }
-- to: string - The email address to send the mail to
-- sender: string - The sender of the email, optional
-- subject: string - The subject of the email
-- message: string - The message of the email
-- attachments: string[] - URLs of the attachments, optional
-- actions: { label: string, data: { event: string, isServer: boolean, data: any } }[] - Actions (buttons) that the user can interact with, optional
-- return: success: boolean, id?: string
local success, id = exports["lb-phone"]:SendMail(data)

DeleteMail

-- id: string
-- return: boolean
exports["lb-phone"]:DeleteMail(id)

Messages/SMS

SendMessage

-- from: string - The sender's phone number
-- to: string - The recipient's phone number
-- message: string - The message content
-- attachments?: string[] - URLs of the attachments, optional
-- cb?: function - The callback function
-- channelId?: number - The channel ID to send the message to, optional
-- return?: { channelId: number, messageId: number }
local result = exports["lb-phone"]:SendMessage(from, to, message, attachments, cb, channelId)

SentMoney

Used to send a message to a player indicating that they have received money

-- from: string - The sender's phone number
-- to: string - The recipient's phone number
-- amount: number - The amount of money sent
exports["lb-phone"]:SentMoney(from, to, amount)

SendCoords

-- from: string - The sender's phone number
-- to: string - The recipient's phone number
-- coords: vector2
exports["lb-phone"]:SendCoords(from, to, coords)

DarkChat

SendDarkChatMessage

-- username: string
-- channel: string
-- message: string
-- cb?: function(success: boolean)
-- return: boolean
local success = exports["lb-phone"]:SendDarkChatMessage(username, channel, message, cb?)

SendDarkChatLocation

-- username: string
-- channel: string
-- coords: vector2
-- cb?: function(success: boolean)
local success = exports["lb-phone"]:SendDarkChatLocation(username, channel, coords, cb?)

Battery

SaveBattery

-- phoneNumber: string
exports["lb-phone"]:SaveBattery(phoneNumber)

SaveAllBatteries

exports["lb-phone"]:SaveAllBatteries()

IsPhoneDead

-- phoneNumber: string
-- return: boolean
local dead = exports["lb-phone"]:IsPhoneDead(phoneNumber)

Calls

CreateCall

Creates a call that is not shown on the phone UI, e.g. for payphones

-- caller: { source: number, phoneNumber: string }
-- callee?: string - The phone number of the person being called
-- options?: { requirePhone?: boolean, hideNumber?: boolean, company?: string }
-- return: number
local callId = exports["lb-phone"]:CreateCall({
    phoneNumber = "Abc 123",
    source = src
}, number, {
    requirePhone = false,
    hideNumber = true
})

GetCall

-- callId: number
-- return: table
local call = exports["lb-phone"]:GetCall(callId)
 
if call then
    print(json.encode(call, { indent = true }))
end

EndCall

-- source: number
exports["lb-phone"]:EndCall(source)

IsInCall

-- source: number
-- return: boolean
local inCall = exports["lb-phone"]:IsInCall(source)

Crypto

AddCrypto

-- source: number
-- coin: string
-- amount: number
-- return boolean
local success = exports["lb-phone"]:AddCrypto(source, coin, amount)

RemoveCrypto

-- source: number
-- coin: string
-- amount: number
-- return boolean
local success = exports["lb-phone"]:RemoveCrypto(source, coin, amount)

AddCustomCoin

-- id: string
-- name: string
-- symbol: string
-- image: string
-- currentPrice: number
-- prices: number[]
-- change24h: number
exports["lb-phone"]:AddCustomCoin(id, name, symbol, image, currentPrice, prices, change24h)

GetCoin

-- id: string
-- return: { id: string, name: string, symbol: string, image: string, current_price: number, prices: number[], change_24h: number }
local value = exports["lb-phone"]:GetCoinValue(id)