Compare commits
No commits in common. "b095d5ce3a045cc22f5d7fa67f2042c1ed01a2d0" and "50e49db47c30c1476e1c99f20d2c4a6b541f5d13" have entirely different histories.
b095d5ce3a
...
50e49db47c
2 changed files with 4 additions and 15 deletions
|
@ -167,7 +167,7 @@ export default {
|
||||||
|
|
||||||
const tweetid = tweeted.data.id;
|
const tweetid = tweeted.data.id;
|
||||||
const FunnyWords = ['oppaGangnamStyle', '69', '420', 'cum', 'funnyMan', 'GUCCISmartToilet', 'TwitterForClowns', 'fart', 'ok', 'hi', 'howAreYou', 'WhatsNinePlusTen', '21'];
|
const FunnyWords = ['oppaGangnamStyle', '69', '420', 'cum', 'funnyMan', 'GUCCISmartToilet', 'TwitterForClowns', 'fart', 'ok', 'hi', 'howAreYou', 'WhatsNinePlusTen', '21'];
|
||||||
const TweetLink = `https://vxtwitter.com/${FunnyWords[Math.floor((Math.random() * FunnyWords.length))]}/status/${tweetid}`;
|
const TweetLink = `https://twitter.com/${FunnyWords[Math.floor((Math.random() * FunnyWords.length))]}/status/${tweetid}`;
|
||||||
|
|
||||||
let channel = await client.channels.resolve(twiChannel);
|
let channel = await client.channels.resolve(twiChannel);
|
||||||
channel.send(TweetLink);
|
channel.send(TweetLink);
|
||||||
|
|
|
@ -15,10 +15,6 @@ export default {
|
||||||
option.setName('url')
|
option.setName('url')
|
||||||
.setDescription('URL of the video you want to convert')
|
.setDescription('URL of the video you want to convert')
|
||||||
.setRequired(true))
|
.setRequired(true))
|
||||||
.addIntegerOption(option =>
|
|
||||||
option.setName('quality')
|
|
||||||
.setDescription('Quality of the gif conversion. Default 70. Number between 1 and 100')
|
|
||||||
.setRequired(false))
|
|
||||||
.addBooleanOption(option =>
|
.addBooleanOption(option =>
|
||||||
option.setName('noloop')
|
option.setName('noloop')
|
||||||
.setDescription('Stop the gif from looping')
|
.setDescription('Stop the gif from looping')
|
||||||
|
@ -29,13 +25,6 @@ export default {
|
||||||
await interaction.deferReply({ ephemeral: false });
|
await interaction.deferReply({ ephemeral: false });
|
||||||
const maxFileSize = await utils.getMaxFileSize(interaction.guild);
|
const maxFileSize = await utils.getMaxFileSize(interaction.guild);
|
||||||
const url = args.url;
|
const url = args.url;
|
||||||
let quality = args.quality;
|
|
||||||
if (quality <= 0) {
|
|
||||||
quality = 1;
|
|
||||||
}
|
|
||||||
else if (quality > 100) {
|
|
||||||
quality = 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!await utils.stringIsAValidurl(url)) {
|
if (!await utils.stringIsAValidurl(url)) {
|
||||||
console.error(`Not a url!!! ${url}`);
|
console.error(`Not a url!!! ${url}`);
|
||||||
|
@ -52,7 +41,7 @@ export default {
|
||||||
// Extract every frame for gifski
|
// Extract every frame for gifski
|
||||||
await utils.ffmpeg(`-i ${output} ${os.tmpdir()}/frame${interaction.id}%04d.png`);
|
await utils.ffmpeg(`-i ${output} ${os.tmpdir()}/frame${interaction.id}%04d.png`);
|
||||||
// Make it look better
|
// Make it look better
|
||||||
await gifski(gifskiOutput, `${os.tmpdir()}/frame${interaction.id}*`, quality);
|
await gifski(gifskiOutput, `${os.tmpdir()}/frame${interaction.id}*`);
|
||||||
// Optimize it
|
// Optimize it
|
||||||
await gifsicle(gifskiOutput, gifsicleOutput, args.noloop);
|
await gifsicle(gifskiOutput, gifsicleOutput, args.noloop);
|
||||||
|
|
||||||
|
@ -77,9 +66,9 @@ export default {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
async function gifski(output, input, quality) {
|
async function gifski(output, input) {
|
||||||
return await new Promise((resolve, reject) => {
|
return await new Promise((resolve, reject) => {
|
||||||
exec(`gifski --quality ${quality ? quality : 70} -o ${output} ${input}`, (err, stdout, stderr) => {
|
exec(`gifski --quality 70 -o ${output} ${input}`, (err, stdout, stderr) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
reject(stderr);
|
reject(stderr);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue