mirror of
https://github.com/LeviSnoot/MediaFixer.git
synced 2024-12-03 18:20:02 +01:00
Extended support
Instagram support, fix for links from mobile twitter
This commit is contained in:
parent
09b00b6197
commit
fa09f7d65c
1 changed files with 32 additions and 1 deletions
33
index.js
33
index.js
|
@ -1,6 +1,6 @@
|
||||||
// Require the necessary discord.js classes
|
// Require the necessary discord.js classes
|
||||||
const { Client, GatewayIntentBits } = require('discord.js');
|
const { Client, GatewayIntentBits } = require('discord.js');
|
||||||
const { token, tweetParser } = require('./config.json');
|
const { token, tweetParser, instaParser } = 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({
|
||||||
|
@ -32,5 +32,36 @@ client.on('messageCreate', async message => {
|
||||||
message.reply({ content: newmsg, allowedMentions: { repliedUser: false } });
|
message.reply({ content: newmsg, allowedMentions: { repliedUser: false } });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
client.on('messageCreate', async message => {
|
||||||
|
if (message.content.startsWith('https://mobile.twitter.com/')) {
|
||||||
|
const mobiletweetURL = message.content.substring(27, message.content.length);
|
||||||
|
message.suppressEmbeds(true);
|
||||||
|
|
||||||
|
const newmsg = tweetParser + mobiletweetURL;
|
||||||
|
message.reply({ content: newmsg, allowedMentions: { repliedUser: false } });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on('messageCreate', async message => {
|
||||||
|
if (message.content.startsWith('https://instagram.com/')) {
|
||||||
|
const instaURL = message.content.substring(22, message.content.length);
|
||||||
|
message.suppressEmbeds(true);
|
||||||
|
|
||||||
|
const newmsg = instaParser + instaURL;
|
||||||
|
message.reply({ content: newmsg, allowedMentions: { repliedUser: false } });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on('messageCreate', async message => {
|
||||||
|
if (message.content.startsWith('https://www.instagram.com/')) {
|
||||||
|
const instaURL2 = message.content.substring(26, message.content.length);
|
||||||
|
message.suppressEmbeds(true);
|
||||||
|
|
||||||
|
const newmsg = instaParser + instaURL2;
|
||||||
|
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);
|
||||||
|
|
Loading…
Reference in a new issue