Added more commands, added an auto-delete mechanism for a 12-year-old's spam, various fixes
This commit is contained in:
parent
51c2547fd5
commit
d78bb8dff7
Binary file not shown.
After Width: | Height: | Size: 350 KiB |
|
@ -0,0 +1,24 @@
|
||||||
|
const gm = require("gm").subClass({
|
||||||
|
imageMagick: true
|
||||||
|
});
|
||||||
|
const gmToBuffer = require("../utils/gmbuffer.js");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
const image = await require("../utils/imagedetect.js")(message);
|
||||||
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to tile!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
gm(imageBuffer).command("montage").out("-duplicate").out(24).tile("5x5").geometry("+0+0").stream(async (error, output) => {
|
||||||
|
if (error) console.error;
|
||||||
|
const data = gm(output).resize("800x800>");
|
||||||
|
const resultBuffer = await gmToBuffer(data);
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: resultBuffer,
|
||||||
|
name: `tile.${image.type}`
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["wall2"];
|
|
@ -0,0 +1,25 @@
|
||||||
|
const gm = require("gm").subClass({
|
||||||
|
imageMagick: true
|
||||||
|
});
|
||||||
|
const gmToBuffer = require("../utils/gmbuffer.js");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
const fs = require("fs");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
const image = await require("../utils/imagedetect.js")(message);
|
||||||
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a Trump meme!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const template = "./assets/images/trump.png";
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
const path = require("tempy").file({
|
||||||
|
extension: image.type
|
||||||
|
});
|
||||||
|
require("util").promisify(fs.writeFile)(path, imageBuffer);
|
||||||
|
const command = gm(template).out("-background").out("none").out("-gravity").out("South").out("(").out("-clone").out("0").out("(").out(path).out("-virtual-pixel").out("transparent").out("-resize").out("365x179!").out("+distort").out("Perspective").out("0,0 207,268 365,0 548,271 365,179 558,450 0,179 193,450").out(")").out("-geometry").out("-25-1").out("-composite").out(")").out("+swap").out("-composite");
|
||||||
|
const resultBuffer = await gmToBuffer(command);
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: resultBuffer,
|
||||||
|
name: "trump.png"
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,49 @@
|
||||||
|
const client = require("../utils/client.js");
|
||||||
|
|
||||||
|
exports.run = async (message, args) => {
|
||||||
|
const getUser = message.mentions.length >= 1 ? message.mentions[0] : (args.length !== 0 ? client.users.get(args[0]) : message.author);
|
||||||
|
const user = getUser !== undefined ? getUser : message.author;
|
||||||
|
const member = message.channel.guild.members.get(user.id);
|
||||||
|
const infoEmbed = {
|
||||||
|
"embed": {
|
||||||
|
"title": `${user.username}#${user.discriminator}`,
|
||||||
|
"thumbnail": {
|
||||||
|
"url": user.avatarURL
|
||||||
|
},
|
||||||
|
"color": 16711680,
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "🔢 **ID:**",
|
||||||
|
"value": user.id
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "📛 **Nickname:**",
|
||||||
|
"value": member.nick ? member.nick : "None"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "🤖 **Bot:**",
|
||||||
|
"value": user.bot ? "Yes" : "No"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "🗓️ **Joined Discord on:**",
|
||||||
|
"value": new Date(user.createdAt).toString()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "💬 **Joined this server on:**",
|
||||||
|
"value": new Date(member.joinedAt).toString()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ℹ️ **Status:**",
|
||||||
|
"value": member.status
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "🎮 **Playing:**",
|
||||||
|
"value": member.activities ? member.activities[0].name : "Nothing"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return message.channel.createMessage(infoEmbed);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["user"];
|
|
@ -0,0 +1,37 @@
|
||||||
|
// really don't like this file
|
||||||
|
|
||||||
|
const gm = require("gm").subClass({
|
||||||
|
imageMagick: true
|
||||||
|
});
|
||||||
|
const tempy = require("tempy");
|
||||||
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
exports.run = async (message) => {
|
||||||
|
const image = await require("../utils/imagedetect.js")(message);
|
||||||
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to mirror!`;
|
||||||
|
message.channel.sendTyping();
|
||||||
|
const imageData = await fetch(image.url);
|
||||||
|
const imageBuffer = await imageData.buffer();
|
||||||
|
const data = tempy.file({
|
||||||
|
extension: image.type
|
||||||
|
});
|
||||||
|
const data2 = tempy.file({
|
||||||
|
extension: image.type
|
||||||
|
});
|
||||||
|
gm(imageBuffer).gravity("East").crop("50%", 0).strip().write(data2, (error) => {
|
||||||
|
if (error) console.error;
|
||||||
|
gm(data2).flop().strip().write(data, async (error) => {
|
||||||
|
if (error) console.error;
|
||||||
|
gm(data).append(data2, true).toBuffer(image.type, (error, resultBuffer) => {
|
||||||
|
if (error) console.error;
|
||||||
|
return message.channel.createMessage("", {
|
||||||
|
file: resultBuffer,
|
||||||
|
name: `waaw.${image.type}`
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.aliases = ["magik3", "mirror"];
|
||||||
|
|
|
@ -2,6 +2,5 @@ const logger = require("../utils/logger.js");
|
||||||
|
|
||||||
// run when eris encounters an error
|
// run when eris encounters an error
|
||||||
module.exports = async (error, id) => {
|
module.exports = async (error, id) => {
|
||||||
logger.error(`An error event was sent by Eris in shard ${id}: \n${error.toString()}`);
|
logger.error(`An error event was sent by Eris in shard ${id}: \n${error.message}`);
|
||||||
logger.error(error.toString());
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,7 +16,8 @@ module.exports = async (message) => {
|
||||||
const prefix = prefixMention.test(message.content) ? message.content.match(prefixMention)[0] : guildConf.prefix;
|
const prefix = prefixMention.test(message.content) ? message.content.match(prefixMention)[0] : guildConf.prefix;
|
||||||
|
|
||||||
// ignore other stuff
|
// ignore other stuff
|
||||||
if (message.content.startsWith(prefix) === false && message.mentions.indexOf(client.user) <= -1 && message.channel.id !== "573553254575898626") return;
|
// && !message.attachments && message.attachments[0].filename !== "1561668913236-3.gif"
|
||||||
|
if (message.content.startsWith(prefix) === false && message.mentions.indexOf(client.user) <= -1 && message.channel.id !== "573553254575898626" && (!message.content.match(/https?:\/\/(media|cdn)\.discordapp\.(net|com)\/attachments\/596766080014221373\/606176845871972383\/1561668913236-3.gif/))) return;
|
||||||
|
|
||||||
// funny stuff
|
// funny stuff
|
||||||
if (message.channel.id === "573553254575898626" && message.channel.guild.id === "433408970955423765") {
|
if (message.channel.id === "573553254575898626" && message.channel.guild.id === "433408970955423765") {
|
||||||
|
@ -32,6 +33,12 @@ module.exports = async (message) => {
|
||||||
await client.createMessage(generalChannel.id, message.content);
|
await client.createMessage(generalChannel.id, message.content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const odyMessages = ["Nope!", "No jojo gif here", "sorry ody, this gif is illegal", "get owned"];
|
||||||
|
// || (message.attachments && message.attachments[0].filename === "1561668913236-3.gif")
|
||||||
|
if (message.channel.guild.id === "322114245632327703" && (message.content.match(/https?:\/\/(media|cdn)\.discordapp\.(net|com)\/attachments\/596766080014221373\/606176845871972383\/1561668913236-3.gif/))) {
|
||||||
|
await message.delete("anti-jojo mechanism");
|
||||||
|
await client.createMessage(message.channel.id, misc.random(odyMessages));
|
||||||
|
}
|
||||||
|
|
||||||
// separate commands and args
|
// separate commands and args
|
||||||
const escapedPrefix = misc.regexEscape(prefix);
|
const escapedPrefix = misc.regexEscape(prefix);
|
||||||
|
|
|
@ -3,6 +3,7 @@ const MessageCollector = require("./awaitmessages.js");
|
||||||
const client = require("../client.js");
|
const client = require("../client.js");
|
||||||
|
|
||||||
const paginationEmbed = async (message, pages, timeout = 120000) => {
|
const paginationEmbed = async (message, pages, timeout = 120000) => {
|
||||||
|
const manageMessages = message.channel.guild.members.get(client.user.id).permission.has("manageMessages") || message.channel.permissionsOf(client.user.id).has("manageMessages") ? true : false;
|
||||||
let page = 0;
|
let page = 0;
|
||||||
pages[page].embed.footer.text = `Page ${page + 1} of ${pages.length}`;
|
pages[page].embed.footer.text = `Page ${page + 1} of ${pages.length}`;
|
||||||
const currentPage = await message.channel.createMessage(pages[page]);
|
const currentPage = await message.channel.createMessage(pages[page]);
|
||||||
|
@ -11,36 +12,44 @@ const paginationEmbed = async (message, pages, timeout = 120000) => {
|
||||||
await currentPage.addReaction(emoji);
|
await currentPage.addReaction(emoji);
|
||||||
}
|
}
|
||||||
const reactionCollector = new ReactionCollector(currentPage, (message, reaction, user) => emojiList.includes(reaction.name) && !client.users.get(user).bot, { time: timeout });
|
const reactionCollector = new ReactionCollector(currentPage, (message, reaction, user) => emojiList.includes(reaction.name) && !client.users.get(user).bot, { time: timeout });
|
||||||
reactionCollector.on("reaction", (msg, reaction) => {
|
reactionCollector.on("reaction", (msg, reaction, userID) => {
|
||||||
//reaction.users.remove(msg.author);
|
if (userID === message.author.id) {
|
||||||
//const reactionAuthor = currentPage.getReactions();
|
switch (reaction.name) {
|
||||||
switch (reaction.name) {
|
case "◀":
|
||||||
case "◀":
|
page = page > 0 ? --page : pages.length - 1;
|
||||||
page = page > 0 ? --page : pages.length - 1;
|
pages[page].embed.footer.text = `Page ${page + 1} of ${pages.length}`;
|
||||||
pages[page].embed.footer.text = `Page ${page + 1} of ${pages.length}`;
|
currentPage.edit(pages[page]);
|
||||||
currentPage.edit(pages[page]);
|
if (manageMessages) msg.removeReaction("◀", userID);
|
||||||
break;
|
break;
|
||||||
case "🔢":
|
case "🔢":
|
||||||
message.channel.createMessage(`${message.author.mention}, what page do you want to jump to?`).then(askMessage => {
|
message.channel.createMessage(`${message.author.mention}, what page do you want to jump to?`).then(askMessage => {
|
||||||
const messageCollector = new MessageCollector(askMessage.channel, (response) => response.author.id === message.author.id && !isNaN(response.content) && Number(response.content) <= pages.length, { time: timeout, maxMatches: 1 });
|
const messageCollector = new MessageCollector(askMessage.channel, (response) => response.author.id === message.author.id && !isNaN(response.content) && Number(response.content) <= pages.length, {
|
||||||
return messageCollector.on("message", response => {
|
time: timeout,
|
||||||
askMessage.delete();
|
maxMatches: 1
|
||||||
page = Number(response.content) - 1;
|
});
|
||||||
pages[page].embed.footer.text = `Page ${page + 1} of ${pages.length}`;
|
return messageCollector.on("message", response => {
|
||||||
currentPage.edit(pages[page]);
|
askMessage.delete();
|
||||||
|
page = Number(response.content) - 1;
|
||||||
|
pages[page].embed.footer.text = `Page ${page + 1} of ${pages.length}`;
|
||||||
|
currentPage.edit(pages[page]);
|
||||||
|
if (manageMessages) msg.removeReaction("🔢", userID);
|
||||||
|
});
|
||||||
|
}).catch(error => {
|
||||||
|
if (error) console.error;
|
||||||
});
|
});
|
||||||
}).catch(error => { if (error) console.error; });
|
break;
|
||||||
break;
|
case "▶":
|
||||||
case "▶":
|
page = page + 1 < pages.length ? ++page : 0;
|
||||||
page = page + 1 < pages.length ? ++page : 0;
|
pages[page].embed.footer.text = `Page ${page + 1} of ${pages.length}`;
|
||||||
pages[page].embed.footer.text = `Page ${page + 1} of ${pages.length}`;
|
currentPage.edit(pages[page]);
|
||||||
currentPage.edit(pages[page]);
|
if (manageMessages) msg.removeReaction("▶", userID);
|
||||||
break;
|
break;
|
||||||
case "🗑":
|
case "🗑":
|
||||||
currentPage.delete();
|
currentPage.delete();
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
reactionCollector.on("end", () => currentPage.removeReactions());
|
reactionCollector.on("end", () => currentPage.removeReactions());
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
const client = require("./client.js");
|
const client = require("./client.js");
|
||||||
|
const fs = require("fs");
|
||||||
|
const logger = require("./logger.js");
|
||||||
|
|
||||||
module.exports = async (sound, message) => {
|
module.exports = async (sound, message) => {
|
||||||
if (message.member.voiceState.channelID) {
|
if (message.member.voiceState.channelID) {
|
||||||
|
@ -9,10 +11,10 @@ module.exports = async (sound, message) => {
|
||||||
if (connection.playing) {
|
if (connection.playing) {
|
||||||
connection.stopPlaying();
|
connection.stopPlaying();
|
||||||
}
|
}
|
||||||
connection.play(require("fs").createReadStream(sound));
|
connection.play(fs.createReadStream(sound));
|
||||||
connection.on("error", (error) => {
|
connection.on("error", (error) => {
|
||||||
voiceChannel.leave();
|
voiceChannel.leave();
|
||||||
require("./logger.js").error(error);
|
logger.error(error);
|
||||||
});
|
});
|
||||||
connection.once("end", () => {
|
connection.once("end", () => {
|
||||||
voiceChannel.leave();
|
voiceChannel.leave();
|
||||||
|
|
Loading…
Reference in New Issue