Added pixelate, made play use the new system
This commit is contained in:
parent
7dbf6fdf2a
commit
c141540a2a
2 changed files with 24 additions and 24 deletions
18
commands/pixelate.js
Normal file
18
commands/pixelate.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
const gm = require("gm").subClass({
|
||||
imageMagick: true
|
||||
});
|
||||
|
||||
exports.run = async (message) => {
|
||||
message.channel.sendTyping();
|
||||
const image = await require("../utils/imagedetect.js")(message);
|
||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to pixelate!`;
|
||||
const buffer = await gm(image.path).coalesce().scale("10%").coalesce().scale("1000%").bufferPromise(image.type, image.delay);
|
||||
return {
|
||||
file: buffer,
|
||||
name: `pixelate.${image.type}`
|
||||
};
|
||||
};
|
||||
|
||||
exports.aliases = ["pixel", "small"];
|
||||
exports.category = 5;
|
||||
exports.help = "Pixelates an image";
|
|
@ -1,28 +1,10 @@
|
|||
const client = require("../utils/client.js");
|
||||
const soundPlayer = require("../utils/soundplayer.js");
|
||||
|
||||
exports.run = async (message) => {
|
||||
if (message.member.voiceState.channelID) {
|
||||
if (!message.channel.guild.members.get(client.user.id).permission.has("voiceConnect") || !message.channel.permissionsOf(client.user.id).has("voiceConnect")) return `${message.author.mention}, I can't join this voice channel!`;
|
||||
if (message.author.id !== "198198681982205953") return `${message.author.mention}, this command is for testing and is restricted to owners.`;
|
||||
const voiceChannel = message.channel.guild.channels.get(message.member.voiceState.channelID);
|
||||
client.createMessage(message.channel.id, "🔊 Playing...");
|
||||
const connection = await voiceChannel.join();
|
||||
connection.play(message.attachments[0].url, {
|
||||
inlineVolume: true
|
||||
});
|
||||
connection.setVolume(0.5);
|
||||
connection.on("error", (error) => {
|
||||
voiceChannel.leave();
|
||||
throw error;
|
||||
});
|
||||
connection.on("end", () => {
|
||||
voiceChannel.leave();
|
||||
return "This music session has now ended.";
|
||||
});
|
||||
} else {
|
||||
return `${message.author.mention}, you need to be in a voice channel first!`;
|
||||
}
|
||||
exports.run = async (message, args) => {
|
||||
if (message.author.id !== process.env.OWNER) return `${message.author.mention}, this command is for testing and is restricted to owners.`;
|
||||
return soundPlayer.play(encodeURIComponent(args.join(" ")), message);
|
||||
};
|
||||
|
||||
exports.category = 7;
|
||||
exports.help = "Plays an audio file";
|
||||
exports.help = "Plays an audio file";
|
||||
exports.requires = "sound";
|
Loading…
Reference in a new issue