JaBa/commands/Images/tweet.js

49 lines
1.3 KiB
JavaScript
Raw Normal View History

2021-12-10 21:39:54 +05:00
const Command = require("../../base/Command.js"),
Discord = require("discord.js");
class Tweet extends Command {
2021-12-26 19:29:37 +05:00
constructor(client) {
2021-12-10 21:39:54 +05:00
super(client, {
name: "tweet",
dirname: __dirname,
enabled: false,
guildOnly: false,
2021-12-26 19:29:37 +05:00
aliases: ["twitter"],
2021-12-10 21:39:54 +05:00
memberPermissions: [],
2021-12-26 19:29:37 +05:00
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
2021-12-10 21:39:54 +05:00
nsfw: false,
ownerOnly: false,
cooldown: 5000
});
}
2021-12-26 19:29:37 +05:00
async run(message, args) {
2021-12-10 21:39:54 +05:00
const user = message.mentions.users.first() || message.author;
const text = args.slice(1).join(" ");
2021-12-11 01:11:50 +05:00
if (!user) return message.error("images/tweet:MISSING_USERNAME");
2021-12-10 21:39:54 +05:00
2021-12-11 01:11:50 +05:00
if (!text) return message.error("images/tweet:MISSING_TEXT");
2021-12-10 21:39:54 +05:00
2021-12-26 19:29:37 +05:00
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
2021-12-10 21:39:54 +05:00
await message.guild.members.fetch();
const randomMembers = message.guild.members.cache.random(3);
const buffer = await this.client.AmeAPI.generate("twitter", {
url: user.displayAvatarURL(),
avatar1: randomMembers[0].user.displayAvatarURL(),
avatar2: randomMembers[1].user.displayAvatarURL(),
avatar3: randomMembers[2].user.displayAvatarURL(),
text
});
const attachment = new Discord.MessageAttachment(buffer, "twitter.png");
m.delete();
2021-12-26 19:29:37 +05:00
2021-12-10 21:39:54 +05:00
message.channel.send(attachment);
}
2021-12-11 01:11:50 +05:00
};
2021-12-10 21:39:54 +05:00
module.exports = Tweet;