Files
quarksBot/commands/tweet.js
T

53 lines
1.8 KiB
JavaScript

const { MessageEmbed } = require('discord.js');
module.exports = {
name: "tweet",
description: "Tweet your thoughts to the local twitter page",
usage: "[message]",
permissions: {
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
member: [],
},
SlashCommand: {
options: [
{
name: "message",
description: "Your message to tweet",
value: "message",
type: 3,
required: true,
},
],
/**
*
* @param {require("../structures/QuarksBot")} client
* @param {import("discord.js").MessageCreate} message
* @param {string[]} args
* @param {*} param3
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
}
let userID = interaction.member.user.id;
let avatar = interaction.member.user.avatar;
const tweetEmbed = new MessageEmbed()
.setColor('#0099ff')
.setTitle('New Twitter Notifciation')
.setThumbnail('https://static.vecteezy.com/system/resources/previews/002/534/045/original/social-media-twitter-logo-blue-isolated-free-vector.jpg')
.setAuthor({ name: `${interaction.member.user.username}`, iconURL: `https://cdn.discordapp.com/avatars/${userID}/${avatar}.png` })
.setDescription(args[0].value)
.setTimestamp()
if (client.exists(GuildDB.tweetChannel)) {
const channel = interaction.guild.channels.cache.find(channel => channel.id === GuildDB.tweetChannel);
channel.send({ embeds: [tweetEmbed] });
return interaction.send('Tweeted!');
} else {
return interaction.send({ content: 'Tweeted!', embeds: [tweetEmbed] });
}
},
},
}