Compare commits

..

1 Commits

Author SHA1 Message Date
dependabot[bot] 55742365b6
Bump tar from 6.0.1 to 6.1.4
Bumps [tar](https://github.com/npm/node-tar) from 6.0.1 to 6.1.4.
- [Release notes](https://github.com/npm/node-tar/releases)
- [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-tar/compare/v6.0.1...v6.1.4)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-03 22:36:01 +00:00
3 changed files with 450 additions and 3986 deletions

View File

@ -179,10 +179,6 @@ client.on('message', message => (async function(message){
case "ping": message.channel.send('pong'); break;
case "randomemoji":
message.channel.send(client.emojis.random().toString());
break;
// experimental
case "record": {
let id = txt(1);
@ -236,6 +232,83 @@ client.on('message', message => (async function(message){
/* notify me if someone mentioned a keyword */
{
let webhook = config.mentionChannelWebhook;
webhook = new Discord.WebhookClient(webhook.id, webhook.token);
client.on("message", async message => {
if (message.author.id == client.user.id || !message.guild || message.guild.muted) return;
for (let keyword of config.mentionKeywords) {
if (message.content.toLowerCase().includes(keyword)) {
webhook.send(`<@${client.user.id}> https://discordapp.com/channels/${message.guild ? message.guild.id + "/" : ""}${message.channel.id}/${message.id}`, {embeds:[{
color: (message.member && message.member.displayColor) || undefined,
author: {
name: (message.member && message.member.displayName) || message.author.username,
icon_url: message.author.avatarURL
},
description: message.content,
timestamp: message.createdAt,
image: (message.attachments.first() && message.attachments.first().width) ? {url:message.attachments.first().url} : undefined,
footer: {
text: `${message.guild.name} ▶︎ #${message.channel.name}`
}
}]});
break;
}
}
});
}
/* embed linked messages */
client.on("message", async function (message) {
if (message.author.id !== client.user.id) return;
let mlm = message.content.match(/https:\/\/(?:ptb\.|canary\.|)?(?:discord\.com|discordapp\.com)\/channels\/(\d+|@me)\/(\d+)\/(\d+)/);
if (!mlm) return;
let lmc = client.channels.get(mlm[2]);
if (!lmc) return;
let lm = await lmc.fetchMessage(mlm[3]);
if (!lm) return;
let imageCandidate = lm.attachments.find(a => [".png",".jpg",".jpeg",".webp",".gif"].some(e => a.url.toLowerCase().endsWith(e)));
if (imageCandidate) imageCandidate["will be used for the image of the embed"] = true;
else imageCandidate = lm.embeds.find(e => e.type == 'image');
let attachments = lm.attachments.filter(a => !a["will be used for the image of the embed"]).map(a => `[${a.filename}](${a.url})`).join('\n');
let lme = {
color: (lm.member && lm.member.displayColor) || undefined,
author: {
name: (lm.member && lm.member.displayName) || lm.author.username,
icon_url: lm.author.avatarURL
},
description: lm.content,
timestamp: lm.createdAt,
image: imageCandidate && {url: imageCandidate.url},
fields: attachments ? [
{name: "Attachments", value: attachments}
] : undefined,
footer: {
icon_url: lm.channel != message.channel ? lm.guild ? lm.guild.iconURL : lm.channel.recipient.avatarURL : undefined,
text: lm.channel != message.channel ? lm.channel.type == 'dm' ? `@${lm.channel.recipient.username}` : `${lm.guild != message.guild ? `${lm.guild.name} ▶︎ ` : ''}#${lm.channel.name}` : undefined
}
};
await message.edit(undefined, {embed: lme});
});
/* fake nitro for solitary emoji */
client.on("message", async message => {
@ -272,15 +345,3 @@ client.on("message", async message => {
});
/* fun little web server */
global.app = require('express')();
app.get("/emojis", async (req, res) => {
res.send(client.emojis.map(e=>`<img width="48px" height="48px" title="${e.name}" src="${e.url}" />`).join(''));
});
app.server = app.listen(3975);

3799
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,10 @@
{
"main": "lampselfbot.js",
"dependencies": {
"discord.js": "github:ledlamp/discord.js#v11.6.4-mod",
"discord.js": "^11.4.2",
"exit-hook": "^2.0.0",
"express": "^4.17.1",
"gifsicle": "^5.1.0",
"node-opus": "^0.3.1",
"sharp": "^0.25.2",
"snekfetch": "^4.0.4"
}