TikTok support

This commit is contained in:
Levi 2022-09-26 17:33:10 +02:00
parent cc0be55439
commit c7e9f1ba5b
4 changed files with 33 additions and 7 deletions

View file

@ -2,5 +2,6 @@
"token": "your-token-goes-here",
"port": "4000",
"tweetParser": "https://fxtwitter.com/",
"instaParser": "https://ddinstagram.com/"
}
"instaParser": "https://ddinstagram.com/",
"tiktokParser": "https://www.vxtiktok.com/"
}

View file

@ -1,6 +1,11 @@
// Require the necessary discord.js classes
const { Client, GatewayIntentBits } = require('discord.js');
const { token, port, tweetParser, instaParser } = require('./config.json');
const {
token,
port,
tweetParser,
instaParser,
tiktokParser,
} = require('./config.json');
const http = require('http');
// Create a new client instance
const client = new Client({
@ -63,5 +68,25 @@ client.on('messageCreate', async message => {
}
});
client.on('messageCreate', async message => {
if (message.content.startsWith('https://tiktok.com/')) {
const tiktokURL = message.content.substring(19, message.content.length);
message.suppressEmbeds(true);
const newmsg = tiktokParser + tiktokURL;
message.reply({ content: newmsg, allowedMentions: { repliedUser: false } });
}
});
client.on('messageCreate', async message => {
if (message.content.startsWith('https://www.tiktok.com/')) {
const tiktokURL2 = message.content.substring(23, message.content.length);
message.suppressEmbeds(true);
const newmsg = tiktokParser + tiktokURL2;
message.reply({ content: newmsg, allowedMentions: { repliedUser: false } });
}
});
// Login to Discord with your client's token
client.login(token);
client.login(token);

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "mediafixer",
"version": "1.2.4",
"version": "1.2.5",
"lockfileVersion": 2,
"requires": true,
"packages": {

View file

@ -1,6 +1,6 @@
{
"name": "mediafixer",
"version": "1.2.4",
"version": "1.2.5",
"description": "Fixes broken twitter embeds by replying with a reformatted link.",
"main": "index.js",
"scripts": {