diff --git a/commands/pixelate.js b/commands/pixelate.js new file mode 100644 index 0000000..45fcd19 --- /dev/null +++ b/commands/pixelate.js @@ -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"; \ No newline at end of file diff --git a/commands/play.js b/commands/play.js index 536c5c2..9694361 100644 --- a/commands/play.js +++ b/commands/play.js @@ -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"; \ No newline at end of file +exports.help = "Plays an audio file"; +exports.requires = "sound"; \ No newline at end of file