65 lines
2.4 KiB
JavaScript
65 lines
2.4 KiB
JavaScript
const { MessageEmbed } = require('discord.js');
|
|
|
|
module.exports = {
|
|
name: "tweet",
|
|
debug: false,
|
|
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);
|
|
if (!channel) {
|
|
const embed = new MessageEmbed()
|
|
.setDescriptions(`**Internal Error:** ${err}\nThe channel may have been deleted\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
|
|
.setColor("RED")
|
|
|
|
return interaction.send({ embeds: [embed] });
|
|
}
|
|
try {
|
|
channel.send({ embeds: [tweetEmbed] });
|
|
} catch (err) {
|
|
return interaction.send(`<@${client.user.id}> Does not have permissions to send to the channel.\nMake sure your admins give <@${client.user.id}> access to all channels required. `)
|
|
}
|
|
return interaction.send('Tweeted!');
|
|
} else {
|
|
return interaction.send({ content: 'Tweeted!', embeds: [tweetEmbed] });
|
|
}
|
|
},
|
|
},
|
|
} |