Compare commits
1 Commits
master
...
dependabot
Author | SHA1 | Date | |
---|---|---|---|
|
55742365b6 |
@ -179,10 +179,6 @@ client.on('message', message => (async function(message){
|
|||||||
|
|
||||||
case "ping": message.channel.send('pong'); break;
|
case "ping": message.channel.send('pong'); break;
|
||||||
|
|
||||||
case "randomemoji":
|
|
||||||
message.channel.send(client.emojis.random().toString());
|
|
||||||
break;
|
|
||||||
|
|
||||||
// experimental
|
// experimental
|
||||||
case "record": {
|
case "record": {
|
||||||
let id = txt(1);
|
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 */
|
/* fake nitro for solitary emoji */
|
||||||
|
|
||||||
client.on("message", async message => {
|
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
3799
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"main": "lampselfbot.js",
|
"main": "lampselfbot.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"discord.js": "github:ledlamp/discord.js#v11.6.4-mod",
|
"discord.js": "^11.4.2",
|
||||||
"exit-hook": "^2.0.0",
|
"exit-hook": "^2.0.0",
|
||||||
"express": "^4.17.1",
|
|
||||||
"gifsicle": "^5.1.0",
|
"gifsicle": "^5.1.0",
|
||||||
|
"node-opus": "^0.3.1",
|
||||||
"sharp": "^0.25.2",
|
"sharp": "^0.25.2",
|
||||||
"snekfetch": "^4.0.4"
|
"snekfetch": "^4.0.4"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user