delete a tweet
This commit is contained in:
parent
75fbcc0687
commit
84a4f4137b
1 changed files with 49 additions and 0 deletions
49
commands/owner/rtweet.js
Normal file
49
commands/owner/rtweet.js
Normal file
|
@ -0,0 +1,49 @@
|
|||
const { Command } = require('discord-akairo');
|
||||
const Twitter = require('twitter-lite');
|
||||
const { twiConsumer, twiConsumerSecret, twiToken, twiTokenSecret } = require('../../config.json');
|
||||
|
||||
class rtweetCommand extends Command {
|
||||
constructor() {
|
||||
super('rtweet', {
|
||||
aliases: ['rtweet', 'rmtweet'],
|
||||
category: 'general',
|
||||
cooldown: 86400,
|
||||
ratelimit: 1,
|
||||
args: [
|
||||
{
|
||||
id: 'text',
|
||||
type: 'string',
|
||||
match: 'rest'
|
||||
}
|
||||
],
|
||||
description: {
|
||||
content: 'Delete a tweet',
|
||||
usage: '[tweet id]',
|
||||
examples: ['1099882994599383040']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async exec(message, args) {
|
||||
let text = args.text;
|
||||
try {
|
||||
let client = new Twitter({
|
||||
consumer_key: twiConsumer,
|
||||
consumer_secret: twiConsumerSecret,
|
||||
access_token_key: twiToken,
|
||||
access_token_secret: twiTokenSecret
|
||||
});
|
||||
|
||||
client.post('statuses/destroy', {
|
||||
id: text
|
||||
});
|
||||
return message.channel.send('Tweet have been deleted!');
|
||||
} catch(err) {
|
||||
console.error(err);
|
||||
return message.channel.send('Oh no, an error has occured :(');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = rtweetCommand;
|
Loading…
Reference in a new issue