Added basic twitter bot and spin, updated readme, other various changes

This commit is contained in:
TheEssem 2019-11-15 10:59:50 -06:00
parent d661b58271
commit f7756f1b52
14 changed files with 416 additions and 48 deletions

View file

@ -1,7 +1,7 @@
const { clean } = require("../utils/misc.js");
exports.run = async (message, args) => {
if (message.author.id !== "198198681982205953") return `${message.author.mention}, only the bot owner can use eval!`;
if (message.author.id !== process.env.OWNER) return `${message.author.mention}, only the bot owner can use eval!`;
const code = args.join(" ");
try {
const evaled = eval(code);

View file

@ -3,7 +3,7 @@ const util = require("util");
const exec = util.promisify(require("child_process").exec);
exports.run = async (message, args) => {
if (message.author.id !== "198198681982205953") return `${message.author.mention}, only the bot owner can use exec!`;
if (message.author.id !== process.env.OWNER) return `${message.author.mention}, only the bot owner can use exec!`;
const code = args.join(" ");
try {
const execed = await exec(code);

View file

@ -3,7 +3,7 @@ const database = require("../utils/database.js");
exports.run = async (message, args) => {
const guild = (await database.guilds.find({ id: message.channel.guild.id }).exec())[0];
if (args.length !== 0) {
if (!message.member.permission.has("administrator") && message.member.id !== "198198681982205953") return `${message.author.mention}, you need to be an administrator to change the bot prefix!`;
if (!message.member.permission.has("administrator") && message.member.id !== process.env.OWNER) return `${message.author.mention}, you need to be an administrator to change the bot prefix!`;
guild.set("prefix", args[0]);
await guild.save();
return `The prefix has been changed to ${args[0]}.`;

21
commands/spin.js Normal file
View file

@ -0,0 +1,21 @@
const gm = require("gm").subClass({
imageMagick: true
});
const gmToBuffer = require("../utils/gmbuffer.js");
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 spin!`;
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
const command = gm(image.data).out("-duplicate", "29").scale("256x256>").scale("256x256<").out("-alpha", "on").background("transparent").virtualPixel("background").out("-distort", "SRT", "'%[fx:360*t/n]'").set("delay", "5").set("dispose", "Background").out("-loop", "0");
const resultBuffer = await gmToBuffer(command, "gif");
// xc:none -fill white -draw circle 128,128 128,0
// .out("-layers", "composite")
await processMessage.delete();
return message.channel.createMessage("", {
file: resultBuffer,
name: "spin.gif"
});
};
exports.aliases = ["rotate"];

View file

@ -37,4 +37,6 @@ exports.run = async (message) => {
}
};
return message.channel.createMessage(embed);
};
};
exports.aliases = ["status", "stat"];

9
commands/tweet.js Normal file
View file

@ -0,0 +1,9 @@
const twitter = require("../utils/twitter.js");
exports.run = async (message, args) => {
if (message.author.id !== process.env.OWNER) return `${message.author.mention}, only the bot owner can tweet!`;
if (args.length === 0) return `${message.author.mention}, you need to provide some text to tweet!`;
const info = await twitter.client.post("statuses/update", { status: args.join(" ") });
if (info.resp.statusCode !== 200) return `Something happened when trying to post this tweet: ${info.resp.statusCode} ${info.resp.statusMessage}`;
return `${message.author.mention}, a tweet with id ${info.data.id_str} has been posted with status code ${info.resp.statusCode} ${info.resp.statusMessage}.`;
};

View file

@ -38,7 +38,7 @@ exports.run = async (message, args) => {
},
{
"name": "🎮 **Playing:**",
"value": member.activities ? member.activities[0].name : "Nothing"
"value": member.game ? member.game.name : "Nothing"
}
]
}