You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
987 B
Plaintext
39 lines
987 B
Plaintext
3 months ago
|
// TODO
|
||
|
// Switch to 'twitter-api-v2'
|
||
2 years ago
|
import { SlashCommandBuilder } from 'discord.js';
|
||
2 years ago
|
import Twit from 'twit';
|
||
|
|
||
|
const { twiConsumer, twiConsumerSecret, twiToken, twiTokenSecret } = process.env;
|
||
|
|
||
|
export default {
|
||
|
data: new SlashCommandBuilder()
|
||
2 years ago
|
.setName('deletetweet')
|
||
2 years ago
|
.setDescription('Delete a tweet')
|
||
|
.addStringOption(option =>
|
||
|
option.setName('tweetid')
|
||
|
.setDescription('The id of the tweet you wish to delete.')
|
||
|
.setRequired(true)),
|
||
2 years ago
|
category: 'owner',
|
||
2 years ago
|
ownerOnly: true,
|
||
2 years ago
|
async execute(interaction, args) {
|
||
2 years ago
|
await interaction.deferReply();
|
||
|
try {
|
||
|
const T = new Twit({
|
||
|
consumer_key: twiConsumer,
|
||
|
consumer_secret: twiConsumerSecret,
|
||
|
access_token: twiToken,
|
||
|
access_token_secret: twiTokenSecret,
|
||
|
});
|
||
|
|
||
|
T.post('statuses/destroy', {
|
||
2 years ago
|
id: args.tweetid,
|
||
2 years ago
|
});
|
||
|
return interaction.editReply('Tweet have been deleted!');
|
||
|
}
|
||
|
catch (err) {
|
||
|
console.error(err);
|
||
|
return interaction.editReply('Oh no, an error has occurred :(');
|
||
|
}
|
||
|
},
|
||
|
};
|