feat(Phone.GetPhoneName)

This commit is contained in:
MrNewb committed 2025-06-05 03:10:18 -04:00
1 parent 9a4ab4cdd5
commit a4988fb7e3
10 files changed
+103 -30

No files matched your search

+12 -1
View File
@@ -1,6 +1,17 @@
---@diagnostic disable: duplicate-set-field
Phone = Phone or {} Phone = Phone or {}
---@diagnostic disable-next-line: duplicate-set-field ---This will get the name of the Phone system being being used.
---@return string
Phone.GetPhoneName = function()
return 'default'
end
---This will send an email to the passed email address with the title and message.
---@param email string
---@param title string
---@param message string
---@return boolean
Phone.SendEmail = function(email, title, message) Phone.SendEmail = function(email, title, message)
return false, Print.Error('There Is No Phone Bridged.') return false, Print.Error('There Is No Phone Bridged.')
end end
+16 -2
View File
@@ -1,11 +1,25 @@
---@diagnostic disable: duplicate-set-field
Phone = Phone or {} Phone = Phone or {}
---@diagnostic disable-next-line: duplicate-set-field ---This will get the name of the Phone system being being used.
---@return string
Phone.GetPhoneName = function()
return 'default'
end
---This will get the phone number of the passed source.
---@param src number
---@return number|boolean
Phone.GetPlayerPhone = function(src) Phone.GetPlayerPhone = function(src)
return false, Print.Error('There Is No Phone Bridged.') return false, Print.Error('There Is No Phone Bridged.')
end end
---@diagnostic disable-next-line: duplicate-set-field ---This will send an email to the passed source, email address, title and message.
---@param src number
---@param email string
---@param title string
---@param message string
---@return boolean
Phone.SendEmail = function(src, email, title, message) Phone.SendEmail = function(src, email, title, message)
return false, Print.Error('There Is No Phone Bridged.') return false, Print.Error('There Is No Phone Bridged.')
end end
+8 -2
View File
@@ -1,14 +1,20 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "gksphone" local resourceName = "gksphone"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
Phone = Phone or {} Phone = Phone or {}
---comment ---This will get the name of the Phone system being being used.
---@return string
Phone.GetPhoneName = function()
return resourceName
end
---This will send an email to the passed email address with the title and message.
---@param email string ---@param email string
---@param title string ---@param title string
---@param message string ---@param message string
---@return boolean ---@return boolean
---@diagnostic disable-next-line: duplicate-set-field
Phone.SendEmail = function(email, title, message) Phone.SendEmail = function(email, title, message)
return exports["gksphone"]:SendNewMail({ sender = email, image = '/html/static/img/icons/mail.png', subject = title, message = message }) return exports["gksphone"]:SendNewMail({ sender = email, image = '/html/static/img/icons/mail.png', subject = title, message = message })
end end
+10 -5
View File
@@ -1,22 +1,27 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "gksphone" local resourceName = "gksphone"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
Phone = Phone or {} Phone = Phone or {}
---comment ---This will get the name of the Phone system being being used.
---@return string
Phone.GetPhoneName = function()
return resourceName
end
---This will get the phone number of the passed source.
---@param src number ---@param src number
---@return number| boolean ---@return number|boolean
---@diagnostic disable-next-line: duplicate-set-field
Phone.GetPlayerPhone = function(src) Phone.GetPlayerPhone = function(src)
return exports["gksphone"]:GetPhoneBySource(src) or false return exports["gksphone"]:GetPhoneBySource(src) or false
end end
---comment ---This will send an email to the passed source, email address, title and message.
---@param src number ---@param src number
---@param email string ---@param email string
---@param title string ---@param title string
---@param message string ---@param message string
---@return boolean ---@return boolean
---@diagnostic disable-next-line: duplicate-set-field
Phone.SendEmail = function(src, email, title, message) Phone.SendEmail = function(src, email, title, message)
local data = {} local data = {}
data.sender = email data.sender = email
+9 -3
View File
@@ -1,13 +1,19 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "lb-phone" local resourceName = "lb-phone"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
Phone = Phone or {} Phone = Phone or {}
---comment ---This will get the name of the Phone system being being used.
---@return string
Phone.GetPhoneName = function()
return resourceName
end
---This will send an email to the passed email address with the title and message.
---@param email string ---@param email string
---@param title string ---@param title string
---@param message string ---@param message string
---@return nil ---@return boolean
---@diagnostic disable-next-line: duplicate-set-field
Phone.SendEmail = function(email, title, message) Phone.SendEmail = function(email, title, message)
TriggerServerEvent('community_bridge:Server:genericEmail', {email = email, title = title, message = message}) TriggerServerEvent('community_bridge:Server:genericEmail', {email = email, title = title, message = message})
end end
+11 -3
View File
@@ -1,19 +1,27 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "lb-phone" local resourceName = "lb-phone"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
Phone = Phone or {} Phone = Phone or {}
---@diagnostic disable-next-line: duplicate-set-field ---This will get the name of the Phone system being being used.
---@return string
Phone.GetPhoneName = function()
return resourceName
end
---This will get the phone number of the passed source.
---@param src number
---@return number|boolean
Phone.GetPlayerPhone = function(src) Phone.GetPlayerPhone = function(src)
return exports["lb-phone"]:GetEquippedPhoneNumber(src) or false return exports["lb-phone"]:GetEquippedPhoneNumber(src) or false
end end
---comment ---This will send an email to the passed source, email address, title and message.
---@param src number ---@param src number
---@param email string ---@param email string
---@param title string ---@param title string
---@param message string ---@param message string
---@return boolean ---@return boolean
---@diagnostic disable-next-line: duplicate-set-field
Phone.SendEmail = function(src, email, title, message) Phone.SendEmail = function(src, email, title, message)
local numberNumber = exports["lb-phone"]:GetEquippedPhoneNumber(src) local numberNumber = exports["lb-phone"]:GetEquippedPhoneNumber(src)
if not numberNumber then return false, Prints.Error("Could not Find Phone number") end if not numberNumber then return false, Prints.Error("Could not Find Phone number") end
+8 -2
View File
@@ -1,13 +1,19 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "okokPhone" local resourceName = "okokPhone"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
Phone = Phone or {} Phone = Phone or {}
---comment ---This will get the name of the Phone system being being used.
---@return string
Phone.GetPhoneName = function()
return resourceName
end
---This will send an email to the passed email address with the title and message.
---@param email string ---@param email string
---@param title string ---@param title string
---@param message string ---@param message string
---@return boolean ---@return boolean
---@diagnostic disable-next-line: duplicate-set-field
Phone.SendEmail = function(email, title, message) Phone.SendEmail = function(email, title, message)
--<-- TODO swap to internal callback system --<-- TODO swap to internal callback system
local success = lib.callback.await('community_bridge:Callback:okokPhone:sendEmail', false, email, title, message) --[[ @as boolean ]] local success = lib.callback.await('community_bridge:Callback:okokPhone:sendEmail', false, email, title, message) --[[ @as boolean ]]
+10 -5
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
---@class NewEmail ---@class NewEmail
---@field sender string ---@field sender string
---@field recipients string[] ---@field recipients string[]
@@ -17,21 +18,25 @@ local resourceName = "okokPhone"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
Phone = Phone or {} Phone = Phone or {}
---comment ---This will get the name of the Phone system being being used.
---@return string
Phone.GetPhoneName = function()
return resourceName
end
---This will get the phone number of the passed source.
---@param src number ---@param src number
---@return number| boolean ---@return number|boolean
---@diagnostic disable-next-line: duplicate-set-field
Phone.GetPlayerPhone = function(src) Phone.GetPlayerPhone = function(src)
return exports.okokPhone:getPhoneNumberFromSource(src) or false return exports.okokPhone:getPhoneNumberFromSource(src) or false
end end
---comment ---This will send an email to the passed source, email address, title and message.
---@param src number ---@param src number
---@param email string ---@param email string
---@param title string ---@param title string
---@param message string ---@param message string
---@return boolean ---@return boolean
---@diagnostic disable-next-line: duplicate-set-field
Phone.SendEmail = function(src, email, title, message) Phone.SendEmail = function(src, email, title, message)
local senderAddress = exports.okokPhone:getEmailAddressFromSource(src) --[[ @as string? ]] local senderAddress = exports.okokPhone:getEmailAddressFromSource(src) --[[ @as string? ]]
if not senderAddress then return false end if not senderAddress then return false end
+9 -3
View File
@@ -1,13 +1,19 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "qs-smartphone" local resourceName = "qs-smartphone"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
Phone = Phone or {} Phone = Phone or {}
---comment ---This will get the name of the Phone system being being used.
---@return string
Phone.GetPhoneName = function()
return resourceName
end
---This will send an email to the passed email address with the title and message.
---@param email string ---@param email string
---@param title string ---@param title string
---@param message string ---@param message string
---@return nil ---@return boolean
---@diagnostic disable-next-line: duplicate-set-field
Phone.SendEmail = function(email, title, message) Phone.SendEmail = function(email, title, message)
return true, TriggerServerEvent('qs-smartphone:server:sendNewMail', { sender = email, subject = title, message = message, button = {} }) return true, TriggerServerEvent('qs-smartphone:server:sendNewMail', { sender = email, subject = title, message = message, button = {} })
end end
+10 -4
View File
@@ -1,16 +1,22 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "qs-smartphone" local resourceName = "qs-smartphone"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
Phone = Phone or {} Phone = Phone or {}
---comment ---This will get the name of the Phone system being being used.
---@return string
Phone.GetPhoneName = function()
return resourceName
end
---This will get the phone number of the passed source.
---@param src number ---@param src number
---@return number||boolean ---@return number|boolean
---@diagnostic disable-next-line: duplicate-set-field
Phone.GetPlayerPhone = function(src) Phone.GetPlayerPhone = function(src)
return exports['qs-base']:GetPlayerPhone(src) or false return exports['qs-base']:GetPlayerPhone(src) or false
end end
---comment ---This will send an email to the passed source, email address, title and message.
---@param src number ---@param src number
---@param email string ---@param email string
---@param title string ---@param title string