forked from Supositware/Haha-Yes
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.
41 lines
964 B
JavaScript
41 lines
964 B
JavaScript
const { Command } = require('discord-akairo');
|
|
const fetch = require('node-fetch');
|
|
const { fbToken, fbID } = require('../../config.json');
|
|
|
|
class rfacebookCommand extends Command {
|
|
constructor() {
|
|
super('rfacebook', {
|
|
aliases: ['rfacebook', 'rfb'],
|
|
category: 'general',
|
|
args: [
|
|
{
|
|
id: 'id',
|
|
type: 'string',
|
|
match: 'rest'
|
|
}
|
|
],
|
|
description: {
|
|
content: 'Post your message to the bot rfacebook page',
|
|
usage: '[text]',
|
|
examples: ['epic']
|
|
}
|
|
});
|
|
}
|
|
|
|
async exec(message, args) {
|
|
fetch(`https://graph.facebook.com/${fbID}_${args.id}?access_token=${fbToken}`, {
|
|
method: 'delete',
|
|
}).then((response) => {
|
|
return response.json();
|
|
}).then((response) => {
|
|
console.log(response.success);
|
|
if (response.success) {
|
|
return message.channel.send('Sucessfully deleted the post');
|
|
} else {
|
|
return message.channel.send('An error has occured :(');
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
module.exports = rfacebookCommand; |