feat: Comando de acortar enlaces!

This commit is contained in:
2022-08-07 16:54:05 +02:00
parent e1d9342beb
commit f691dc3d09
6 changed files with 30 additions and 1943 deletions

View File

@@ -1,4 +1,5 @@
TOKEN=token
PREFIX=v!
MONGODB=mongodb://
HYPIXEL_API=API_KEY
HYPIXEL_API=API_KEY
YOURLS_KEY=YOURLS_SIGNATURE

24
commands/misc/shorten.ts Normal file
View File

@@ -0,0 +1,24 @@
const { commandModule, CommandType } = require('@sern/handler');
import axios, { AxiosError, AxiosResponse } from "axios";
import { ApplicationCommandOptionType } from "discord.js";
import { publish } from "../../src/plugins/publish";
export default commandModule({
name: 'acortar',
type: CommandType.Both,
plugins: [publish(['1000400148289036298', '928018226330337280'])],
description: 'Acorta una URL a vinci.tk',
options: [
{
name: 'url',
description: 'la URL larga',
type: ApplicationCommandOptionType.String,
required: true
}
],
//alias : [],
execute: async (ctx, options) => {
const url = options[1].getString('url', true);
const request = await axios(`https://vinci.tk/yourls-api.php?signature=${process.env.YOURLS_KEY}&action=shorturl&format=json&url=${url}`, {validateStatus: function (status) {return status === 200|| status === 400; }}).then((res: AxiosResponse) => res.data)
ctx.reply({content: `URL acortada: ${request.shorturl}\nURL original: ${url}`, ephemeral: true});
}})

View File

@@ -10,7 +10,7 @@ export default commandModule({
name: 'ping',
type: CommandType.Both,
plugins: [publish(['1000400148289036298'])],
// 928018226330337280
// , '928018226330337280'
description: 'A ping command',
//alias : [],
execute: async (ctx, args) => {

View File

@@ -7,6 +7,4 @@ export default eventModule({
execute(err) {
console.log(err);
}
})
})

1933
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -21,17 +21,12 @@
},
"homepage": "https://github.com/SrIzan10/vinci#readme",
"dependencies": {
"@discordjs/opus": "^0.8.0",
"@sern/handler": "^1.1.8-beta",
"@tmware/status-rotate": "^1.2.10",
"axios": "^0.27.2",
"date-and-time": "^2.4.1",
"discord-giveaways": "^6.0.1",
"discord.js": "^14.1.2",
"dotenv": "^16.0.1",
"fs": "^0.0.1-security",
"mongoose": "^6.5.1",
"ms": "^2.1.3",
"util": "^0.12.4"
"ms": "^2.1.3"
}
}