push latest
This commit is contained in:
parent
1d839edd35
commit
f34811fe80
@ -12,9 +12,9 @@
|
|||||||
"axios": "^1.7.7",
|
"axios": "^1.7.7",
|
||||||
"discord.js": "^14.16.3",
|
"discord.js": "^14.16.3",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
"unirest": "^0.6.0",
|
"express": "^4.21.2",
|
||||||
"express": "^4.18.2",
|
|
||||||
"mongoose": "^7.0.4",
|
"mongoose": "^7.0.4",
|
||||||
"shortid": "^2.2.16"
|
"shortid": "^2.2.16",
|
||||||
|
"unirest": "^0.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,12 +21,10 @@ db.once('open', () => {
|
|||||||
|
|
||||||
// Supported domains
|
// Supported domains
|
||||||
const supportedDomains = [
|
const supportedDomains = [
|
||||||
's.shells.lol',
|
's.dcord.lol',
|
||||||
's.hehe.rest',
|
's.peer.rest',
|
||||||
's.dcord.rest', // default domain
|
's.njs.lol', // default domain
|
||||||
's.nodejs.lol',
|
's.dlinux.pro'
|
||||||
's.dht.rest',
|
|
||||||
's.tcp.quest'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// Middleware to check API key
|
// Middleware to check API key
|
||||||
@ -48,7 +46,7 @@ app.post('/api/shorturl', validateApiKey, async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate domain, default to 's.dcord.rest' if not provided or invalid
|
// Validate domain, default to 's.dcord.rest' if not provided or invalid
|
||||||
const selectedDomain = supportedDomains.includes(domain) ? domain : 's.dcord.rest';
|
const selectedDomain = supportedDomains.includes(domain) ? domain : 's.dlinux.pro';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let url = await Url.findOne({ longUrl });
|
let url = await Url.findOne({ longUrl });
|
||||||
|
12
short.js
12
short.js
@ -28,12 +28,10 @@ client.once('ready', async () => {
|
|||||||
.setDescription('Choose the domain for the short URL')
|
.setDescription('Choose the domain for the short URL')
|
||||||
.setRequired(false)
|
.setRequired(false)
|
||||||
.addChoices(
|
.addChoices(
|
||||||
{ name: 's.shells.lol', value: 's.shells.lol' },
|
{ name: 's.dcord.lol', value: 's.dcord.lol' },
|
||||||
{ name: 's.hehe.rest', value: 's.hehe.rest' },
|
{ name: 's.peer.rest', value: 's.peer.rest' },
|
||||||
{ name: 's.dcord.rest', value: 's.dcord.rest' }, // default domain
|
{ name: 's.njs.lol', value: 's.njs.lol' },
|
||||||
{ name: 's.nodejs.lol', value: 's.nodejs.lol' },
|
{ name: 's.dlinux.pro', value: 's.dlinux.pro' }
|
||||||
{ name: 's.dht.rest', value: 's.dht.rest' },
|
|
||||||
{ name: 's.tcp.quest', value: 's.tcp.quest' }
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.toJSON(); // Convert to JSON
|
.toJSON(); // Convert to JSON
|
||||||
@ -58,7 +56,7 @@ client.once('ready', async () => {
|
|||||||
client.on('interactionCreate', async interaction => {
|
client.on('interactionCreate', async interaction => {
|
||||||
if (!interaction.isCommand() || interaction.commandName !== 'shortenurl') return;
|
if (!interaction.isCommand() || interaction.commandName !== 'shortenurl') return;
|
||||||
|
|
||||||
const domain = interaction.options.getString('domain') || 's.dcord.rest';
|
const domain = interaction.options.getString('domain') || 's.dlinux.pro';
|
||||||
const url = interaction.options.getString('url');
|
const url = interaction.options.getString('url');
|
||||||
|
|
||||||
// Validate the URL format before proceeding
|
// Validate the URL format before proceeding
|
||||||
|
Loading…
x
Reference in New Issue
Block a user