Another Fix

This commit is contained in:
Christopher Cookman 2025-11-21 22:27:46 -07:00
parent b92736997f
commit 37743b593b
3 changed files with 97 additions and 39 deletions

View file

@ -44,39 +44,7 @@ module.exports = {};
module.exports.execute = async (interaction) => {
interaction.channel.send({
embeds: [{
"title": "The LiteNet Community PBX",
"description": "The LiteNet Community PBX is hosted through, and is sponsored by Snakecraft Hosting!\nOffering affordable game hosting, Discord bot hosting, and VPS services since 2020.\nGet started at https://go.litenet.tel/sch-affiliate\nCheck them out on [Discord](https://discord.gg/nZFQTaZWqT)\n\n-# The link above is an affiliate link. We will receive credits from any purchase made via this link.\n-# Snakecraft Hosting has no administrative control over, nor has access to private information stored on LiteNet. Snakecraft Hosting provides hosting for LiteNet free of charge. Specific details regarding their affiliate program can be found [here](https://my.snakecrafthosting.com/index.php?rp=/knowledgebase/4/Affiliate-Program-FAQs.html)",
"color": 7955428,
"fields": [
{
"name": "What's this?",
"value": "The community PBX is a public, free to use [FreePBX](https://freepbx.org) based phone system that any server member is welcome to get a number on!\nEveryone on the system has their own 4 digit number, that can be used to call between other members on the system.\nThe PBX runs on a Snakecraft Hosting VPS graciously provided to us at no cost!"
},
{
"name": "What can it do?",
"value": "The LiteNet phone system offers many features, including but not limited to the following:\n- Free inbound/outbound calling via +1 (610) LITENET (548-3638)\n- Private Voicemail\n- Intercom/Paging\n- Conference Rooms\n- Direct dial access to [AstroCom](https://astrocom.tel)\n- [Full extension status page](https://pbx.litenet.tel/status)\n- And more!"
},
{
"name": "Privacy Policy",
"value": "LiteNet respects the privacy of all members, and as such, only very few select staff members have access to the system files directly. Voicemails are not tracked nor listened to under any circumstances. Call logs are kept and only reviewed during investigations into violations of community guidelines, or possible illegal activity. Call recordings may be kept at the request of any individual member, and will NOT be reviewed unless prior permission was given from said member.\nAll user data may be deleted by request, or by simply running the `/delete` command.\n\nIf you believe your privacy has been violated in any way, please don't hesistate to reach out to any of our staff members!"
},
{
"name": "Can it do `X`?",
"value": "Any specific questions are welcome to be asked in our <#1102782499756724239> chat!\nIf you have a suggestion for something we should add to the PBX or Discord server, feel free to leave it in <#1148099609428762634>!"
}
],
"footer": {
"text": "Made with <3 by Chris Chrome & The LiteNet Team • Sponsored by Snakecraft Hosting",
"icon_url": "https://f.chrischro.me/assets/Snakecraft-Social-Media-purple-v2-smaller.png"
},
"image": {
"url": "https://f.chrischro.me/assets/litenet-full.png"
},
"thumbnail": {
"url": "https://f.chrischro.me/assets/Snakecraft-Social-Media-purple-v2-smaller-rounder.png"
}
}],
embeds: [{ "title": "The LiteNet Community PBX", "description": "The LiteNet Community PBX is hosted through, and is sponsored by RackGenius!\nOffering affordable game hosting, Discord bot hosting, and VPS services since 2020.\nGet started at https://go.litenet.tel/affiliate\nCheck them out on [Discord](https://discord.gg/nZFQTaZWqT)\n\n-# The link above is an affiliate link. We will receive credits from any purchase made via this link.\n-# RackGenius has no administrative control over, nor has access to private information stored on LiteNet. RackGenius provides hosting for LiteNet free of charge. Specific details regarding their affiliate program can be found [here](https://my.rackgenius.com/index.php?rp=/knowledgebase/4/Affiliate-Program-FAQs.html)", "footer": { "text": "Made with <3 by Chris Chrome & The LiteNet Team • Sponsored by RackGenius", "iconURL": "https://dingus.chrischro.me/raw/bfafda4c-9a2f-4f1e-8e78-fec2df7836f3.png" }, "timestamp": "2025-05-26T04:26:03.819Z", "thumbnail": { "url": "https://dingus.chrischro.me/raw/bfafda4c-9a2f-4f1e-8e78-fec2df7836f3.png" }, "image": { "url": "https://dingus.chrischro.me/raw/54d12d28-6a88-46b8-a95e-dc8c1f346cd6.png" }, "fields": [{ "name": "What's this?", "value": "The community PBX is a public, free to use [FreePBX](https://freepbx.org) based phone system that any server member is welcome to get a number on!\nEveryone on the system has their own 4 digit number, that can be used to call between other members on the system.\nThe PBX runs on a RackGenius VPS graciously provided to us at no cost!", "inline": false }, { "name": "What can it do?", "value": "The LiteNet phone system offers many features, including but not limited to the following:\n- Free inbound/outbound calling via +1 (610) LITENET (548-3638)\n- Private Voicemail\n- Intercom/Paging\n- Conference Rooms\n- Direct dial access to [AstroCom](https://astrocom.tel)\n- [Full extension status page](https://pbx.litenet.tel/status)\n- And more!", "inline": false }, { "name": "Privacy Policy", "value": "LiteNet respects the privacy of all members, and as such, only very few select staff members have access to the system files directly. Voicemails are not tracked nor listened to under any circumstances. Call logs are kept and only reviewed during investigations into violations of community guidelines, or possible illegal activity. Call recordings may be kept at the request of any individual member, and will NOT be reviewed unless prior permission was given from said member.\nAll user data may be deleted by request, or by simply running the `/delete` command.\n\nIf you believe your privacy has been violated in any way, please don't hesistate to reach out to any of our staff members!", "inline": false }, { "name": "Call Recording Notice", "value": "Due to repeated issues with prank and spam calling in the past via the PSTN, all inbound and outbound calls are recorded. Recordings are retained for seven (7) days from the end of the call. If you have any questions, please reach out via a support ticket!", "inline": false }, { "name": "Can it do `X`?", "value": "Any specific questions are welcome to be asked in our <#1102782499756724239> chat!\nIf you have a suggestion for something we should add to the PBX or Discord server, feel free to leave it in <#1148099609428762634>!", "inline": false }] }],
components: [
{
type: 1,
@ -106,4 +74,67 @@ module.exports.execute = async (interaction) => {
}
]
})
// interaction.channel.send({ // Old embed before sponsorship change
// embeds: [{
// "title": "The LiteNet Community PBX",
// "description": "The LiteNet Community PBX is hosted through, and is sponsored by Snakecraft Hosting!\nOffering affordable game hosting, Discord bot hosting, and VPS services since 2020.\nGet started at https://go.litenet.tel/sch-affiliate\nCheck them out on [Discord](https://discord.gg/nZFQTaZWqT)\n\n-# The link above is an affiliate link. We will receive credits from any purchase made via this link.\n-# Snakecraft Hosting has no administrative control over, nor has access to private information stored on LiteNet. Snakecraft Hosting provides hosting for LiteNet free of charge. Specific details regarding their affiliate program can be found [here](https://my.snakecrafthosting.com/index.php?rp=/knowledgebase/4/Affiliate-Program-FAQs.html)",
// "color": 7955428,
// "fields": [
// {
// "name": "What's this?",
// "value": "The community PBX is a public, free to use [FreePBX](https://freepbx.org) based phone system that any server member is welcome to get a number on!\nEveryone on the system has their own 4 digit number, that can be used to call between other members on the system.\nThe PBX runs on a Snakecraft Hosting VPS graciously provided to us at no cost!"
// },
// {
// "name": "What can it do?",
// "value": "The LiteNet phone system offers many features, including but not limited to the following:\n- Free inbound/outbound calling via +1 (610) LITENET (548-3638)\n- Private Voicemail\n- Intercom/Paging\n- Conference Rooms\n- Direct dial access to [AstroCom](https://astrocom.tel)\n- [Full extension status page](https://pbx.litenet.tel/status)\n- And more!"
// },
// {
// "name": "Privacy Policy",
// "value": "LiteNet respects the privacy of all members, and as such, only very few select staff members have access to the system files directly. Voicemails are not tracked nor listened to under any circumstances. Call logs are kept and only reviewed during investigations into violations of community guidelines, or possible illegal activity. Call recordings may be kept at the request of any individual member, and will NOT be reviewed unless prior permission was given from said member.\nAll user data may be deleted by request, or by simply running the `/delete` command.\n\nIf you believe your privacy has been violated in any way, please don't hesistate to reach out to any of our staff members!"
// },
// {
// "name": "Can it do `X`?",
// "value": "Any specific questions are welcome to be asked in our <#1102782499756724239> chat!\nIf you have a suggestion for something we should add to the PBX or Discord server, feel free to leave it in <#1148099609428762634>!"
// }
// ],
// "footer": {
// "text": "Made with <3 by Chris Chrome & The LiteNet Team • Sponsored by Snakecraft Hosting",
// "icon_url": "https://f.chrischro.me/assets/Snakecraft-Social-Media-purple-v2-smaller.png"
// },
// "image": {
// "url": "https://f.chrischro.me/assets/litenet-full.png"
// },
// "thumbnail": {
// "url": "https://f.chrischro.me/assets/Snakecraft-Social-Media-purple-v2-smaller-rounder.png"
// }
// }],
// components: [
// {
// type: 1,
// components: [
// {
// type: Discord.ComponentType.Button,
// label: "Get an Extension",
// emoji: "✅",
// style: Discord.ButtonStyle.Success,
// custom_id: "newExtension"
// },
// {
// type: Discord.ComponentType.Button,
// label: "Get your extension info",
// emoji: "",
// style: Discord.ButtonStyle.Primary,
// custom_id: "getExtensionInfo"
// },
// {
// type: Discord.ComponentType.Button,
// label: "Reset Password",
// emoji: "🔄",
// style: Discord.ButtonStyle.Danger,
// custom_id: "resetPassword"
// }
// ]
// }
// ]
// })
}

View file

@ -14,7 +14,7 @@ module.exports.execute = async (interaction) => {
}
await interaction.editReply({ content: `Finding available extension`, ephemeral: true });
fpbx.getNextAvailableExtension().then(async (nextExt) => {
await interaction.editReply({ content: `Found ${nextExt}. Creating..`, ephemeral: true });
await interaction.editReply({ content: `Found ${nextExt}. Creating..`, ephemeral: true });
fpbx.addExtension(nextExt, interaction.user.username).then(async (res) => {
if (res.addExtension.status != true) {
await interaction.editReply({ content: `Something went wrong :(`, ephemeral: true });
@ -24,11 +24,28 @@ module.exports.execute = async (interaction) => {
await interaction.editReply({ content: `Extension ${nextExt} created! Getting info..`, ephemeral: true });
await fpbx.reload();
const extInfo = await fpbx.getExtension(nextExt);
await interaction.editReply({ embeds: [{
title: "Your Extension Info",
description: `**PBX Address:** \`${process.env.PBX_HOSTNAME}\`\n**Extension:** \`${extInfo.fetchExtension.user.extension}\`\n**Name:** \`${extInfo.fetchExtension.user.name}\`\n**Password:** ||\`${extInfo.fetchExtension.user.extPassword}\`||`,
color: 0x00ff00
}], ephemeral: true })
await interaction.editReply({
embeds: [{
title: "Your Extension Info",
description: `**PBX Address:** \`${process.env.PBX_HOSTNAME}\`\n**Extension:** \`${extInfo.fetchExtension.user.extension}\`\n**Name:** \`${extInfo.fetchExtension.user.name}\`\n**Password:** ||\`${extInfo.fetchExtension.user.extPassword}\`||`,
color: 0x00ff00
}],
components: [
{
type: 1,
components: [
{
type: Discord.ComponentType.Button,
label: "Reset Password",
emoji: "🔄",
style: Discord.ButtonStyle.Danger,
custom_id: "resetPassword"
}
]
}
],
ephemeral: true
})
if (process.env.EXTENSION_ROLE_ID) await interaction.member.roles.add(process.env.EXTENSION_ROLE_ID);
}).catch(async (error) => {
log.error(error);

View file

@ -0,0 +1,10 @@
INSERT INTO userman_users (username, auth)
SELECT du.extension, '1'
FROM discord_users du
LEFT JOIN userman_users uu
ON uu.username = du.extension
WHERE uu.username IS NULL;
-- Some context for those wondering why this is here.
-- FreePBX's GraphQL API, for some reason, REQUIRES a userman user to exist for each extension before it'll allow you to update the name or password via GraphQL.
-- Fuck FreePBX GQL.