mirror of
https://github.com/LeviSnoot/MediaFixer.git
synced 2024-12-02 18:00:02 +01:00
TikTok support
This commit is contained in:
parent
cc0be55439
commit
c7e9f1ba5b
4 changed files with 33 additions and 7 deletions
|
@ -2,5 +2,6 @@
|
||||||
"token": "your-token-goes-here",
|
"token": "your-token-goes-here",
|
||||||
"port": "4000",
|
"port": "4000",
|
||||||
"tweetParser": "https://fxtwitter.com/",
|
"tweetParser": "https://fxtwitter.com/",
|
||||||
"instaParser": "https://ddinstagram.com/"
|
"instaParser": "https://ddinstagram.com/",
|
||||||
}
|
"tiktokParser": "https://www.vxtiktok.com/"
|
||||||
|
}
|
31
index.js
31
index.js
|
@ -1,6 +1,11 @@
|
||||||
// Require the necessary discord.js classes
|
|
||||||
const { Client, GatewayIntentBits } = require('discord.js');
|
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');
|
const http = require('http');
|
||||||
// Create a new client instance
|
// Create a new client instance
|
||||||
const client = new Client({
|
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
|
// Login to Discord with your client's token
|
||||||
client.login(token);
|
client.login(token);
|
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mediafixer",
|
"name": "mediafixer",
|
||||||
"version": "1.2.4",
|
"version": "1.2.5",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mediafixer",
|
"name": "mediafixer",
|
||||||
"version": "1.2.4",
|
"version": "1.2.5",
|
||||||
"description": "Fixes broken twitter embeds by replying with a reformatted link.",
|
"description": "Fixes broken twitter embeds by replying with a reformatted link.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Loading…
Reference in a new issue